# Polish notation (prefix notation)

Polish notation, also known as prefix notation, is a symbolic logic invented by Polish mathematician Jan Lukasiewicz in the 1920's. When using Polish notation, the instruction (operation) precedes the data (operands). In Polish notation, the order (and only the order) of operations and operands determines the result, making parentheses unnecessary.

The notation for the expression 3(4 +5) could be expressed as

x 3 + 4 5

This contrasts with the traditional algebraic methodology for performing mathematical operations, the Order of Operations. (The mnemonic device for remembering the Order of Operations is "Please Excuse My Dear Aunt Sally" - parentheses, exponents, multiplication, division, addition, subtraction). In the expression 3(4+5), you would work inside the parentheses first to add four plus five and then multiply the result by three.

In the early days of the calculator , the end-user had to write down the results of their intermediate steps when using the algebraic Order of Operations. Not only did this slow things down, it provided an opportunity for the end-user to make errors and sometimes defeated the purpose of using a calculating machine. In the 1960's, engineers at Hewlett-Packard decided that it would be easier for end-users to learn Jan Lukasiewicz' logic system than to try and use the Order of Operations on a calculator. They modified Jan Lukasiewicz's system for a calculator keyboard by placing the instructions (operators) after the data. In homage to Jan Lukasiewicz' Polish logic system, the engineers at Hewlett-Packard called their modification reverse Polish notation (RPN).

The notation for the expression 3(4+5) would now be expressed as

4 5 + 3 x

or it could be further simplified to

3 4 5 + x

Reverse Polish notation provided a straightforward solution for calculator or computer software mathematics because it treats the instructions (operators) and the data (operands) as "objects" and processes them in a last-in, first-out (LIFO) basis. This is called a "stack method". (Think of a stack of plates. The last plate you put on the stack will be the first plate taken off the stack.)

Modern calculators with memory functions are sophisticated enough to accommodate the use of the traditional algebraic Order of Operations, but users of RPN calculators like the logic's simplicity and continue to make it profitable for Hewlett-Packard to manufacture RPN calculators. Some of Hewlett Packard's latest calculators are capable of both RPN and algebraic logic.