Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Polish notation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Explanation== The expression for adding the numbers 1 and 2 is written in Polish notation as {{nowrap|+ 1 2}} (prefix), rather than as {{nowrap|1 + 2}} (infix). In more complex expressions, the operators still precede their operands, but the operands may themselves be expressions including again operators and their operands. For instance, the expression that would be written in conventional infix notation as {{block indent|(5 β 6) Γ 7}} can be written in Polish notation as {{block indent|Γ (β 5 6) 7}} Assuming a given [[arity]] of all involved operators (here the "β" denotes the binary operation of subtraction, not the unary function of sign-change), any well-formed prefix representation is unambiguous, and brackets within the prefix expression are unnecessary. As such, the above expression can be further simplified to {{block indent|Γ β 5 6 7}} The processing of the product is deferred until its two operands are available (i.e., 5 minus 6, and 7). As with ''any'' notation, the innermost expressions are evaluated first, but in Polish notation this "innermost-ness" can be conveyed by the sequence of operators and operands rather than by bracketing. In the conventional infix notation, parentheses are required to override the standard [[Order of operations|precedence rules]], since, referring to the above example, moving them {{block indent|5 β (6 Γ 7)}} or removing them {{block indent|5 β 6 Γ 7}} changes the meaning and the result of the expression. This version is written in Polish notation as {{block indent|β 5 Γ 6 7.}} When dealing with non-commutative operations, like division or subtraction, it is necessary to coordinate the sequential arrangement of the operands with the definition of how the operator takes its arguments, i.e., from left to right. For example, {{nowrap|Γ· 10 5}}, with 10 to the left of 5, has the meaning of 10 Γ· 5 (read as "divide 10 by 5"), or {{nowrap|β 7 6}}, with 7 left to 6, has the meaning of 7 β 6 (read as "subtract from 7 the operand 6").
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)