Thursday, November 20, 2008

PN - Polish Notation & RPN - Reverse Polish Notation

Polish Notation
--------------------
The method of writing all operators either before their operation, or after them, is called Polish notation, in honor of its discoverer, the Polish mathematician Jan Lukasiewicz. When the operators are written before their operands, 
it is called the prefix form. 
When the operators come after their operands. It is called the postfix form, or, sometimes reverse Polish form or suffix form

In this context, it is customary to use the coined phrase infix form to denote the usual custom of writing binary operators between their operands.                                              
For example, the expression A + B becomes +AB in prefix form and AB+ in postfix form. 

In the expression A + B x C, the multiplication is done first, so we convert it first, obtaining first A + ( BCx ) and then ABCx+ in postfix form

The prefix form of this expression is +A x BC. The prefix and postfix forms are not related by taking mirror images or other such simple transformation. Also all parentheses have been omitted in the Polish forms.

No comments:

Blog List