This is the Instruction of the App "Stack_Calculator" what I developped for Apple iPhone series. I use this for my daily number calculation work and love it.

If you want to have a try, don't miss the link here, iTunes App Store: Stack_Calculator

===

Welcome

**Basic Concept**

Stack Calculator is a type of RPN (Reverse Polish Notation) calculator based on a 256 depth float-point number stack. A number stack equipped in a calculator is actually a more nature and much efficient way to manipulate number-crunching job and interface between machine and human. This calculator is designed as this concept.

By the help of the stack, calculation becomes a very interesting RPN form.

For example: 2 + 7x(5 + 4) + 9 would be

5 4 + 7 x 2 + 9 +

much simple and easy way without extra annoying parenthesis for calculations.

Also, all numbers automatically remain on stack during calculation, no extra store/recall commands are needed.

**Stack Fields**

Real numbers currently exist in stack, only showed top 7 (or 10) here, not editable, deeper numbers will not be displayed.

**Input Buffer**

The field to keyin and edit the number currently you inputed before you press 'Enter' button pushing it into stack.

**Number Digits Keyin Area**

Buttons, '1', '2', ... '9', '0', 'E', '.' to keyin number digits in input buffer

**Stack Depth**

To show how many the numbers currently exist in stack.

**[ <-- ]**

Backspace key to eliminate last digit if you have any typing mistake.

**[+/-]**

Change the sign of the number in the input buffer.

**[Drop]**

Drop (Clear) any number on input buffer (or the first number on top of stack.)

**[AC]**

Change the sign of the number in the input buffer.

**Commands:**

[**Enter**]

Put the number from input buffer into the top of stack.

[**+**]

Pop and sum up top two numbers on stack and leave the result back to the top of stack. (If there is a number on input buffer, push to stack first before summation.)

**Example**

5 [**Enter**] <-- push 5 into stack

9 [**+**] result: --> 5 + 9 = 14

[**-**]

Pop and subtract top first number from top second number on stack and leave the result back to the top of stack. (If there is a number on input buffer, push to stack first.)

**Example**

5 [**Enter**] <-- push 5 into stack

9 [**-**] result: --> 5 - 9 = -4

[**x**]

Pop and multiply top two numbers on stack and leave the result back to the top of stack. (If there is a number on input buffer, push to stack first.)

**Example**

5 [**Enter**] <-- push 5 into stack

9 [**x**] result: --> 5 x 9 = 45

[**/**]

Pop and divide top second number by top first number on stack and leave the result back to the top of stack. (If there is a number on input buffer, push to stack first.)

**Example**

5 [**Enter**] <-- push 5 into stack

9 [**/**] result: --> 5/9 = 0.5555555556

[**%**]

It actually equals to divide by 100 at the first number on top of stack.

**Example**

25 [**%**] --> 0.25

**Stack Operations Commands:**

[**Drop**]

Drop (clear) any number on the top of stack. (or input buffer)

[**Swap**]

Swap the order of two numbers on the top of stack.

[**Pick**]

Duplicate a specific number inside stack onto the top of stack. After press this button, calculator goes into "pick up" mode, then you have to tap further on the 'stack field' where the target number on the display to perform the action.

[**Roll**]

Roll a specific number inside stack out to the top of stack. After press this button, calculator goes into "roll out" mode, then you have to tap further on the 'stack field' where the target number on the display to perform the action.

By combination of these stack operation commands, you can freely manipulate any numbers in stack displayed on screen.

**Example:**

**A book costs $70 and on sale, 15% off, how much is it? How much you have saved? **

**Solution**

70 [**Enter**]

