Polish notation: Difference between revisions
imported>Richard Pinch (new entry, just a stub) |
imported>Bruce M. Tindall (source of name) |
||
Line 18: | Line 18: | ||
Expressions in reverse Polish notation are particularly well adapted to evaluation on a [[stack]]. | Expressions in reverse Polish notation are particularly well adapted to evaluation on a [[stack]]. | ||
The name "Polish notation" refers to the nationality of its inventor, [[Jan Łukasiewicz]] (1878-1956). |
Revision as of 13:10, 12 December 2008
In mathematics and computer science, Polish notation is a way of expressing arithmetic or algebraic formulae which is unambiguous without the use of parentheses.
In ordinary "algebraic" or "infix" notation a binary operator such as × or + is written between the two operands, and an expression such as a × b + c is then ambiguous. The conventional solution to this difficulty is to use a convention for priority or precedence, for example that multiplication precedes addition and then use brackets to show that the usual priority is not to be used (one such convention is "BODMAS"). Hence
In Polish notation the operator precedes its two operands: the operand may be a term or another expression. So
Here brackets have been inserted to show the order in which the operations are performed, but are not part of or necessary for the notation.
In reverse Polish notation the operator follows its two operands.
Expressions in reverse Polish notation are particularly well adapted to evaluation on a stack.
The name "Polish notation" refers to the nationality of its inventor, Jan Łukasiewicz (1878-1956).