Bring Back the  
15C



What is RPN?
  • RPN stands for Reverse Polish Notation. RPN was developed in 1920 by the Polish mathematician Jan Lukasiewicz as a way to write a mathematical expression without using parentheses.
Why use RPN?
  • RPN is more efficient for both the user and the calculator.
    • When you use RPN fewer keystrokes are needed.
    • With RPN there is no need to keep track of parentheses.
  • RPN allows the calculator to solve very complex equations with out the need for lots of temporary storage, or complex programing.
  • Intermediate results are seen at each step in the calculation which helps spot errors early, and gives the user a greater understanding of calculations being performed.
  • Despite some users initial reaction, RPN is more natural because it emulates the way calculations are performed by hand.
How to use RPN:
(The RPN version described below applies to the vast majority of HP calculators, there are some early models that only have a stack of three, and the newer calculators have very slight differences that are easy to see if you know how to use the version described bellow)

Algebra and number crunching are two different things. Algebra must be done before the calculations to crunch the numbers can begin. Most calculators today use algebraic entry. This form of entry is fine if you are doing algebra, but if you are simply crunching numbers, RPN the more efficient and natural way to do it. Algebraic entry calculators mimic the way algebra is done on paper. RPN entry calculators mimic the way calculations are done on paper, which makes it more natural when doing calculations..

First a quick example: multiply 37 by 81.

With a standard algebraic entry calculator, type “37 X 81 =”, and the calculator provides the answer.

In RPN it works like this:
37  EMTER 81 *
This may seem odd if you are not used to it, but consider how you would perform this calculation on paper. You would right down 37, then 81, and then perform the multiplication operation. The ENTER key is just a way of telling the calculator you are done with the first number and are ready to enter the next number.

At this point you may have noticed that the number of keystrokes required to perform this calculation are exactly the same using both methods. For simple calculations this is true. However, as soon as the calculation gets even slightly more complex, RPN will require a significantly smaller number of keystrokes. Before we can start with the more complex calculations we first need to understand how RPN works.

RPN calculators use a stack to store the numbers used in the calculations. This stack has 4 positions. They are generally called X, Y, Z, and T. When you first type in a number, it puts it pushes the stack up one and stores the number in the X position: T gets pushed off the top, Z goes into T, Y goes into Z, X goes into Y and the new number is stored in X. When you hit Enter it also pushes the stack up one position, and sets it so the next number you type in will overwrite what is in X. When you perform an operation like addition or multiplication it takes the numbers in X and Y, performs the operation, puts the answer in X, and moves everything down one. Similarly to how X is copied when you hit enter, T is copied when the stack gets moved down after an operation such as described above. For example: lets start with a zeroed stack and see what happens when we perform the previous calculation.
T:      0.0000
Z:      0.0000
Y:      0.0000
X:      0.0000
You may have noticed the 0.0000 instead of just 0. The reason for this is, RPN calculators round off the number you see in the display to 4 decimal places by default. This does NOT round off the number stored in the calculator. The calculator stores the number to a higher precision than can be displayed so round off error won't be a problem in the digits you can see on the screen. The number of places displayed can be changed from 4 to whatever is desired.

First type 37
T:     0.0000
Z:     0.0000
Y:     0.0000
X:    37.0000
Puts 37 in X and moves the stack up one.
Then hit EMTER
T:     0.0000
Z:     0.0000
Y:    37.0000
X:    37.0000
Moves the stack up and leaves copy in X
Then type 81
T:     0.0000
Z:     0.0000
Y:    37.0000
X:    81.0000
Overwrites X with 81
Now hit *
T:     0.0000
Z:     0.0000
Y:     0.0000
X: 2,997.0000
Puts answer in X, and moves the stack down one.


Y now has the value from Z, Z has the value from T. T keeps a copy of whatever was there before, this is kind of the reverse of hitting enter, where X is moved to Y and X keeps a copy of what was there before we hit enter. It is hard to see this, because all that is ever in Z and T is 0 in this simple calculation.

Once we start performing more complex calculations, Z and T will both be used. Sometimes when finding the answer to very complex equations you may find you wish the stack were bigger, however 99.9% of the time 4 is enough to perform the calculation. In fact, I have never come across an equation I couldn't solve with a stack of 4.

Lets try a slightly more complex formula to see how more of the stack comes into play.



The state of the stack is shown below for each step in this calculation.

Step 1)61
T:      0.0000  
Z:      0.0000
Y:      0.0000
X:     61.0000
Step 2)EMTER
T:      0.0000  
Z:      0.0000
Y:     61.0000
X:     61.0000
Step 3)45
T:      0.0000  
Z:      0.0000
Y:     61.0000
X:     45.0000
Step 4)+
T:      0.0000  
Z:      0.0000
Y:      0.0000
X:    106.0000
Step 5)11
T:      0.0000
Z:      0.0000
Y:    106.0000
X:     11.0000
Step 6)EMTER
T:      0.0000
Z:    106.0000
Y:     11.0000
X:     11.0000
Step 7)23
T:      0.0000
Z:    106.0000
Y:     11.0000
X:     23.0000
Step 8)+
T:      0.0000
Z:      0.0000
Y:    106.0000
X:     34.0000
Step 9)/
T:      0.0000
Z:      0.0000
Y:      0.0000
X:      3.1176








For this calculation the X, Y, and Z position on the stack were used, but not T. You have may have noticed that there is no need to clear the value in the display before starting the next calculation. Suppose we had two separate calculations to do, 61+45 and 11+23. We would do everything the same as above except for the last step. At step 4 we had the answer to 61+45. Then to find the answer to 11+23, we didn't need to clear the 106, we just started the next calculation.

Lets try this same problem on a simple algebraic calculator.

