Reverse Polish Notation (RPN)

A form of calculation

What is Reverse Polish Notation (RPN)?

Reverse polish notation, or RPN, is one of three common calculation notations. The other two are polish notation and infix notation. The latter, infix notation, is the one most commonly used across the world and will be the most familiar to readers. Infix notation is the standard taught in schools where the operator is placed “in” the formula. For example, to calculate 10 plus 5, infix notation is written as 10 + 5.

Both polish notations, on the other hand, place the operator on either side of the numbers. Polish notation would note the above calculation as + 10 5. Reverse polish notation is the opposite, where the operator comes after the numbers. 10 plus 5 is noted as 10 5 + in RPN.

Financial analysts may use an RPN calculator on the CFA exam, the HP 12C.

 

RPN Calculator
RPN Calculator (source: Wikipedia.com)

 

Why use RPN?

At first glance, RPN seems complicated but it is a rather intuitive notation. When performing RPN calculations, the user follows the logical flow of the calculation. In contrast, infix notation requires the user to input a formula or calculation from left to right, regardless of whether the calculation is performed in that order.

One of the gold standard calculators used in the field of banking is the HP 12C calculator. This calculator uses reverse polish notation and is lauded for its efficiency and intuitiveness.

 

Example of an RNP calculation

Assume a user is calculating the future value of $1,000 deposited today over the course of five years. In the first year, it will only earn 2%, but in years two and three, it will earn 5% each year, before reverting back to 2% for the last two years.

The formula to find the future value is:

FV = 1,000 x (1 + 0.02) x (1 + 0.05)^2 x (1 + 0.02)^2

 

In a traditional infix calculator, the simplest way to enter this function would be:

1000 [X] 1.02 [X] [OPEN PARENTHESIS] 1.05 [^] 2 [CLOSE PARENTHESIS] [X] [OPEN PARENTHESIS] 1.02 [^] 2 [CLOSE PARENTHESIS] [EQUALS]

 

In an RPN calculator, the simplest way to enter this function would be:

1000 [ENTER] 1.02 [X] 1.05 [ENTER] 2 [yx] [X] 1.02 [ENTER] 2 [yx] [X]

 

The RPN calculator uses 3 fewer strokes than the infix calculator, which saves time and is more efficient in the long run. Additionally, the user must remember the stack of parenthesis applied in the infix calculator, which can become burdensome for longer calculations. An RPN calculator can perform parenthetical functions retroactively.

 

Additional resources

Thank you for reading this guide to RNP and how to make your complex calculations more efficient.  For more financial analyst tools and training, please check out these additional resources: