[hp15c]

RPN tutorial


The HP-15c calculator uses postfix notation also known as Reverse Polish Notation (RPN). This notation seems complex but has many advantages over algebraic notation and is more intuitive than algebraic once you have understood the idea.

This tutorial teaches you the basics of RPN in a few minutes. RPN uses a stack and you can use the below calculator to visualize the stack and practice. I recommend to try every example. You can open a new browser window if you want to have the calculator in front of you and read the text at the same time.

RPN trainer
T:
Z:
Y:
X:
   
 

  1. The basic idea:
    The calculator has a stack and any operations that require two number are applied to the bottom two stack layers (X and Y). Enter to push the stack up and separate one number from the next. To perform arithmetic, key in the first number, press ENTER to separate the first number from the second, then key in the second number and then select and operator such a the numerical functions +, -, * or /. The result appears immediately after you press the numerical function key. The operator is keyed in only after both operands are in the calculator.

    Example: calculate 3 + 4
    Key sequence: 3 ENTER 4 +
    Result: 7

    The result of any operation may itself become an operand. You do not need to press enter again to use the result. The "7" is already entered.

    Example: add 2 to the previous result
    Key sequence: 2 +
    Result: 9
    Calculators with a one line display such as the HP-15c show the X register in the display.

  2. The stack can be used to remember previous results:
    Complicated terms can be calculated with braces. You simply push a result up the stack and use it when you need it. Any result pushed past the highest stack level is lost. It is therefore advisable to start with the calculation of a more complicated term from the inside just as you would do it when you calculate something manually.

    Example: calculate 5 * (3 + 4)
    Key sequence: 3 ENTER 4 + 5 *
    Alternate key sequence: 5 ENTER 3 ENTER 4 + *
    In the alternate key sequence example we used the stack to remember the 5 for future use.

  3. One number functions:
    Functions such as 1/X or square root take only one argument. You don't have to press enter before using such a function they just apply directly to the X register of the stack.

    Example: calculate √2 (square root of 2, the key on the above calculator for √x is called sqrt)
    Key sequence: 2 sqrt
    Result: 1.414213

    Example: calculate sqrt((12+8)/5)
    Key sequence: 12 ENTER 8 + 5 / sqrt
    Result: 2


  4. Changing the sign:
    The CHS key changes the sign of the number in the X register. It does not change the stack otherwise. It can be used to enter a negative number and sometimes it is more convenient to add a negative number than to use the subtract operation.

    Example: calculate 50 - (7 + 3 * 2)
    Key sequence: 3 ENTER 2 * 7 + CHS 50 +
    Alternate key sequence using the swap key: 3 ENTER 2 * 7 + 50 "x<->y" -
    Result: 37


  5. Start with the innermost expression and work outwards:
    The stack has only four levels so you can only store a limited number of intermediate results without causing a stack overflow. The best way to solve more complex expressions is to start somewhere in the middle and work outwards. The calculator has to number of keys that help you with this strategy: Use the 1/x key in combination with * (multiply) if you started in the denominator part of a fraction and you want to continue with the numerator. You can as well use the "x<->y" or swap key if you want to divide but you have the divisor in the Y register. The CHS key (change sign) is useful too because it allows you to type CHS and + to subtract.

    Example: calculate 7 - (8/sqrt(3+(2*3)))
    Note: sqrt() stands for square root (√x) and I use it here because it is easier to use in a html text document.
    Key sequence: 3 ENTER 2 * 3 + sqrt 1/x 8 * CHS 7 +
    Result: 4.3333





RPN trainer was written by Guido Socher.
Copyright: freeware, use it and copy it as you like.