# Calculator input methods

﻿
Calculator input methods

There are various ways in which a calculator might interpret key strokes.

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.[1][2][3] There are various systems for typing in an expression: infix, postfix, natural display etc.

On an immediate execution calculator, the user presses a key for each operation, by pressing keys to calculate all the intermediate results, before the final value is shown.[4][5][6]

## Immediate execution

A simple 4-function calculator program.

With the immediate execution 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. Scientific calculators have buttons for brackets and these calculators can take order of operation in to account. Also for unary operations like √ or x2 the number is entered first then the operator. Simple 4-function calculators, such as those included with most operating systems, usually use this input method.

Examples
Formula Key strokes Key stroke count
$1 + 2 \times 3$ 2 × 3 + 1 =

1 + 2 × 3 =

6

6

$\sin 30 \times \cos 30$ 3 0 SIN × 3 0 COS = 8

From the first example has been given twice. The first version for simple calculators showing how it is necessary to rearrange operands in order to get the correct result. The second version for scientific calculator where operator precedence is observed.

The immediate execution calculators are based on a mixture of infix and postfix notation: binary operations are infix but unary operations are postfix. Because operators are applied one at a time, the user must work out which operator button to use at each stage and this can lead to problems.[7][8] 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”.[9]

Problems can occur because, for anything but the simplest calculation, 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, whilst 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 a previously entered operation.

### Examples of difficulties

The simplest example of a possible problem when using an immediate execution calculator given by Professor Thimbleby is 4*(−5).[10] 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 can be different. Also, among the calculators, there are differences in the way a given sequence of button presses is interpreted.[11] 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.[12]

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.[12]

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.[13]

### Declarative and imperative tools

The potential problems with immediate execution calculators stem from the fact that they are imperative.[14] This means that the user must provide details of how the calculation has to be performed.

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.[15] 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 to do, 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,[15][16] and there has been a long-term trend from imperative to declarative methods.[17][18] Formula calculators are part of this trend.

Many software tools for the general user, such as spreadsheets, are declarative.[19] Formula calculators are examples of such tools.

### Using the full power of the computer

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)[20] 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.

## Reverse Polish notation (RPN) (postfix notation)

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 stack one can enter formulas without the need to rearrange operands. An example of a calculator which uses RPN is the HP 48G.

Examples
Formula Key strokes Key stroke count
$1 + 2 \times 3$ 1 Enter 2 Enter 3 × + 7
$\sin 30 \times \cos 30$ 3 0 SIN 3 0 COS × 7

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 6 key strokes would be needed.

## Infix notation

This calculator program has accepted input in infix notation, and returned the answer 3,86. Here the comma is a decimal separator.

With this mode the precedence of mathematical operators is taken into account. 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.)[21], and Casio calls this method Visually Perfect Algebraic Method (V.P.A.M.)[22].

Examples
Formula Key strokes Key stroke count
$1 + 2 \times 3$ 1 + 2 × 3 = 6
$\sin 30 \times \cos 30$ SIN 3 0 × COS 3 0 = 8

### BASIC notation

This is a particular implementation of infix notation where functions require their parameters to be in brackets.

This method was used from the 1980s to the 1990s in BASIC programmable calculators and pocket computers. Also, most computer algebra systems use this as the default input method.

In BASIC notation the formula is entered as it would be entered in BASIC PRINT command - the PRINT command itself being optional. On pressing the ENTER the result would be displayed. Typing mistakes in the entered formula could be corrected using the same editor function as available when programming the calculator.

Examples
Formula Key strokes Key stroke count
$1 + 2 \times 3$ 1 + 2 × 3 Enter 6
$\sin 30 \times \cos 30$ SIN ( 3 0 ) × COS ( 3 0 ) Enter

S I N ( 3 0 ) × C O S ( 3 0 ) Enter

12

16

For the 2nd example two options are give depending if the BASIC programmable pocket computers had dedicated trigonometric keys [23] or not [24].

## Mathematical display

Scientific calculator displaying fractions and their decimal equivalents

Some calculators allow the entering of equations in a way which things like fractions, surds and integrals are displayed in the way they would normally be written.

Casio used to call this Natural Display or Natural textbook display[25][26], but now uses Natural-VPAM[27]. SHARP calls this WriteView[28] on its scientific calculators and on its graphing calculators it just uses the term Equation Editor[29]. HP calls this Equation Writer[30]. Mathematica calls this Semantic-Faithful Typesetting[31]. Mathcad calls this standard math notation[32]. Maple has a Math Equation Editor[33] but does not have a special name for this input method. Texas Instruments calls this Math Print[34].

Examples
Formula Key strokes Key stroke count
$1 + 2 \times 3$ 1 + 2 × 3 Enter 6
$\sin 30 \times \cos 30$ SIN 3 0 × COS 3 0 Enter

SIN ( 3 0 ) × COS ( 3 0 ) Enter

9

12

For the second example two options are given depending if the calculators will automatically insert needed parenthesis or not. Machines equipped with an alphanumeric display will display SIN(30)×COS(30) before pressing Enter.

## References