Step 1) 61
Step 2) +
Step 3) 45
Step 4) =

At this point we have to save this number somewhere. Either on paper or in the calculator memory if it has any.

Step 5) store answer to 61 + 45
Step 6) clear
Step 7) 11
Step 8) +
Step 9) 23
Step 10) =
Step 11) store answer to 11 + 23
Step 12) recall answer to 61 + 45
Step 13) /
Step 14) recall answer to 11+23
Step 15) =

This example makes it clear that far more steps are needed to find the solution with an algebraic calculator than with RPN. With a little more sophisticated scientific, algebraic calculator, parentheses can be used, and intermediate answers do not need to be stored. However, this method will still require more steps than RPN.

At this point only 0 has been in the T position of the stack, so we have not observed how other numbers that end up in T are copied every time the stack is shifted down. This behavior of the T position can come in handy some times. As an example, if you need to find the first 9 powers of a number, i.e. X^1, X^2, X^3, . . . X^9 the T position in the stack is very handy. To do this, type in the value of X and hit ENTER 3 times, then just keep hitting X till you have x^9, recording the value in X at each step. Say for example x were 2, bellow are listed all the steps with the corresponding stack values.

Step 1)2     
T:      0.0000 
Z:      0.0000
Y:      0.0000
X:      2.0000
Step 2)EMTER
T:      0.0000
Z:      0.0000
Y:      2.0000
X:      2.0000
Step 3)EMTER
T:      0.0000
Z:      2.0000
Y:      2.0000
X:      2.0000
Step 4)EMTER
T:      2.0000
Z:      2.0000
Y:      2.0000
X:      2.0000
Step 5)*
T:      2.0000
Z:      2.0000
Y:      2.0000
X:      4.0000
Step 6)*
T:      2.0000
Z:      2.0000
Y:      2.0000
X:      8.0000
Step 7)*
T:      2.0000
Z:      2.0000
Y:      2.0000
X:     16.0000
Step 8)*
T:      2.0000
Z:      2.0000
Y:      2.0000
X:     32.0000
Step 9)*
T:      2.0000
Z:      2.0000
Y:      2.0000
X:     64.0000
Step 10)*
T:      2.0000
Z:      2.0000
Y:      2.0000
X:    128.0000
Step 11)*
T:      2.0000
Z:      2.0000
Y:      2.0000
X:    256.0000
Step 12)*
T:      2.0000
Z:      2.0000
Y:      2.0000
X:    512.0000


Now for something a bit more complex: the quadratic equation. For our example we will only get the first of the two possible answers. Note, we will be using a new key for this example, +/-, short for change sign. most newer calculators have a +/- key instead.)



Let a = 2, b= -7, and c = -15

Step 1)
T:      0.0000
Z:      0.0000
Y:      0.0000
X:      7.0000
Step 2)EMTER
T:      0.0000       
Z:      0.0000
Y:      7.0000
X:      7.0000
Step 3)+/-
T:      0.0000  
Z:      0.0000
Y:      7.0000
X:     -7.0000
Step 4)EMTER
T:      0.0000  
Z:      7.0000
Y:     -7.0000
X:     -7.0000
Step 5)*
T:      0.0000
Z:      0.0000
Y:      7.0000
X:     49.0000
Step 6)4
T:      0.0000
Z:      7.0000
Y:     49.0000
X:      4.0000
Step 7)EMTER
T:      7.0000
Z:     49.0000
Y:      4.0000
X:      4.0000
Step 8)2
T:      7.0000
Z:     49.0000
Y:      4.0000
X:      2.0000
Step 9)*
T:      7.0000
Z:      7.0000
Y:     49.0000
X:      8.0000
Step 10)15+/-
T:      7.0000
Z:     49.0000
Y:      8.0000
X:    -15.0000
Step 11)*
T:      7.0000
Z:      7.0000
Y:     49.0000
X:   -120.0000
Step 12)-
T:      7.0000
Z:      7.0000
Y:      7.0000
X:    169.0000
Step 13)sqrt
T:      7.0000
Z:      7.0000
Y:      7.0000
X:     13.0000
Step 14)+
T:      7.0000
Z:      7.0000
Y:      7.0000
X:     20.0000
Step 15)2
T:      7.0000
Z:      7.0000
Y:     20.0000
X:      2.0000
Step 16)EMTER
T:      7.0000
Z:     20.0000
Y:      2.0000
X:      2.0000
Step 17)2
T:      7.0000
Z:     20.0000
Y:      2.0000
X:      2.0000
Step 18)*
T:      7.0000
Z:      7.0000
Y:     20.0000
X:      4.0000
Step 14)/
T:      7.0000
Z:      7.0000
Y:      7.0000
X:      5.0000




In this example all 4 positions on the stack were used. However if we were to move one step, the T position on the stack would not have been needed. By moving step 1 to just before step 14, the T position would not have been needed. This kind of rearranging works fine for addition and multiplication, however if subtraction or division are needed, it will leave us with the operands in the wrong order. RPN calculators were designed with this possibility in mind. That is what the x<->y button is for, it swaps the X and Y stack items. If we were to find the other solution from the quadratic equation, step 14 would be a subtraction, In that case, to avoid using the T position on the stack, insert step 1 and an x<->y operation before step 14.

The previous paragraph illustrates a simple rule to help make the most of the 4 stack positions. Don't put a number on the stack until you need it for a calculation.


clx




Please add a link to this site on your site. Email the Administrator with any comments.
This, and all properly designed web sites, best viewed with Firefox!
Get Firefox
Save the web! Drop brain dead IE, and Get Firefox


Gift giving made easy with The Wish Zone
Get the gifts you want and give the gifts they want!
One stop wish list for any gift, from anywhere, for any occasion!

DRM