Reverse Polish Notation

MyCalc2 uses Reverse Polish Notation (RPN)  to make calculations. In the 1920's, Jan Lukasiewicz developed a formal logic system which allowed mathematical expressions to be specified without parentheses by placing the operators  after  the operands. For example the  expression

    (4 + 5) 6

could be expressed in prefix notation as

   4 ENTER 5 + 6     or    6 ENTER 4 ENTER 5 +


RPN


RPN is a very effective method for making complex algebraic calculation. Operation are immediately applied. The Enter key store numbers in a particular memory calls stack. The stack is composed of 4 registers : X,Y,Z and T. A fifth register exists, called L (LastX), it stores a copy of the last number entered.

Here is a simple example.


     138     

    Enter   

    25      

    +   


(12.5+14.5)*(5+18)

12.5

Enter

14.5

+

5

Enter

18

+

*

You enter the numbers in the same order that you would have done to solve the expression by hand and the calculator will show the result of each subexpression which helps you catch errors. With a little  practice, RPN will become natural and you may never want to use an algebraic calculator again.



10

Enter

20

Enter

15

Enter

7                


Stack:            

X=7

Y=15

Z=20

T=10


+


Stack :           

X=22

Y=20

Z=10

T=10


+        


Stack:           

X=42

Y=10

Z=10

T=10


+


Stack:           

X=52

Y=10

Z=10

T=10


Notice that the value of T was copied down to Z. T can be used as a handy constant register.

For example, if you want to compute the growth of $100 deposited in a bank account earning 4%, you only have to press 1.04 ENTER ENTER ENTER which  fills the stack with 1.04. Then press 100 to see the amount after the first year. Each additional press of shows the balance after another year. This can continue indefinitely because the 1.04 in the T register is copied down each time is pressed. The stack always contains the balance in X and 1.04 in the other three registers.



Stack Manipulation Keys


You can view the stack or change its order by pressing the R (R down arrow) to roll the stack contents. The example below shows an example of a roll down:

Initial Stack

After R

After 2nd R

T

4

T

1

T

2

Z

3

Z

4

Z

1

Y

2

Y

3

Y

4

X

1

X

2

X

3

       


Pressing R (R down arrow) twice more would return the stack to its initial configuration. You can also exchange the contents of X and Y with the X<>Y key .

The CE key will clear the contents of the X register.

The CA key will clear all the registers and memories. It also clears the displays

Del key backspaces individual digits during entry.



Last X


Besides the registers above, MyCalc2 as a LAST X register which preserves the number that was in X before the last numeric operation. Press the LAST X key to place a copy of the previous contents of X into the X register. You can use LAST X as a constant register or to recover from mistakes.



Copyright <2016>, <Serge Nicolas>