Formula calculator

From Wikipedia, the free encyclopedia

A formula calculator is a software calculator that can perform a calculation in two steps:

1. Type in a formula from the keyboard.
2. Press a single button or key to see the formula’s value.[1][2][3]

This is unlike a button-operated calculator, which requires the user to perform one step for each operation, by pressing buttons to calculate all the intermediate results, before the final value is shown.[4][5][6]

Contents

[edit] Limitations of button-operated calculators

The limitations of button-operated calculators have been discussed by Professor Harold Thimbleby, and others.[7][8] Professor Thimbleby points out that they “… require numbers and operation signs to be punched in a certain order, and mistakes are easy to make and hard to spot”.[9]

Mistakes are made because users have to work out for themselves the explicit step-by-step order in which to perform operations. This is implicit in written formulas because they use:

• Operators with different precedences, so that higher precedence operators, such as multiplication, must be used before lower precedence operators, such as addition.
• Parentheses to enclose parts of a formula that must be calculated first.
• Operators that must be applied to numbers in the correct order, such as subtraction and division.
• The same symbol for more than one purpose, such as - for negative numbers and subtraction.

These implicit features of written formulas make it difficult to use button-operated calculators because, for anything but the simplest calculation:

• Formulas have to be rearranged so that their values can be calculated by pressing buttons one at a time.
• To apply operators in the correct order, as required by parentheses and operator precedences, memory buttons may have to be used.
• For operators that must be applied to numbers in the correct order, the special buttons +/- and 1/x, that don’t correspond to operations in the formula, may have to be used.

Mistakes are 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 isn’t always the same as the button, but a previously entered operation.
• There may be no record of the operations that have been used.

[edit] Examples

The simplest example of a possible error given by Professor Thimbleby is 4*-5.[10] This can be typed into a formula calculator as shown, and the result would always be as expected, namely -20, because the minus sign would be interpreted correctly as indicating a negative number, rather than a subtraction.

With a button-operated calculator, depending on which buttons 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 precedences, parentheses and operators that must be applied to numbers in the correct order, 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.[13]

These are only simple examples, but the limitations of button-operated calculators present even greater difficulties in more complex cases. In fact, Professor Thimbleby claims that their limitations may have conditioned users to avoid them for all but the simplest problems.[14]

[edit] Automatic, safe and easy calculators

Formula calculators are more automatic than button-operated calculators because the final result is calculated by pressing a single button or key, and it isn’t necessary to perform any intermediate steps.

They are safer because formulas are typed in as written, so errors are less likely. If any mistakes are made, they can be seen and corrected in the visible formula.

It is easier to repeat a calculation with a formula calculator, because the formula is a record of the calculation that can be edited, copied and saved. Parts of a formula can be modified, for example to correct an error or change one of the numbers. After a change, the calculation can be repeated by pressing a single button or key, without re-entering the whole formula. In contrast, with a button-operated calculator, it is necessary to repeat the whole series of button presses if a calculation is to be repeated for different numbers.

Formula calculators are especially easier for long calculations, because, once typed in, long formulas are just as easy to evaluate, edit, repeat, copy and save as short formulas. So extra keyboard typing is the only thing required for long calculations over and above short calculations.

[edit] Using the full power of the computer

Software calculators that simulate hand-held, button-operated 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)[15]

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. Also, the full keyboard and the mouse can be used for entering and editing formulas.

[edit] Declarative and imperative tools

The limitations of button-operated calculators stem from the fact that they are imperative.[16] This means that a 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.[17] This means that a 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,[18][19] and there has been a long-term trend from imperative to declarative methods.[20][21] Formula calculators are part of this trend.

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

[edit] See also

Calculator

Scientific calculator

Programmable calculator

[edit] References

  1. ^ Formula Calculators Pty Ltd [home page on the Internet]; 2007. 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 products 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 product 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 7, section 2
  11. ^ References 4, 5 and 6
  12. ^ Reference 4
  13. ^ Reference 4
  14. ^ Reference 7, section 3.2, second paragraph
  15. ^ Reference 3, second paragraph
  16. ^ Reference 7, sections 1 and 10
  17. ^ Reference 7
  18. ^ Reference 7
  19. ^ 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
  20. ^ David A. Watt. Programming language concepts and paradigms, Prentice Hall, 1990 (citation 13 at http://citeseer.ist.psu.edu/context/14802/0)
  21. ^ 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)
  22. ^ Reference 19, paragraph 6