# RPN - HP Exclusive Technology

RPN or Reverse Polish Notation is an efficient data entry method that eliminates the need to enter parentheses in equations, has been a favorite of HP calculator fans for more than 30 years, and it remains alive and well at HP.

In the 1920’s, Jan Lukasiewicz developed a formal logic system which allowed mathematical expressions to be specified without parentheses by placing the operators before (prefix notation) or after (postfix notation) the operands. For example the (infix notation) expression

(4 + 5) — 6

could be expressed in prefix notation as

— 6 + 4 5 or — + 4 5 6

and could be expressed in postfix notation as

4 5 + 6 — or 6 4 5 + —

Prefix notation also came to be known as Polish Notation in honor of Lukasiewicz. HP adjusted the postfix notation for a calculator keyboard, added a stack to hold the operands and functions to reorder the stack. HP dubbed the result Reverse Polish Notation (RPN) also in honor of Lukasiewicz.

# HP RPN Calculator

HP produces certain models of calculators with RPN because it is an extremely powerful yet simple way to perform computation. The HP 48g and HP 12c financial calculator use RPN exclusively. HP also recognizes that some customers prefer the traditional algebraic entry mode. This is why some HP calculators operate in both RPN and algebraic mode. For example, the 17bII and 49g can be switched between the two modes.

RPN is also consistent in its usage.

# Learning to use RPN

If you’ve recently acquired your first RPN calculator and it didn’t come with a manual, this section will get you started.

Do you remember how you originally learned to do math? Most of us were taught to write down the numbers we wanted to add and then add them like:

25

12

----

37

RPN works the same way. Take your new calculator and key in 25. Press the ENTER key to tell the calculator that you are finished keying this number. Now key in 12 and tell the calculator to add it to the previous number by pressing the + key. The result of 37 will immediately be displayed. Subtraction, multiplication and division all work the same way but with the -, x , and **÷** keys substituted for the + key. Try it!

This also works for more than two numbers. To multiply the numbers 5, 6 and 7 together press 5 ENTER 6 x 7 x and read the result. Note that you didn’t press ENTER after the 2nd and 3rd numbers because the operation key makes it clear that you are finished keying these numbers.

Many functions require only one number. On an RPN calculator, you still enter the number and then press the operation key and see the result. (Many calculators that claim to be algebraic use the same method since it takes less keystrokes than real algebraic syntax.) For example, to compute the sine of 10 press 1 0 SIN and read the result. To compute e^{5} press 5 e^{x}.

Just remember that RPN calculators perform mathematical operations immediately when you press the operation keys so the number(s) must be entered first. There are no "pending operations" or precedence in RPN calculators. When multiple numbers must be entered in sequence, separate them with the ENTER key.

# Comparing RPN with Algebraic Methods

3+5

---

7+6

Or (3+5) / (7+6) = x

**Algebraic method:** Add 3+5=8. Write down the answer or store it in memory. Add 7+6=13. Now enter the 8 from the first answer and then divide it by entering the second answer to get x=0.62.

**RPN method:** Touch 3 then the ENTER key. Touch 5 then the + key. Touch 7, and then ENTER. Touch 6 then the + key. Note that the answer to the second sum is displayed. Now here’s the magic part. Touch the divide key and the calculator gives the answer, 0.62.

**Algebraic:** **13 strokes**, not counting the effort to write down or memorize the first answer while you calculated the second answer.

**RPN:** **9 strokes**, and no need to write anything down. **RPN: Save Time and Keystrokes!**

## Where can HP RPN technology be found?

HP Calculators have the HP RPN feature: HP 12c; HP 12cp; HP 17bII+, HP 33s, HP 48gII, HP 49g+, HP 50g.

**Jan Lukasiewicz**, 1878 - 1956, is from a Polish speaking family, living in Lvov which is now in the Ukraine. Lukasiewicz was interested in mathematics at school and he entered the University of Lvov where he studied mathematics and philosophy. Following his undergraduate studies, he continued to work for his doctorate which was awarded in 1902. In 1911 he was promoted to an extraordinary professor at Lvov. Lukasiewicz was invited to the new University of Warsaw when it reopened in 1915. It was an exciting time in Poland and a new Kingdom of Poland was declared on 5 November 1916. Lukasiewicz was Polish Minister of Education in 1919 and a professor at Warsaw University from 1920 to 1939. During this period between the wars Lukasiewicz was twice rector of Warsaw University. Lukasiewicz and his wife fled from Poland during World War II and in 1946 they were in exile in Belgium when he was offered a chair by the University of Dublin in Ireland.

He worked on mathematical logic, wrote essays on the principle of non-contradiction and the excluded middle around 1910, developed a three value propositional calculus (1917) and worked on many valued logics. Lukasiewicz introduced the ’Polish notation’ which allowed expressions to be written unambiguously without the use of brackets.