# Reverse Polish Notation

Anyone who has had to work out long and complex equations by punching endless numbers and symbols into a calculator knows how frustrating it can be: Users need to remember where they are in the formula and also pay attention to brackets, which affect the order of operations.

In the 1950s, this frustration became a real challenge for the engineers building and programming the first electronic computers. They needed to explore unconventional ways of writing mathematical expressions so computers could better understand and solve problems.

In 1956, UNSW philosopher and engineer Charles Hamblin developed a way to re-order the numbers (operands) and symbols (operators) in mathematical expressions, and worked out how to apply this logic system to early computing.

It was a small adjustment, but it had profound implications for the future of computing.

Working with the University’s first academic computer, Hamblin recognised it was difficult to compute mathematical formulae containing brackets and that there was a significant “memory” problem for long, multi-stage equations. For each operation the computer needed to recall information, or partial sums, from a specific “memory store” with its own unique address – a slow and inefficient process.

An existing mathematical format known as Polish Notation, where the instruction precedes the numbers to which it applies (for example, the formula 2+2 is written +22) eliminated the need for brackets, but it didn’t solve the second problem pertaining to memory.

Hamblin’s solution was to reverse the order – to put the instruction after the numbers.

“Reverse Polish Notation was very influential in the early days of computing … because it allowed minimal demands on memory, in a period when memory space in machines was at a premium,” says Professor Peter McBurney, Head of the Department of Informatics at King's College London.

With this format, computers could store the data for each operation in a single place, known as a stack – or a zero address store – something still important in computer architecture and programming.

Hewlett-Packard adopted Reverse Polish Notation in the 1960s for their scientific calculators.

“By the mid-1970s these calculators were being used by most scientists in the Western world,” says McBurney. “Indeed, many people believe that HP invented Reverse Polish Notation. They are wrong.”