[**Pick**] (stack field #1) <-- duplicate original price

85 [**%**] [**x**] --> price with 15% off

[**Pick**] (stack field #2) <-- duplicate original price

[**Pick**] (stack field #2) <-- duplicate price with15% off

[**-**] --> saved money

**Example:**

**1 + ( 2 + 3 + 71 x ( 7 + 9 x 4 ) - 15 ) + 5 x 17 = ? **

**Solution**

9 [**Enter**] 4 [**Enter**]

[**x**] --> 9 x 4

7 [**Enter**]

[**+**] --> 9 x 4 + 7

71 [**Enter**]

[**x**] --> ( 9 x 4 + 7 ) x 71

3 [**Enter**]

[**+**] --> ( 9 x 4 + 7 ) x 71 + 3

2 [**Enter**]

[**+**] --> ( 9 x 4 + 7 ) x 71 + 3 + 2

15 [**Enter**]

[**-**] --> ( 9 x 4 + 7 ) x 71 + 3 + 2 - 15

5 [**Enter**] 17 [**Enter**] [**x**]

[**+**] --> ( 9 x 4 + 7 ) x 71 + 3 + 2 - 15 + 5 x 17

1 [**Enter**]

[**+**] --> ( 9 x 4 + 7 ) x 71 + 3 + 2 - 15 + 5 x 17 + 1 = 3129

**Example:**

**5 guys went together for dinner, they have their dinner meals with $20, $25, $15, $18, $19 and tip 10%**

**How much total payment they have to pay?**

**If they want to share in average for each people, how much payment each one has to pay? **

**Solution**

20 [**Enter**]

25 [**Enter**]

15 [**Enter**]

18 [**Enter**]

19 [**Enter**]

[+] [+] [+] [+] <-- total payment

[**Pick**] (stack field #1) <-- duplicate total payment

110 [**%**] [**x**] <-- total payment with 10% tip

[**Pick**] (stack field #1) <-- duplicate total payment w. tip

5 [**/**] <-- average for 5 guys

**Continuous Operation Mode:**

When there exists only one number on stack (or input buffer), if you tap [+], [-], [x], [/], one of these 4 buttons, calculator will enter into **continuous operation mode**. A '**K**' mark will appear on display to indicate calculator is in this mode.

When in this mode, the initial number on stack will be memorized, then if you continuously tap [**Enter**] button, this number will continuously be calculated with the number on top of the stack by the same operator again and again.

If calculator is in 'Continuous operation mode', tap any key besides [Enter] will leave this mode.

**Example**

Continuously add with constant number 1

**Solution**

[**AC**]

1 [**+**] <-- goes into Continuous operation mode with 'add' operation, constant number is 1, 'K' mark appears on display.

[**Enter**] --> 2

[**Enter**] --> 3

[**Enter**] --> 4

[**Enter**] --> 5

[**Enter**] --> 6

[**Enter**] --> 7

...

TIP: You can use this as a counter to count anything by your iPhone!

**Example**

Continuously multiply with constant number 2

**Solution**

[**AC**]

2 [**x**] <-- goes into Continuous operation mode with 'multiply' operation, constant number is 2, 'K' mark appears on display.

[**Enter**] --> 4

[**Enter**] --> 8

[**Enter**] --> 16

[**Enter**] --> 32

[**Enter**] --> 64

[**Enter**] --> 128

...

**Example**

Continuously divide with constant number 5

**Solution**

[**AC**]

5 [**/**] <-- goes into Continuous operation mode with 'divide' operation, constant number is 5, 'K' mark appears on display.

[**Enter**] --> 1

[**Enter**] --> 0.2

[**Enter**] --> 0.04

[**Enter**] --> 0.008

[**Enter**] --> 0.0016

[**Enter**] --> 0.00032

...

**Mode Buttons**

**4 Number Notation Mode:**

[**Norm**]

Set number notation format of calculator back to normal, a 'Norm' will appear on display.

[**Fix**]

Display all numbers in fixing and rounding number at specific digits.

After tap this button, then you have to tap a number to set which digits for fixing and rounding off.

**Example**

2.71828

[**Fix**] [**3**] --> 2.718

3.41479

[**Fix**] [**4**] --> 3.4148

[**Sci**]

Display all numbers in scientific notation.

After tap this button, then you have to tap a number to set which digits for fixing and rounding off.

**Example**

27289010

[**Sci**] [**3**] --> 2.729e+7

[**Eng**]

Display all numbers in engineering notation. In this mode, number format will always in 1e+3 order scientific notation because that is more frequently used by engineers.

for example:

Length Unit (meter)

1m = 1e+3 mm = 1e+6 um = 1e+9 nm

Time Unit (second)

1S = 1e+3 mS = 1e+6 uS = 1e+9 nS

**Example**

2728901 (assume the unit is **um**)

[**Eng**] --> 27.289e+6 (then it's 27.289 **meter**)

0.00000004732418 (assume the unit is **meter**)

[**Eng**] --> 47.324e-9 (then it's 27.289 **nm**)

[**Deg**]/[**Rad**]

The unit for triangle functions.

Tap [**Deg**], the display indicator will show 'Deg' to indicate the unit for triangle is degree, all triangle function will work in degree for calculation.

Tap [**Rad**], the display indicator will show 'Rad' to indicate the unit for triangle is rad, all triangle function will work in rad for calculation.

**Mode Status Display**

**Power, Square Root...**

[**1/x**]

Set normal notation format of calculator back to normal, a 'Norm' will appear on display.

**Example**

5 [**1/x**] --> 0.2

3 [**1/x**] --> 0.333333333

Calculate the square root at the first number on top of the stack.

**Example**

2 --> 1.414213562

3 --> 1.732050807

Calculate the square at the first number on top of the stack.

**Example**

8 --> 64

256 --> 65536

Calculate exponentiation result of x^y. The second number on top of the stack is base x, the first number on top of the stack is exponent y.

**Example**

2 [**Enter**]

16 --> 65536

0.99 [**Enter**]

100 --> 0.3660323412

Calculate the y-th of root of x. The second number on top of the stack is base, the 1st number on top of the stack is y-th. The y can be any real number.

**Example**

8 [**Enter**]

3 --> 2

**Example**

Calculate (32 + 5^0.5)^(1/5) / (41 + 2^(1/3)) + 1.764^5.25 = ?

**Solution**

32 [**Enter**]

5 <-- 5^0.5

[**+**] <-- 32 + 5^0.5

5 [**1/x**]

<-- (32 + 5^0.5)^(1/5)

41 [**Enter**]

2 [**Enter**]

3 <-- 41 + 2^1/3

[**+**]

[**/**] <-- (32 + 5^0.5)^(1/5) / (41 + 2^(1/3))

1.764 [**Enter**]

5.25 <-- 1.764^5.25

[**+**] --> The result.

**Triangle Functions**

[**Trig**] / [**aTrig**] / [**Power**]

This is buttons switching button, only appears on iPhone SE/5s/5c/5/4s those models with smaller screen, be used to switch and appear some triangle function buttons. (sin, cos, tan; asin, acos, atan)

[**sin**]

Calculate sine value by first number on top of the stack. The unit is controlled by [**Deg**]/[**Rad**] button.

If current mode is "Degree", sine value is calculated by degree angle unit, if it's "Rad", sine value is calculated by Rad angle unit.

**Example**

[**Deg**] <-- switch to degree as unit

45 [**sin**] --> 0.707106781186547

[**cos**]

Calculate cosine value by first number on top of the stack. The unit is controlled by [**Deg**]/[**Rad**] button.

If current mode is "Degree", sine value is calculated by degree angle unit, if it's "Rad", sine value is calculated by Rad angle unit.

**Example**

[**Deg**] <-- switch to degree as unit

30 [**cos**] --> 0.866025403784439

[**tan**]

Calculate tangent value by first number on top of the stack. The unit is controlled by [**Deg**]/[**Rad**] button.

If current mode is "Degree", sine value is calculated by degree angle unit, if it's "Rad", sine value is calculated by Rad angle unit.

**Example**

[**Deg**] <-- switch to degree as unit

22.5 [**tan**] --> 0.414213562373095

[**asin**]

Calculate invert sine value by first number on top of the stack. The unit is controlled by [**Deg**]/[**Rad**] button.

**Example**

[**Deg**] <-- switch to degree as unit

0.707106781 [**asin**] --> 44.999999999985

[**acos**]

Calculate invert cosine value by first number on top of the stack. The unit is controlled by [**Deg**]/[**Rad**] button.

**Example**

[**Deg**] <-- switch to degree as unit

0.866025404 [**acos**] --> 29.999999975

[**atan**]

Calculate invert tangent value by first number on top of the stack. The unit is controlled by [**Deg**]/[**Rad**] button.

**Example**

[**Deg**] <-- switch to degree as unit

0.414213562 [**atan**] --> 22.499999982

**Some more examples**

**Example**

f(x) = 1.75 x^3 + 5.41 x^2 - 7.93 x + 42, calculate f(x=3.14) = ?

**Solution**

3.14 [**Enter**] <-- put x into stack first

[**Pick**] (stack field #1) <-- duplicate x

3 <-- X^3

1.75 [**x**] <-- 1.75 X^3

[**Pick**] (stack field #2) <-- duplicate x

2 <-- X^2

5.41 [**x**] <-- 5.41 X^2

[**+**]

[**Pick**] (stack field #2) <-- duplicate x

-7.93 [**x**] <-- -7.93 X

[**+**]

42 [**+**] <-- + 42

**Example**

Solve SSS Triangle Theorem: Cos A = (b^2 + c^2 - a^2)/(2bc)

Now, a = 5, b = 6, c = 7, please find the value of angle A

**Solution**

5 [**Enter**] <-- a

6 [**Enter**] <-- b

7 [**Enter**] <-- c

[**Pick**] (stack field #2) <-- duplicate value b to top

<-- b^2

[**Pick**] (stack field #2) <-- duplicate value c to top

<-- c^2

[**+**] <-- b^2 + c^2

[**Roll**] (stack field #4) <-- Roll value a to top

<-- a^2

[**-**] <-- b^2 + c^2 - a^2

[**Roll**] (stack field #3) <-- Roll value b to top

[**Roll**] (stack field #3) <-- Roll value c to top

[**x**] 2 [**x**] <-- b x c x 2

[**/**] <-- (b^2 + c^2 - a^2) / (2bc)

[**acos**] --> angle A = 44.4153

**Example**

At room temperature 25C, what's the average velocity (root mean square velocity) of hydrogen gas molecular (H2) ?

Vrms = (3RT/M)^1/2, R = 8.3145, T = Kelvin temperature, M = mass of mole of gas in kg

**Solution**

Vrms = (3 * 8.3145 * (273.15 + 25)/(2/1E3))^1/2

3 [**Enter**]

8.3145 [**x**] <-- 3 * 8.3145

273.15 [**Enter**]

25 [**+**] <-- 273.15 + 25

[**x**] <-- 3*8.3145*(273.15 + 25)

2 [**Enter**]

1E3 [**/**] <-- 2/1E3

[**/**] <-- 3*8.3145*(273.15 + 25)/(2/1E3)

<-- (3*8.3145*(273.15 + 25)/(2/1E3))^1/2

## 留言列表