Calculator input methods
There are various ways in which calculators interpret keystrokes.
One can categorize calculators into two main types: 1) single-step or immediate-execution calculators and 2) expression or formula calculators.
On a formula calculator one types in an expression and then presses "Enter" to evaluate the expression. There are various systems for typing in an expression: infix, postfix, natural display, etc.
With the immediate execution mode of operation (also known as algebraic entry system (AES) or chain calculation mode) each binary operation is executed as soon as the next operator is pressed, and therefore the order of operations in a mathematical expression is not taken into account. Scientific calculators have buttons for brackets and can take order of operation into account. Also, for unary operations, like √ or x2, the number is entered first, then the operator. Simple four-function calculators, such as those included with most operating systems, usually use this input method.
|2 × 3 + 1 =
1 + 2 × 3 =
|3 0 SIN × 3 0 COS =||8|
|5 − 3 =||4|
|1 5 + 1 0 + 1 0 + 1 0 =||12|
The first example has been given twice. The first version is for simple calculators, showing how it is necessary to rearrange operands in order to get the correct result. The second version is for scientific calculators, where operator precedence is observed.
Immediate-execution calculators are based on a mixture of infix and postfix notation: binary operations are done as infix, but unary operations are postfix. Because operators are applied one-at-a-time, the user must work out which operator key to use at each stage, and this can lead to problems. When discussing these problems, Professor Harold Thimbleby has pointed out that button-operated calculators "require numbers and operation signs to be punched in a certain order, and mistakes are easy to make and hard to spot".
Problems can occur because, for anything but the simplest calculation, in order to work out the value of a written formula, the user of a button-operated calculator is required to:
- Rearrange the formula so that the value can be calculated by pressing buttons one at a time, while taking operator precedence and parentheses into account.
- Use memory buttons to ensure that operations are applied in the correct order.
- Use the special buttons ± and 1/x, that do not correspond to operations in the formula, for non-commutative operators.
Mistakes can be hard to spot because:
- For the above reasons, the sequence of button presses may bear little resemblance to the original formula.
- The operation carried out when a button is pressed is not always the same as the button, but could be a previously entered operation.
Examples of difficultiesEdit
The simplest example given by Professor Thimbleby of a possible problem when using an immediate-execution calculator is 4 × (−5). As a written formula the value of this is −20 because the minus sign is intended to indicate a negative number, rather than a subtraction, and this is the way that it would be interpreted by a formula calculator.
On an immediate-execution calculator, depending on which keys are used and the order in which they are pressed, the result for this calculation may be different. Also there are differences between calculators in the way a given sequence of button presses is interpreted. The result can be:
- −1: If the subtraction button − is pressed after the multiplication ×, it is interpreted as a correction of the × rather than a minus sign, so that 4 − 5 is calculated.
- 20: If the change-sign button ± is pressed before the 5, it isn't interpreted as −5, and 4 × 5 is calculated.
- −20: To get the right answer, ± must be pressed last, even though the minus sign isn't written last in the formula.
The effects of operator precedence, parentheses and non-commutative operators, on the sequence of button presses, are illustrated by:
- 4 − 5 × 6: The multiplication must be done first, and the formula has to be rearranged and calculated as −5 × 6 + 4. So ± and addition have to be used rather than subtraction. When + is pressed, the multiplication is performed.
- 4 × (5 + 6): The addition must be done first, so the calculation carried out is (5 + 6) × 4. When × is pressed, the addition is performed.
- 4 / (5 + 6): One way to do this is to calculate (5 + 6) / 4 first and then use the 1/x button, so the calculation carried out is 1 / ((5 + 6) / 4).
- 4 × 5 + 6 × 7: The two multiplications must be done before the addition, and one of the results must be put into memory.
These are only simple examples, but immediate-execution calculators can present even greater problems in more complex cases. In fact, Professor Thimbleby claims that users may have been conditioned to avoid them for all but the simplest calculations.
Declarative and imperative toolsEdit
Professor Thimbleby has identified the need for a calculator that is more automatic and therefore easier to use, and he states that such a calculator should be more declarative. This means that the user should be able to specify only what has to be done, not how, and in which order, it has to be done.
Formula calculators are more declarative because the typed-in formula specifies what is to be done, and the user does not have to provide any details of the step-by-step order in which the calculation has to be performed.
Declarative solutions are easier to understand than imperative solutions, and there has been a long-term trend from imperative to declarative methods. Formula calculators are part of this trend.
Many software tools for the general user, such as spreadsheets, are declarative. Formula calculators are examples of such tools.
Using the full power of the computerEdit
Software calculators that simulate hand-held, immediate execution calculators do not use the full power of the computer: "A computer is a far more powerful device than a hand-held calculator, and thus it is illogical and limiting to duplicate hand-held calculators on a computer." (Haxial Software Pty Ltd) Formula calculators use more of the computer's power because, besides calculating the value of a formula, they work out the order in which things should be done.
Different forms of this input scheme exist. In the algebraic entry system with hierarchy (AESH), the precedence of basic mathematical operators is taken into account, whereas calculators with algebraic entry system with parentheses (AESP) support the entry of parentheses. An input scheme known as algebraic operating system (AOS) combines both. Most graphing calculators by Casio and Texas Instruments use this method. On its scientific calculators, Sharp calls this method Direct Algebraic Logic (D.A.L.), and Casio calls this method the Visually Perfect Algebraic Method (V.P.A.M.).
|1 + 2 × 3 =||6|
|SIN 3 0 × COS 3 0 =||8|
|( 1 + 2 ) × ( 3 + 4 ) =||12|
|1 5 + 1 0 + 1 0 + 1 0 =||12|
Reverse Polish notation (RPN) (postfix notation)Edit
In reverse Polish notation, also known as postfix notation, all operations are entered after the operands on which the operation is performed. Reverse Polish notation is parenthesis-free which usually leads to fewer button presses needed to perform an operation. By the use of a stack one can enter formulas without the need to rearrange operands. An example of a calculator which uses RPN is the HP 35s.
|1 ↵ Enter 2 ↵ Enter 3 × +
2 ↵ Enter 3 × 1 +
|3 0 SIN 3 0 COS ×||7|
|1 ↵ Enter 2 + 3 ↵ Enter 4 + ×||9|
|1 5 ↵ Enter 1 0 + 1 0 + 1 0 +
1 5 ↵ Enter 1 0 ↵ Enter ↵ Enter ↵ Enter + + +
1 5 ENTER^ 1 0 ENTER^ ENTER^ + + +
11 (RPL and Entry RPN)
10 (Classical RPN)
Note: The first example illustrates one of the few cases where reverse Polish notation does not use the fewest button presses – provided one does not rearrange operands. If one would do so then only six keystrokes would be needed.
This is a particular implementation of infix notation where functions require their parameters to be in brackets.
In BASIC notation the formula is entered as it would be entered in BASIC
|1 + 2 × 3 ↵ Enter||6|
|SIN ( 3 0 ) × COS ( 3 0 ) ↵ Enter
S I N ( 3 0 ) × C O S ( 3 0 ) ↵ Enter
Ten key notation (adding machine)Edit
This input method first became popular with accountants' paper tape adding machines. It generally makes the assumption that entered numbers are being summed, although other operations are supported. Each number entered is followed by its sign (+/−), and a running total is kept. An assumption is made that the last operand can be implicitly used next, so by just entering another + (for example), one will reuse the most recent operand. Ten key input mode is available in printing calculators from companies such as Sharp, and in software calculators like Judy's TenKey used by accounting firms. Online tenkey training and certification tools are available as well, and some businesses use ten key typing speed as an employment criterion.
|1 + 2 × 3 = + T||8|
|3 0 SIN × 3 0 COS =||8|
|5 + 3 - T||5|
|1 5 + 1 0 + + + T||9|
Casio used to call this Natural Display or Natural textbook display, but now uses Natural-VPAM. SHARP calls this WriteView on its scientific calculators and on its graphing calculators it calls it simply Equation Editor. HP calls this Textbook display setting, which can be used in both RPN and Algebraic mode and in both the Stack and in the Equation Writer application. Mathematica calls this Semantic-Faithful Typesetting. Mathcad calls this standard math notation. Maple has a Math Equation Editor, but does not have a special name for this input method. Texas Instruments calls it MathPrint.
|1 + 2 × 3 ↵ Enter||6|
|SIN 3 0 → × COS 3 0 ↵ Enter
SIN ( 3 0 ) × COS ( 3 0 ) ↵ Enter
|5 − 3 ↵ Enter||4|
|1 5 + 1 0 + 1 0 + 1 0 ↵ Enter||12|
For the second example, two options are given, depending on whether the calculators will automatically insert needed parentheses or not. Machines equipped with an alphanumeric display will display SIN(30)×COS(30) before ↵ Enter is pressed.
- Formula Calculators Pty Ltd [Home page on the Internet]; 2009.
- Haxial Software Pty Ltd Calculator Product page on the Internet; 2001
- Microsoft’s Windows Operating System Calculator Accessory; 2001. Available on a Windows PC at: Start/All Programs/Accessories/Calculator.
- MotionNET Calculator page on the Internet; 2006.
- Flow Simulation Ltd Virtual Calc98 page on the Internet; 2008.
- Ball, John A. (1978). Algorithms for RPN calculators (1 ed.). Cambridge, Massachusetts, USA: Wiley-Interscience, John Wiley & Sons, Inc. ISBN 0-471-03070-8.
- Harold Thimbleby (September 1998). "A new calculator and why it is necessary" (PDF). Computing Science, Middlesex University, London, UK. Archived from the original (PDF) on 2007-02-07. Retrieved 2009-05-04.
- Neville Holmes. Truth and Clarity in Arithmetic, University of Tasmania; 2003.
- Professor devises easier calculator; www.physorg.com. June 2005.
- Reference 11, section 2.
- clarify], section 3.2, second paragraph.[
- clarify], sections 1 and 10.[
- Roy E. Furman (July 2006). "Declarative Programming – Strategies for Solving Software Problems". Archived from the original on 2012-07-23. Retrieved 2009-05-04.
- David A. Watt. Programming language concepts and paradigms, Prentice Hall; 1990. Citation 13 at http://citeseer.ist.psu.edu/context/14802/0.
- Tatsuru Matsushita. Expressive Power of Declarative Programming Languages, PhD thesis, Department of Computer Science, University of York; October 1998. Citation 13 at http://citeseer.ist.psu.edu/context/14802/0.
- clarify], paragraph 6.[
- Reference 3, second paragraph
- Direct algebraic logic
- What does VPAM stand for
- The picture of the Casio FX-880P shows sin, cos and tan keys on the second row right hand side.
- The picture of the Sharp PC-1245 shows no trigonometric keys
- Assortment of physical calculators, including printing ones that use tenkey syntax
- Example calculator which toggles between infix, RPN, and tenkey
- Natural textbook display - Scientific calculator.
- Natural textbook display - Graphic calculator
- Natural Visually Perfect Algebraic Mode (V.P.A.M) - Scientific calculator.
- Sharp Graphing equation editor.
- Inc., HP. "HP Support document - HP Support Center". h20564.www2.hp.com. Retrieved 2016-08-23.
- Semantic-Faithful Typesetting.