1. ^ Formula Calculators Pty Ltd [Home page on the Internet]; 2009. Available from: http://fCalculators.com
2. ^ Moisey Oysgelt [JavaScript Formula Calculator page on the Internet]; 2000. Available from: http://www.alemoi.com/math
3. ^ Haxial Software Pty Ltd [Calculator Product page on the Internet]; 2001. Available from: http://www.haxial.com/products/calculator
4. ^ Microsoft’s Windows Operating System Calculator Accessory; 2001. Available on a Windows PC at: Start/All Programs/Accessories/Calculator
5. ^ MotionNET [Calculator page on the Internet]; 2006. Available from: http://www.motionnet.com/calculator
6. ^ Flow Simulation Ltd [Virtual Calc98 page on the Internet]; 2008. Available from: http://www.calculator.org/jcalc98.html
7. ^ Harold Thimbleby. A new calculator and why it is necessary, Computing Science, Middlesex University, London, UK; September 1998. Available from: http://www.uclic.ucl.ac.uk/harold/srf/allcalcs.pdf
8. ^ Neville Holmes. Truth and Clarity in Arithmetic, University of Tasmania; 2003. Available from: http://standards.computer.org/sabminutes/2003Wint/Truth%20and%20Clarity%20in%20Arithmetic%20-%20Neville%20Holmes.pdf
9. ^ http://www.physorg.com. Professor devises easier calculator; June 2005. Available from: http://www.physorg.com/news4773.html
10. ^ Reference 11, section 2
11. ^ References 4, 5 and 6
12. ^ a b Reference 4
13. ^ Reference 11, section 3.2, second paragraph
14. ^ Reference 11, sections 1 and 10
15. ^ a b Reference 11
16. ^ Roy E. Furman. Declarative Programming - Strategies for Solving Software Problems, http://www.articlesalley.com; July 2006. Available from: http://www.articlesalley.com/article.detail.php/7013/178/Education/Internet/36/Declarative_Programming_-_Strategies_for_Solving_Software_Problems
17. ^ David A. Watt. Programming language concepts and paradigms, Prentice Hall; 1990. Citation 13 at: http://citeseer.ist.psu.edu/context/14802/0
18. ^ 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
19. ^ Reference 20, paragraph 6
20. ^ Reference 3, second paragraph
21. ^ Direct algebraic logic
22. ^ What does VPAM stand for
23. ^ The picture of the Casio FX-880P show sin, cos and tan keys on the second row right hand side.
24. ^ The picture of the Sharp PC-1245 shows no trignometric keys
25. ^ Natural textbook display - Scientific calculator
26. ^ Natural textbook display - Graphic calculator
27. ^ Natural Visually Perfect Algebraic Mode (V.P.A.M) - Scientific calculator
28. ^ WriteView
29. ^ Sharp Graphing equation editor
31. ^ Semantic-Faithful Typesetting
33. ^ http://www.maplesoft.com/products/maple/features/feature_detail.aspx?fid=5907
34. ^ http://education.ti.com/educationportal/sites/US/productDetail/us_os_84plus.html

Wikimedia Foundation. 2010.

### Look at other dictionaries:

• Monte Carlo methods in finance — Monte Carlo methods are used in finance and mathematical finance to value and analyze (complex) instruments, portfolios and investments by simulating the various sources of uncertainty affecting their value, and then determining their average… …   Wikipedia

• dc (computer program) — dc is a cross platform reverse polish desk calculator which supports arbitrary precision arithmetic.[1] It is one of the oldest Unix utilities, predating even the invention of the C programming language; like other utilities of that vintage, it… …   Wikipedia

• Comparison of software calculators — This list is incomplete; you can help by expanding it. This is a list of notable software calculators. Contents 1 Immediate execution calculators (button oriented) 2 Expression or formula calculators …   Wikipedia

• Order of operations — In mathematics and computer programming, the order of operations (sometimes called operator precedence) is a rule used to clarify unambiguously which procedures should be performed first in a given mathematical expression. For example, in… …   Wikipedia

• Unicode — For the 1889 Universal Telegraphic Phrase book, see Commercial code (communications). The Unicode official logo since October 2009 …   Wikipedia

• Microsoft Tablet PC — HP Compaq tablet PC with rotating/removable keyboard A Microsoft Tablet PC is a term coined by Microsoft for tablet computers conforming to a set of specifications announced in 2001 by Microsoft, for a pen enabled personal computer, conforming to …   Wikipedia

• TI-89 series — The TI 89 and the TI 89 Titanium are graphing calculators developed by Texas Instruments. They are differentiated from other graphing calculators by their powerful computer algebra system, which allows symbolic manipulation of algebraic… …   Wikipedia

• Numeric keypad — A numeric keypad, numpad or tenkey for short, is the small, palm sized, seventeen key section of a computer keyboard, usually on the very far right. The numeric keypad features digits 0 to 9, addition (+), subtraction (−), multiplication (*) and… …   Wikipedia

• Maemo — Screenshot of Maemo 5 Company / developer open s …   Wikipedia

• Nokia C6-01 — Manufacturer Nokia Series Cseries Compatible networks HSDPA (Pentaband) (3.5G) 850 / 900 / 1700 / 1900 …   Wikipedia