The conventional mathematical notation we learned in high school is known as "Algebraic Notation." In this notation, the operators are placed either between or in front of the arguments. Operators designate the operation to be performed ("+", "*", "sin", etc.) and arguments are the values or variables upon which they act ("1", "42.5", "pi", "x", etc.). A typical mathematical expression might be:

`sin[123 + 45 ln(27 - 6)]`

The arguments are not so easily determined. At first glance they appear to be "123", "45", "27", and "6", but this is patently false! The argument of "sin" is everything within the brackets, or "123 + 45 ln(27 - 6)", those of "+" are "123" and "45 ln(27 - 6)", those of "*" are "45" and "ln(27 - 6)", that of "ln" is "27 - 6", and those of "-" are "27" and "6".

The whole expression may be thought of as a series of separate operations:

`sin[123 + 45 ln(27 - 6)] = sin(a) :: a = 123 + 45 ln(27 - 6)`

123 + 45 ln(27 - 6) = 123 + b :: b = 45 ln(27 - 6)

45 ln(27 - 6) = 45 * c :: c = ln(27 - 6)

ln(27 - 6) = ln(d) :: d = 27 - 6

27 - 6

`sin[123 + 45 ln(27 - 6)] = sin[123 + 45 ln(21)`

sin[123 + 45 ln(21)] = sin(123 + 45 * 3.04452243772)

sin(123 + 45 * 3.04452243772) = sin(123 + 137.003509697)

sin(123 + 137.003509697) = sin(260.003509697)

sin(260.003539697) = 0.680672740775

`27 - 6 -> -(27,6)`

This is a two-argument function: in any two-argument function, the second argument will always act against the first argument. In this case, the second argument "6" will be subtracted from the first argument "27".The concept of treating all operators as functions is not as strange as it first appears when you consider that a considerable number of operators are already functions: ln(x) is |(x) where "|" is "ln".

In the case of our example expression, the next function out is ln(d), where "d" is itself the function -(27,6):

`27 - 6 -> -(27,6)`

ln(27 - 6) -> ln(-(27,6))

45 ln(27 - 6) -> *(45,ln(-(27,6)))

123 + 45 ln(27 - 6) -> +(123,*(45,ln(-(27,6))))

sin[123 + 45 ln(27 - 6)] -> sin(+(123,*(45,ln(-(27,6)))))

In a similar manner, +(123,*(45,ln(-(27,6)))) is the two-argument function +(y,x), where "y" is "123" and "x" is *(45,ln(-(27,6))).

A further clarification can be made if "+(y,x)" is thought of as "the sum of y and x" (just as "ln(x)" is "the natural logarithm of x"). This approach allows "sin(+(123,*(45,ln(-(27,6)))))" to be read as "the sine of the sum of 123 and the product of 45 and the natural logarithm of the difference of 27 and 6." This phrase readily illustrates its clarity when emphasized function by function:

`sin(+(123,*(45,ln(-(27,6)))))`

The sine of sin(...)

the sum of sin(+(...))

123 and the product of sin(+(123,*(...)))

45 and the natural logarithm of sin(+(123,*(45,ln(...))))

the difference of sin(+(123,*(45,ln(-(...)))))

27 and 6. sin(+(123,*(45,ln(-(27,6)))))

What is even more important, it is unambiguous! If you heard someone say "the quantity 123 plus 45 times the natural logarithm of ...," does the speaker mean "(123+45)ln()" or "(123+(45ln()))". By defining all operations as functions there is no ambiguity, ever!

In algebra, a complex set of rules has been established as regards order and priority of operations, and if these rules are strictly followed there will be no ambiguity. Unfortunately, few of the "algebraic" calculators or software packages on the market follow these rules properly, and there is a total lack of consistency in which rules are overlooked or changed.

What is needed with a calculator or computer is a mechanistic and totally unambiguous method of operation. Treating all arguments as functions provides just such a method and is known as Polish Notation after its creator, the Polish logician Jan Lukasiewicz. The complex function sin(+(123,*(45,ln(-(27,6))))) has one and only one possible meaning, whether written in mathematical symbology or spoken aloud.

Further research by the logicians at Hewlett-Packard provided a slight variation on the theme. If instead of placing the function ahead of its argument(s), it is placed behind, we get:

`sin(+(123,*(45,ln(-(27,6)))))`

----------------------------------------------------------

sin( ) ----> ( )sin

+(123, ) ----> (123, )+

*(45, ) ----> (45, )*

ln( ) ----> ( )ln

-(27,6) ----> (27,6)-

----------------------------------------------------------

((123,(45,((27,6)-)ln)*)+)sin

`((123,(45,((27,6)-)ln)*)+)sin -> 123 45 27 6 - ln * + sin`

When a function-object is entered onto the stack, it operates upon the argument-object(s) already there to produce a result, which replaces the argument-object(s). The stack adjusts accordingly. This can be seen as:

object | stack level x: | y: | z: | t: |

123 45 27 6 - ln * + sin | 123 45 27 6 -(27,6) ln(-(27,6)) *(45,ln(-(27,6))) +(123,*(45,ln(-(27,6)))) sin(+(123,*(45,ln(-(27,6))))) | 123 45 27 45 45 123 | 123 45 123 123 | 123 |

The secret behind RPN's sophisticated yet simple power is in the stack. In computer terms, a stack is an area in which pieces of information may be stored on a last-in, first-out (LIFO) basis. Think of the stack as a stack of plates: the last plate placed on the stack will be the first plate used.

Most simple RPN calculators use a four-level stack, with the levels labeled "x", "y", "z", and "t". Some newer, more sophisticated calculators (such as the HP-28S and the HP-48SX) and most software programs use an "infinite" stack: the number of stack levels is limited only by available memory. The levels in an infinite stack are usually numerical.

Entering a value will cause a stack lift: existing values will be pushed up a level.

Entering a function will consume the arguments of the function. If this consumption causes a "hole," the values above the hole will be dropped to fill the hole.

Following through our example on an HP-48SX calculator:

Ed: Note that the author's calculator is set to radians, not degrees.