Postfix notation

Postfix notation

Postfix notation

Prefix notation
Infix notation
Postfix notation

Postfix notation is a mathematical notation. It is a way to write down equations and other mathematical formulae. Postfix notation is also known as Reverse Polish Notation. The notation was invented by Charles Hamblin in 1920. He wanted to simplify writing logic equations. He used Jan Łukasiewicz's prefix notation.

When postfix notation is used, no grouping elements (like parenthesis) are needed.

Some computer languages, like Postscript use Postfix notation. It is also used in some models of Hewlett-Packard calculators

With postfix notation, the operations are noted after their arguments. Because of this, postfix is relatively easy to do with computers that have a stack to do calculations.

Further Explanation

Reverse Polish Notation uses a system that involve "stacks", each of which stores a certain value in specific ranks.[1] The stacks usually start off with the first stack (often called the X stack), followed by the second stack (often called the Y stack), the third stack, and so on. New values can be entered on the first stack by pushing up the stack ranks by one. On a Reverse Polish Notation calculator, the "Enter" function would do the same.

Using a common operator (plus, minus, multiply, or divide) will make the operator act from the first stack to the second stack. For example, the Reverse Polish Notation "12 3 /" means "take the numbers 12 and 3, then divide 12 by 3". On a Reverse Polish Calculator, this is written as "12 Enter 3 /", to denote each declared ranking up of the stacks.

Reverse Polish Notation is able to deal with expressions involving brackets too. Suppose there is a normal equation "4 * (5 + 8)". In Reverse Polish Notation, this expression will be formatted as "5 8 + 4 *". The "5 8 +" part refers to the bracket "5 + 8" to equal 13. The "4 *" part refers to multiplying the result together to get 52. On that step, the resulting stack from adding 5 and 8 is automatically raised one rank after adding in the new value 4. Then using the multiply operator will multiply the sum of 5 and 8 by 4 will equal 52.

Documentation included with early Hewlett-Packard calculators explained RPN as the same method you would use to evaluate an expression using paper and pencil. Basically, first you write down the arguments and then perform the arithmetic function. From the calculator's perspective, you must provide the argument(s) before calling the function. The benefit of a calculator with RPN is that you are always certain to which numbers (or intermediate calculation results) a function is being applied.

References

  1. ↑ "Reverse Polish Notation (RPN)". techopedia.com. Retrieved February 7, 2019.[permanent dead link]



Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.