HP 50g Graphing Calculator - Algebraic and RPN Operating ModesCalculation modesYou can type calculations on the HP 50g, in “textbook” mode, in “algebraic” mode, or “RPN” mode. When you want to use a formula or an expression, you can type it the way it looks in a textbook. This is neat and is called “textbook” mode. Then you can admire the formula, or plot it, or integrate it, or solve it for different unknown variables. Or you can just work out its value. Yet to work out the value of a formula it is easier to type it using algebraic mode or 'RPN' mode, and just get the answer. Here is a very simple example. There is no need to type it on your calculator yet, just read it. A simple example - the area of a piece of carpetYou want to know the total area of carpet for two rooms, one 6 yards long, one 8 yards long, both 5 yards wide. So you need to calculate (6 + 8) * 5. In algebraic mode you work out the total length first, that’s 6 yards + 8 yards. Then you multiply by the width, 5 yards. So you would type these keys:
You would you see the answer like this: Figure 1: Displaying the result In 'RPN' you work out the total length first too. You type 6, then type 8 and add it. Then you type 5 and multiply:
You would see the answer like this: Figure 2: Displaying the result Algebraic mode is simple if you know the formula, and it takes just 9 keys. Count them. RPN mode is simple too. You do not even use a formula, and you press only 6 keys.
In general, algebraic mode is better if you are using formulas you know, and if you just want to type them and get the results. 'RPN' mode is best if you want to go through calculations a step at a time, and sometimes even change your mind. The HP 50g lets you use either mode. This training aid will show some examples of using Algebraic and 'RPN' modes, and will explain their differences and the advantages of each one. Setting the modeFirst make sure you know how to switch between algebraic and 'RPN' modes. Press the
key and you will see the Modes Form.
Figure 3: Displaying the Operating Mode When you open the Modes Form, the cursor is on the top line, which selects the Operating Mode, 'Algebraic' or 'RPN', and this is
highlighted as in
Figure 3
above. To change modes, press the
key below the
menu label. You see the two options,
'Algebraic' and 'RPN'. Use the up arrow key
or the down arrow key
to select the mode you want. Then press the
key
below the
menu label to confirm your selection, and press
again to quit the Modes Form.
Tip! A shortcut for switching between the two modes is to press
then
then
. The
key switches between the
available choices, without the need for you to press
.
With the calculator is in Algebraic mode you see the letters 'ALG' at the top right of the display screen, as in Figure 1 . In 'RPN' mode this disappears, as in Figure 2 . For the examples below it will be helpful to
have “Fix 2” and “Approximate” modes set too. First choose “Approximate”
mode, so that
“exact” numbers such as 2/3 will be automatically converted to
approximate results such as 0.666666666667. Press
then
below the
menu label to select the CAS Modes form. Press the down arrow key twice
to reach the Approx
selection. If this already has a check mark by it, then you do not need to set it, so press the
key below the
menu label.
If Approx is not checked then press
below the
menu label to select Approximate mode, and press
to confirm the
setting. Now select “Fix 2” mode, to display answers with two digits after the decimal point, so you see 0.67 instead of
0.666666666667. Do this as follows: press
then
to select the Number Format. Next press
then use the arrow keys
to pick 'FIXED' and then press
to choose 'Fixed' mode. Then press the right arrow key
to choose the number of digits after
the decimal point. Press
again, select 2, and press
to select 'Fix 2' mode. Finally press
one more time to confirm
these selections.
Algebraic and RPN modes and the stackAs the example showed, both modes give the same answer. You just press keys in a different order. In Algebraic mode you type the
whole formula or expression, then press
and let the calculator work it all out. In 'RPN' mode you give
the calculator a number,
then tell it what to do with that number. Then you give it another
number, or use the number you just got, and tell the calculator what to
do next. Clearly, Algebraic is good when you just want to type in a
formula and get the answer. 'RPN' is best if you want to work
through a problem, a step at a time, and see what is happening at each
step, then decide what the next step is. This does not mean
that the calculator has to be used like this; many people use only
Algebraic mode or only 'RPN' for all their calculations.
Whichever way the calculator is used, it provides some very helpful tools. The first one is the Stack, where formulas and numbers you have already used are kept for future use. If you now go through the carpet example, pressing the keys, you will see the difference between Algebraic mode doing a whole calculation all at once and RPN mode doing it a step at a time. First press
then
then
to switch to 'Algebraic' mode, if it is not already set.
Now you are ready to go through the example. Press these keys:
You typed in the whole expression (6+8)*5 and then you pressed
to get the answer. The HP 50g helped you by putting the
whole expression and the result on the stack, as you saw in
Figure 1
. If you need to use the expression or the answer for a future
calculation, you can get them by pressing the
key, then using the up and down keys to select what you need,
then pressing the
menu keys. These let you edit an expression, or view it in textbook
mode, or echo a copy to the bottom of the stack so you can use it
again, see
Figure 4
.
Figure 4: Reusing an expression for further calculation If you want to use an earlier answer in another calculation, you can also use
to access the
function which is above
the
key. By default, the HP 50g gives you ANS(1), the answer to the calculation you did one step back, but you can change this
to earlier answers, for example ANS(2), the answer to the calculation two steps back. To get ANS(2), press
, then use the
arrow keys to get to the 1, then press the delete key
to delete the 1, and then type in a 2. With 'Fix 2' mode selected, as in these
examples, you will see ANS(2.00) on the screen, but that makes no difference to the results.
For example if the carpet you want costs $17.32 per square yard, you get the total price of the carpet you need by pressing
, then pressing
as below.
Figure 5: Entering the values If you begin a new calculation by pressing
or
or
or any other command that needs two numbers, the HP 50g will
assume that you want to use the previous result, and will automatically
put ANS(1) in your calculation. As an example, multiply the
cost of the carpet by 1.035 to add 3.5% tax to its cost. Press
and you will see:
Figure 6: Entering the cost of the carpet The HP 50g automatically put ANS(1) in front of the * when you pressed
with nothing before it. ANS(1) is now the number
1,212.40, the most recent answer. The number 70.00 is ANS(2). After you press
it will become ANS(3).
As you see, the HP 50g provides a range of ways to work in Algebraic mode. You will develop your own favorite ways to work as you gain experience with the calculator. Why “Algebraic”? You can see that the formula to calculate was typed and is displayed the way it looks when it is written down on paper in algebraic notation. That is why this calculation mode is called Algebraic Mode. Algebraic notation was invented for use with unknown variables, such as X, but over the centuries it has also developed as a shorthand way of writing things such as “add the number eight to the number six and multiply the result by the number five”. To compare the above to 'RPN' mode, switch to 'RPN', pressing
then
then
. Now type the RPN keys for the carpet
area calculation.
There is a clear pattern here. You type a number, then you do something with that number. Then you type another number, and do
something again. In this example, you add the 8 to the 6 that you entered before, then you multiply by 5, but RPN works the same
way for other actions too. Just for example, to calculate the square root of 30, you type 30 and then press the
key.
At each step, RPN takes one or more numbers it needs, then puts the answer on the stack. Why “RPN?”
You might have noticed that calculating the carpet area in RPN did not
use brackets, and indeed RPN is designed to
work without brackets. This makes it somewhat quicker to type than
Algebraic mode; the carpet example took 6 keystrokes in RPN
and 9 in Algebraic mode. Polish Notation, a mathematical notation
without brackets, was introduced by the Polish mathematician Jan
Lukasiewicz in the 1920s. In RPN, the operations such as
or
or
are done after the number is entered, not before it,
so this method of calculation is called Reverse Polish Notation, RPN for short. The numbers it uses are on the stack, not inside
brackets, so it is also called “Stack notation”.
The
key has a special task in RPN. It puts onto the stack the number you have just typed, without doing anything else to that
number. Then the number is ready for what you want to do next, for example add another number to it. If you press
again, it
repeats its action, putting another copy of the number onto the stack. It does the latter in Algebraic mode as well.
As in Algebraic mode, the stack works to help
you, but in a different way, suited to RPN calculations. The RPN stack
is made up of
numbered levels, with a value in each level. The values are the results
of earlier calculations, or numbers you put on the stack with
the
key. The formula for the previous calculation is not put on the stack, because each calculation is just one step, but if you
want to bring back what you just did, press
to see the last 4 lines you typed, and select what you want with the arrow
keys, then press
.
The numbers on the stack are ready for you to
use in further calculations. As with Algebraic mode, the HP 50g has
commands to let
you pick numbers off the stack, and there are also commands to move
numbers around the stack. In fact RPN uses the stack as a
central tool, and there is a whole set of stack commands. You can find
them by pressing
and then selecting the 'STACK'
option.
Tip! The most important stack commands in RPN are DUP, which copies the number in level 1 to level 2, and SWAP, which swaps
the numbers in levels 1 and 2. DUP is done by pressing the
key, as was described above. SWAP is needed in many cases, for
example if you want to divide the number in level 1 by the number in level 2 then you must swap them before pressing the
key.
SWAP is so important that there is a shortcut key for it, just press the right arrow key
in 'RPN' mode when you are not editing
anything, and it will swap the numbers in levels 1 and 2.
The command lineAs you typed the example in Algebraic and in RPN modes, what you typed went into a special line, below the stack, but above the menu keys. If you are still in 'RPN' mode, try calculating the price of the carpet again. First type the number 17.32, and the display will look like this: Figure 7: Entering the number 17.32 The previous result, 70, is on level 1 of the
stack. The new number is between the stack and the menu keys, on a
special line called
the Command Line. Both Algebraic mode and RPN mode use this for numbers and text you are typing or editing. When you press
the contents of the command line are evaluated and the result is put on the stack.
In RPN you do not need to press
to put a number on the stack, if you are going to use it at once. In the case above, you can
press
to put 17.32 on the stack, and then press
to multiply 70 by 17.32, but you can skip the
and just press
to
get the answer. You do need to press
if you are typing two numbers one after another, as in the carpet example.
Example – a more complicated expressionHere is a more complicated expression to compare Algebraic and RPN modes further. In Algebraic mode it is possible to type the expression almost as it stands. The only difference is that the x-squared key
must
be pressed before a number, whereas the x-squared symbol is written after the number to be squared. Set Algebraic mode and type
the following:
Figure 8: Entering the values The square root comes before the number it works on, the multiplication sign comes between the numbers it uses, and the factorial sign comes after the number it works with. The x-squared symbol was written after the number to be squared, but on the calculator it had to come before. There are three sets of nested brackets, which have to be treated correctly.
NOTE: When you press
in Algebraic mode the brackets are automatically put in for you.
To enter the factorial sign you have to use ALPHA mode
to type the exclamation mark. Even though the calculator makes things easy for you, you still need to take care when typing the
expression. Now press
to see the result.
Figure 9: Displaying the result The calculator has figured out what to do and in what order, and has given the result. The calculator knows the “rules of operator precedence” when it calculates a result, for example that addition and subtraction should be done after multiplication and division, so it has simplified the expression, taking out the unnecessary brackets in (3.2*SQ(5)). Whenever you type an expression with any possible ambiguity in it, the HP 50g applies the rules of operator precedence in evaluating the expression. One important consequence of the rules of precedence can cause confusion. This is that an expression such as –5^2 works out as –25.00, not 25.00. Raising a number to a power has higher precedence than changing a sign, so it is done first, and the expression is worked out as –(5^2). Switch to 'RPN' mode and try doing the same example calculation. As you went through the calculation, you saw intermediate results at each step, so you could notice any obvious errors, but when you are finished you only see the final result. Figure 10: Displaying the result The RPN calculation takes 6 fewer keys, and you see what is happening step by step, but you have to work out for yourself what to do and in what order. Even if you did not put in the extra brackets in the Algebraic example above, RPN would take 3 less keystrokes. If you are willing to work out how to do the calculation, RPN saves you any confusion about brackets, and works with fewer keystrokes. If you are new to HP calculators, try using both modes and see if you prefer one or the other, or if you want to switch between them as you use the HP 50g. Example – which stepladder?Many people would prefer to type the example above as a formula in Algebraic mode, rather than use RPN mode and do it a step at a time. Now here is an example to show how RPN mode is useful for solving step-by-step problems. You need to fix a tile that has fallen off your roof. The roof is 28 feet up, and you have a stepladder that is 29 feet long. You could also borrow your neighbor’s 38 foot ladder. Is either ladder good for the job? You could try leaning each one in turn against the roof and seeing which one is better, but it’s raining, so why not work it out first on your HP 50g by seeing what angle each ladder will make with the vertical when you lean it against the roof? First try it for your own ladder. Switch to 'RPN' mode if it is not set. Enter the ladder length.
.
Then enter the height and divide so you can get the angle,
. You get 1.04. That cannot be right, sines and
cosines should be smaller than 1. Use
to get the numbers back, then
to swap them, as described in the tip above.
Now press
to divide them again, in the right order, and see 0.97.
Actually, pressing
would get the same result, and more quickly. Anyway, this is the sine of the angle between the ladder and
the vertical. Or is it the cosine? Press
and see the answer, 74.91 degrees. No, that is not right, it must be the arc cosine
that you need. You could use
again to undo the arc sine, but it is quicker to press
, then
. Your ladder
would be only 15.09 degrees away from the vertical. That is
uncomfortably steep. So try the same calculation for your neighbor’s 38
foot ladder.
Type
then
. You can use the space key
instead of
to separate two numbers on
the command line, and
is nearer to the numeric keys, so you have to move your finger a shorter distance to type it. When you
press a calculation key afterwards, the HP 50g knows that the space is separating two different numbers. This time the answer is
42.54 degrees. The ladder would be at a shallow angle on the ground and might slip away as you stand on it.
Neither ladder is really suitable. Maybe you
should ask some other neighbors if they would lend you a ladder with a
better length.
What would be a good length? 30 degrees would probably still be too
much, about 20 degrees would be about right. So type the
height again and divide by the cosine of 20 degrees. Type
. That gives 29.80. A 30 foot long
ladder would be almost ideal.
The same calculations could be done in
Algebraic mode with no difficulty. Nevertheless, many users find that
Algebraic mode is less
well suited to such step-by-step calculations, especially because
must be used repeatedly to bring back the result of the
previous calculation.
Once all the examples have been completed it
may be worth returning the calculator to its normal modes. It can also
be helpful to
clear the stack by pressing
.
The operating modeThe examples and explanations in this training aid have used only real numbers, but the same principles apply with complex numbers, vectors, matrices, lists of numbers, and other objects. Whether you use Algebraic mode or RPN mode, the stack is a basic tool. The combination of stack and Algebraic or RPN mode is so important in the use of the HP 50g that Algebraic or RPN is called the calculator’s Operating Mode – it is the way in which the calculator operates. These examples have shown how the user can
switch between the two modes as necessary, but the modes can be combined
further. Results on the stack from RPN mode calculations can be put in
Algebraic calculations with the ANS command, and results
from Algebraic calculations are on the stack ready for use if the
calculator is switched to RPN mode. RPN mode works with all kinds
of objects on the stack, even programs and algebraic expressions. To put
an algebraic expression on the stack in RPN, press the
key first and then type the algebraic expression and
. That expression can then be used in RPN calculations, or plotted or
solved. The Algebraic mode and the RPN mode need not be treated as exclusive, one or the other; it is possible to treat them as
complementary and use whichever one suits a given task best.
|