We have all used a calculator at some point. The vast majority of them, including the one that comes by default in our favorite operating system, use a system called “infix notation”, in which operators separate operands. However, there is another way to perform calculations called “postfix notation” or “Reverse Polish Notation”, in which operands are entered first and then the operator that will perform the calculations on them. Since 1968, this system has been applied in a large number of calculators, especially by Hewlett-Packard.

Since we learn to perform simple mathematical operations, such as addition or subtraction, we get used to the so-called “infix notation”. In this notation, operators (the “symbol” that denotes which operation we must perform) are placed between operands (the figures with which we want to operate). Thus, to add two and five, we write “2 + 5”. Most electronic calculators use this same notation, and it is extremely easy for us to use them because we are not doing anything other than the usual calculations but with an electronic assistant. However, this is not the most efficient way to enter data into one of these devices.

Reverse Polish Notation
HP-9100A desktop calculator (1968)

Polish Notation

In 1920, a Polish mathematician named Jan Lukasiewicz published an alternative algebraic method of data entry known as “Polish Notation”, in which each operator is placed before its operands. In this way, our example “2 + 5” becomes “+ 2 5”. After the “2” and the “5” (if we are using a calculator or computer) we must press a special key (often called “Enter”) to “notify” the system that we have finished entering an operand. It may seem complex, but in reality once you get used to it, it is very simple to use.

This method served as the basis for another very similar one, but one that placed operands first and operators at the end (“2 5 +”). This system is called “Reverse Polish Notation” or, simply, RPN. This system was “invented” several times. The first time its application was documented was in 1954, by Burks, Warren, and Wright. In the 1960s, Friedrich L. Bauer and Edsger Dijkstra, independently, proposed the RPN system again, as part of their work with computers. RPN is a very practical mechanism for programming, since it allows reducing the number of memory accesses and using a stack to evaluate expressions.

Reverse Polish Notation
Reverse Polish Notation

Reverse Polish Notation is also known as “postfix notation” or “postfix notation”, and like Polish Notation, it has the undeniable advantage that (as long as the operator parity is fixed) no parentheses are needed to indicate the order of operations. The algorithms needed to implement RPN in electronic systems were developed and disseminated by an Australian scientist named Charles Leonard Hamblin, in the mid-1960s. Hewlett-Packard used this notation in 1968, when it designed its first desktop calculator - the HP-9100A - and also in the first pocket scientific calculator, the HP-35. This made the system very well known and used by students and engineers of the 1970s, since Hewlett-Packard products were widely distributed.

Although today it is a bit hard to find calculators that use RPN as the basis of their operation, the truth is that this system is at the core of many of the applications you use every day. This way of working is extensively applied in stack-based programming languages, or in operating systems based on data flow and pipes, such as Unix.

Wikipedia