Bring Back the
What is 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:
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.0000You 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.
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.
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.
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
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 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 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.
|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!
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!