next up previous
Next: Storing Objects Up: How to Use the Previous: The Key Board

Reverse Polish Notation

Many people are confused when they first use hand held calculators made by Hewlett-Packard. This confusion arises because of the Reverse Polish Notation (RPN) which these calculators use. As a matter of fact, at one time I thought that algebraic notation would be easier to use. However, once you realize that RPN is exactly what is used when calculations are done with paper and pencil, the syntax is much clearer. For example, to add the numbers 21 and 37 together, using paper and pencil, we write


Well that's exactly what is entered in the HP48G/GX. 21 tex2html_wrap619 37 tex2html_wrap735

To compute tex2html_wrap_inline667 , compute x+y first, and then the sine of their sum. To further demonstrate that the way numbers and functional evaluations are entered into the HP48G/GX mimics what is done with pencil and paper, let's compute tex2html_wrap_inline671 . To solve this on the HP48G/GX enter: 2 tex2html_wrap619 tex2html_wrap739 tex2html_wrap741 tex2html_wrap743 tex2html_wrap745

This puts the number 20 on stack level 1. Be sure to always use the symbol * for multiplication. To enter * push tex2html_wrap747 . The HP48G/GX does not recognize implied multiplication. To appreciate the correlation between RPN and hand calculations, compute by hand the above expression. To compute the natural log of this number, push the keys: 2pt tex2html_wrap609 tex2html_wrap751 .

If a calculator, with algebraic notation, is used, the following keystrokes are entered: tex2html_wrap753 tex2html_wrap755 tex2html_wrap757 tex2html_wrap741 tex2html_wrap739 tex2html_wrap745 tex2html_wrap743 tex2html_wrap767 tex2html_wrap619

At first sight both methods seem reasonable. However, for more complicated expressions we are soon lost in a sea of parentheses. Moreover, algebraic notation requires that we understand the syntax of the entire expression, while RPN only requires an understanding of the small pieces from which our expression is built.

Negative numbers are entered with the aid of the tex2html_wrap771 key. For example, to calculate, tex2html_wrap_inline685 , place the numbers -3 and -5 on the stack with the following keystrokes: tex2html_wrap659 tex2html_wrap771 tex2html_wrap619 tex2html_wrap641 tex2html_wrap619 tex2html_wrap771

Now press tex2html_wrap785 . It is worth pointing out that the HP48G/GX does allow for algebraic notation. If a formula like tex2html_wrap_inline697 needs to be placed on the stack, enter tick marks first, and then place the expression between the tick marks. For example: tex2html_wrap787 tex2html_wrap659 tex2html_wrap741 tex2html_wrap613 tex2html_wrap795 tex2html_wrap637 tex2html_wrap757 tex2html_wrap745 tex2html_wrap641 tex2html_wrap619

Notice that the HP48G/GX places both tick marks in the command line with the cursor positioned between them. Missing closing delimiters are no longer a problem. An alternate way to place this expression on the stack is: tex2html_wrap659 tex2html_wrap619 tex2html_wrap613 tex2html_wrap795 tex2html_wrap619 tex2html_wrap757 tex2html_wrap637 tex2html_wrap741 tex2html_wrap641 tex2html_wrap745

To compute tex2html_wrap_inline711 using algebraic notation, use tick marks as above and enter the given expression. Now push enter. You should have tex2html_wrap_inline713 on the command line. Push tex2html_wrap827 .

Another aspect of the HP48G/GX calculator that merits discussion is the stack. Since all input, and the results of every computation appear on the stack, any output from an intermediate calculation can be used as the input of another calculation. I may be stretching the point a bit, but this feature alone is worth the price of admission. For example, suppose we wanted to compute tex2html_wrap_inline715 , where 1.5 is radians, not degrees. tex2html_wrap829 tex2html_wrap619 tex2html_wrap833 tex2html_wrap829 tex2html_wrap619 tex2html_wrap839

Notice we now have tex2html_wrap_inline717 on stack level 2 and tex2html_wrap_inline719 on stack level 1. The ENTER key stroke immediately following the second 1.5 pushes the object on level 1 tex2html_wrap_inline721 up to level 2 and then places 1.5 on level 1. The next command computes the cosine of 1.5 and places that value on level 1. Be sure that your calculator is set to radian mode. To finish the computations: tex2html_wrap735 tex2html_wrap757 2pt tex2html_wrap623 tex2html_wrap847 tex2html_wrap741

The number 7.89322756581 should now appear in level one. Note: we did not have to place the number 2 on the stack in order to exponentiate it.

A second way to compute the above is as follows: tex2html_wrap829 tex2html_wrap619 tex2html_wrap619 tex2html_wrap833 tex2html_wrap859 tex2html_wrap839 tex2html_wrap735
tex2html_wrap757 2pt tex2html_wrap623 tex2html_wrap847 tex2html_wrap741

The point of the second example is to note that hitting the tex2html_wrap619 key with the command line empty moves all stack objects up one level, and leaves a copy of the object in level one in level one.

The tex2html_wrap875 key moves the stack objects down one level, and deletes the object on level one. The tex2html_wrap877 key clears the entire stack.

Some items worth remembering:


next up previous
Next: Storing Objects Up: How to Use the Previous: The Key Board

Mike Stecher
Thu Mar 21 09:53:31 CST 1996