Free Republic
Browse · Search
News/Activism
Topics · Post Article

To: Ernest_at_the_Beach

Reverse Polish Notation

Reverse Polish Notation is a way of expressing arithmetic expressions that avoids the use of brackets to define priorities for evaluation of operators. In ordinary notation, one might write

(3 + 5) * (7 - 2)

and the brackets tell us that we have to add 3 to 5, then subtract 2 from 7, and multiply the two results together. In RPN, the numbers and operators are listed one after another, and an operator always acts on the most recent numbers in the list. The numbers can be thought of as forming a stack, like a pile of plates. The most recent number goes on the top of the stack. An operator takes the appropriate number of arguments from the top of the stack and replaces them by the result of the operation.

In this notation the above expression would be

3 5 + 7 2 - *

Reading from left to right, this is interpreted as follows:

Polish Notation was devised by the Polish philosopher and mathematician Jan Lucasiewicz (1878-1956) for use in symbolic logic. In his notation, the operators preceded their arguments, so that the expression above would be written as

* + 3 5 - 7 2

The 'reversed' form has however been found more convenient from a computational point of view.

Back to RRF page


This file was last revised by Anthony Stone (ajs1@cam.ac.uk) on 3 June 1997.

8 posted on 12/02/2005 2:06:44 PM PST by Milhous (Sarcasm - the last refuge of an empty mind.)
[ Post Reply | Private Reply | To 1 | View Replies ]


To: Milhous
Reverse Polish Notation

I've always used an HP RPN scientific calculator. Started with an 11C, which was stolen. Replaced it with a 32S II about 17 years ago. I love to watch the response from non-tech borrowers. Where's the "equals" button? ;-)

32 posted on 12/02/2005 6:25:13 PM PST by Orbiting_Rosie's_Head
[ Post Reply | Private Reply | To 8 | View Replies ]

To: Milhous

Thanks, for years I've used RPN with my HP 12C.

I've often wondered how/why of RPN. It's all so common sense.


40 posted on 12/04/2005 5:28:38 PM PST by Balding_Eagle (God has blessed Republicans with really stupid enemies.)
[ Post Reply | Private Reply | To 8 | View Replies ]

Free Republic
Browse · Search
News/Activism
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson