Calculators Why does the TI-84 give strange answers for sin of multiples of 2-pi?

  • Thread starter Thread starter johnqwertyful
  • Start date Start date
  • Tags Tags
    ti-84
Click For Summary
SUMMARY

The TI-84 calculator produces unexpected results for the sine of multiples of 2π, such as sin(6π) yielding -4*10^-13 instead of 0, due to its reliance on 9-byte floating point numbers which limit precision. In contrast, the TI-89 utilizes a computer algebra system (CAS) that enhances accuracy by employing shortcuts and precomputed values for common inputs. The divergence in results stems from the TI-84's power series expansion method, which accumulates errors when calculating sine for values close to multiples of π. Other calculators, including inexpensive scientific models, do not exhibit this issue due to different computational algorithms.

PREREQUISITES
  • Understanding of trigonometric functions, specifically sine and its properties.
  • Familiarity with floating point number representation and precision issues.
  • Knowledge of Taylor series and their application in mathematical computations.
  • Basic understanding of computer algebra systems (CAS) and their advantages over traditional calculators.
NEXT STEPS
  • Research the differences between floating point and arbitrary precision arithmetic in calculators.
  • Learn about the Taylor series and its role in approximating trigonometric functions.
  • Explore the algorithms used by the TI-89 and other CAS calculators for improved accuracy.
  • Investigate how different calculators handle mathematical constants like π in computations.
USEFUL FOR

Mathematicians, educators, students in advanced mathematics, and anyone interested in understanding calculator algorithms and precision in mathematical computations.

johnqwertyful
Messages
396
Reaction score
14
Something I've noticed that no one has ever been able to sufficiently explain to me is taking the sin of multiples of 2-pi.

Sin 6pi, 8pi, 12pi. You get silly answers. For example, sin(6pi) gives you -4*10^-13 instead of 0. I've never been able to get a satisfactory explanation. Most people say "that's weird, must be how it computes it or something". A teacher said something about precision.

Does anyone understand WHY it does this? Anything other than an 84 you get 0. Even my crappy $10 scientific calculators give back 0.
 
Computer science news on Phys.org
Something interesting, though. sin(10pi), sin(100pi), sin(1000pi) and so on give back 0.
 
If it uses a power series expansion of sin(x) to compute sin(x) then you'll get errors like this.
I have noticed that even Wolfram's Mathematica does this, albeit for slightly more complicated functions.
 
genericusrnme said:
If it uses a power series expansion of sin(x) to compute sin(x) then you'll get errors like this.
I have noticed that even Wolfram's Mathematica does this, albeit for slightly more complicated functions.

Why's it only for 84 though? 89 is fine, my cheap $10 scientific doesn't do that.
 
It depends on which algorithm is used, as mentioned before. Basically, the TI-84+ (and the other z80 models) use 9-byte Floating point numbers to do math. A number in the form of data will look like this, for example:

00 80 31 41 59 26 53 58 98

the first 00 tells several things, specifically whether the value is negative or positive and whether it is part of a complex number or not. (If it is complex, the following 9 bytes are the imaginary component, with the same format) The next part, the 80h tells where the exponent is located and what power of 10 is being used. If this were 7Fh, instead, it would read on the homescreen as .31415926535898, and if it were 81h, it would be read as 31.415926535898. Regardless, as you can see, there are precisely 14 digits of precision and this is all that the TI-OS uses for the z80 calculators. If you notice, the number I gave is an approximation of pi, and the last digit happens to be rounded up. Now, imagine if you square this number, or cube it, or raise it to the fourth, et cetera. You will realize that the value starts to diverge from the actual values of pi2, pi3, and so on, then it rapidly diverges. Now, pi was just an example. If you wanted great precision using a Taylor series, the calculator can only give as much as 14 digits of accuracy. However, you can see that having to raise a number by a power, then divide by an integer (a factorial, in the case of sine and cosine) can cause noticeable divergence from actual values.

So why does the TI-89 not have this issue? The TI-89 uses a different system of mathematics called a computer algebra system (CAS). Typically, these check for many shortcuts, such as modding anything in the sin() or cos() arguments by 2pi, thus lending much better accuracy to the result. Further, if it sees that you are simply using a multiple of pi or 2pi, it can easily return a precomputed value of 0, 1, or -1, accordingly. Further, the TI-89 does not use the 9-byte FP number format. In fact, it usually uses an arbitrary precision system (to an extent). This means it stores massive numbers digit for digit, instead of as 9.8E376, which has its own benefits and disadvantages that go beyond the scope of this topic.

I am not sure if I have only served to confuse you more, but I hope this is adequate!
 
I am having a hell of a time finding a good all-in-one inkjet printer. I must have gone through 5 Canon, 2 HP, one Brother, one Epson and two 4 X 6 photo printers in the last 7 yrs. all have all sort of problems. I don't even know where to start anymore. my price range is $180-$400, not exactly the cheapest ones. Mainly it's for my wife which is not exactly good in tech. most of the problem is the printers kept changing the way it operate. Must be from auto update. I cannot turn off the...

Similar threads

  • · Replies 6 ·
Replies
6
Views
24K
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
9K
  • · Replies 6 ·
Replies
6
Views
63K
  • · Replies 5 ·
Replies
5
Views
7K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 5 ·
Replies
5
Views
38K
Replies
22
Views
4K
  • · Replies 9 ·
Replies
9
Views
9K
  • · Replies 1 ·
Replies
1
Views
2K