Calculator input methods: Difference between revisions

Content deleted Content added
Wikicgc (talk | contribs)
Wikicgc (talk | contribs)
rearrange sections
Line 5:
There are various ways in which the in which a button-operated calculator might interpret key strokes.
 
=== Immediate execution ===
=== Reverse Polish Notation (RPN) (Postfix notation) ===
 
With this mode of operation each [[binary operation]] is executed as soon as the next operator is pressed, therefore the order of operations in a mathematical expression is not taken into account. Some calculators have buttons for brackets and these calculators ''can'' take order in to account. Also for [[unitary operators]] like √ or x<sup>2</sup> the number is entered first then the operator.
{{main|Reverse Polish Notation}}
 
In Reverse Polish Notation also known as '''Postfix notation''' all operations are entered after the [[operand]]s on which the operation is performed. Reverse Polish Notation is parenthesis-free which usually leads to less button presses needed to perform a operation. By the use of [[Stack_(data_structure)|stack]] one can enter formulas without the need to rearrange operands.
 
{| class="wikitable" border="1"
Line 18 ⟶ 16:
|-
| <math>1 + 2 \times 3</math>
| <code>12</code> <code>ENTER×</code> <code>23</code> <code>ENTER+</code> <code>31</code> <code>×</code> <code>+=</code>
| 76
|-
| <math>\sin 30 \times \cos 30</math>
| <code>3</code> <code>0</code> <code>SIN</code> <code>×</code> <code>3</code> <code>0</code> <code>COS</code> <code>×=</code>
| 78
|}
 
From the first example one can see that it is necessary to rearrange operands in order to get the correct result.
Note example 1 which is one of the few examples where Reverse Polish Notation does not use the fewest button presses - provided one does not rearrange operands. If one would do so then only 5 key strokes would be needed.
 
=== Reverse Polish Notation (RPN) (Postfix notation) ===
=== Immediate execution ===
 
{{main|Reverse Polish Notation}}
With this mode of operation each [[binary operation]] is executed as soon as the next operator is pressed, therefore the order of operations in a mathematical expression is not taken into account. Some calculators have buttons for brackets and these calculators ''can'' take order in to account. Also for [[unitary operators]] like √ or x<sup>2</sup> the number is entered first then the operator.
 
In Reverse Polish Notation also known as '''Postfix notation''' all operations are entered after the [[operand]]s on which the operation is performed. Reverse Polish Notation is parenthesis-free which usually leads to less button presses needed to perform a operation. By the use of [[Stack_(data_structure)|stack]] one can enter formulas without the need to rearrange operands.
 
{| class="wikitable" border="1"
Line 39:
|-
| <math>1 + 2 \times 3</math>
| <code>21</code> <code>×ENTER</code> <code>32</code> <code>+ENTER</code> <code>13</code> <code>=×</code> <code>+</code>
| 67
|-
| <math>\sin 30 \times \cos 30</math>
| <code>3</code> <code>0</code> <code>SIN</code> <code>×</code> <code>3</code> <code>0</code> <code>COS</code> <code>=×</code>
| 87
|}
 
Note example 1 which is one of the few examples where Reverse Polish Notation does not use the fewest button presses - provided one does not rearrange operands. If one would do so then only 5 key strokes would be needed.
From the first example one can see that it is necessary to rearrange operands in order to get the correct result.
 
 
 
=== Infix notation ===