# Calculo

Solo disponible en BuenasTareas
• Páginas : 12 (2853 palabras )
• Descarga(s) : 0
• Publicado : 4 de marzo de 2012

Vista previa del texto
Lies My Calculator and Computer Told Me

2

s

LIES MY CALCULATOR AND COMPUTER TOLD ME

Lies My Calculator and Computer Told Me

q

q

q

q

q

q

q

q

v See Section 1.4 for a discussion of

graphing calculators and computers with graphing software.

A wide variety of pocket-size calculating devices are currently marketed. Some can run programs prepared by theuser; some have pre-programmed packages for frequently used calculus procedures, including the display of graphs. All have certain limitations in common: a limited range of magnitude (usually less than 10100 for calculators) and a bound on accuracy (typically eight to thirteen digits). A calculator usually comes with an owner’s manual. Read it! The manual will tell you about further limitations (forexample, for angles when entering trigonometric functions) and perhaps how to overcome them. Program packages for microcomputers (even the most fundamental ones, which realize arithmetical operations and elementary functions) often suffer from hidden ﬂaws. You will be made aware of some of them in the following examples, and you are encouraged to experiment using the ideas presented here.Preliminary Experiments with your Calculator or Computer

To have a ﬁrst look at the limitations and quality of your calculator, make it compute 2 3. Of course, the answer is not a terminating decimal so it can’t be represented exactly on your calculator. If the last displayed digit is 6 rather than 7, then your calculator approximates 2 by truncating instead of rounding, so be prepared for slightly 3greater loss of accuracy in longer calculations. Now multiply the result by 3; that is, calculate 2 3 3. If the answer is 2, then subtract 2 from the result, thereby calculating 2 3 3 2. Instead of obtaining 0 as the answer, you might obtain a small negative number, which depends on the construction of the circuits. (The calculator keeps, in this case, a few “spare” digits that are remembered butnot shown.) This is all right because, as previously mentioned, the ﬁnite number of digits makes it impossible to represent 2 3 exactly. 2 A similar situation occurs when you calculate (s6 ) 6. If you do not obtain 0, the order of magnitude of the result will tell you how many digits the calculator uses internally. Next, try to compute 1 5 using the y x key. Many calculators will indicate an errorbecause they are built to attempt e 5 ln 1 . One way to overcome this is to use the fact that 1 k cos k whenever k is an integer. Calculators are usually constructed to operate in the decimal number system. In contrast, some microcomputer packages of arithmetical programs operate in a number system with base other than 10 (typically 2 or 16). Here the list of unwelcome tricks your device can playon you is even larger, since not all terminating decimal numbers are represented exactly. A recent implementation of the BASIC language shows (in double precision) examples of incorrect conversion from one number system into another, for example, 8 whereas 19 0.1 0.1
?

0.79999 99999 99999 9 1.90000 00000 00001

?

Yet another implementation, apparently free of the preceding anomalies, willnot calculate standard functions in double precision. For example, the number 4 tan 11, whose representation with sixteen decimal digits should be 3.14159 26535 89793, appears as 3.14159 29794 31152; this is off by more than

LIES MY CALCULATOR AND COMPUTER TOLD ME

x

3

3 10 7. What is worse, the cosine function is programmed so badly that its “cos” 0 1 2 23. (Can you invent asituation when this could ruin your calculations?) These or similar defects exist in other programming languages too.
The Perils of Subtraction

You might have observed that subtraction of two numbers that are close to each other is a tricky operation. The difﬁculty is similar to this thought exercise: Imagine that you walk blindfolded 100 steps forward and then turn around and walk 99 steps. Are you...