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

  • Context: Calculators 
  • Thread starter Thread starter johnqwertyful
  • Start date Start date
  • Tags Tags
    ti-84
Click For Summary

Discussion Overview

The discussion revolves around the behavior of the TI-84 calculator when computing the sine of multiples of 2-pi, particularly focusing on why it returns values like -4*10^-13 instead of 0, which is expected. The scope includes technical explanations related to numerical precision and algorithm differences between calculators.

Discussion Character

  • Technical explanation, Debate/contested

Main Points Raised

  • One participant notes that sin(6pi), sin(8pi), and sin(12pi) yield unexpected results, suggesting that the TI-84's computation method may be responsible for this discrepancy.
  • Another participant observes that sin(10pi), sin(100pi), and sin(1000pi) return 0, indicating variability in results based on the specific multiple of pi used.
  • Some participants propose that the TI-84 may use a power series expansion to compute sine, which could introduce errors due to numerical precision limitations.
  • A participant explains that the TI-84 uses 9-byte floating point numbers for calculations, which may lead to divergence from actual values when performing operations like squaring or cubing approximations of pi.
  • It is mentioned that the TI-89 calculator does not exhibit the same issue, as it employs a computer algebra system (CAS) that can handle such computations more accurately by recognizing multiples of pi or 2pi.
  • Participants discuss the differences in numerical representation and precision between the TI-84 and TI-89, highlighting the impact on the accuracy of trigonometric calculations.

Areas of Agreement / Disagreement

Participants express differing views on the reasons behind the TI-84's behavior, with some attributing it to the calculator's algorithm and numerical representation, while others note that different calculators yield different results. The discussion remains unresolved regarding the exact cause of the discrepancies.

Contextual Notes

Limitations include the dependence on the specific algorithms used by different calculators and the inherent precision limits of floating point representations. The discussion does not resolve the mathematical steps involved in the 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!
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
24K
Replies
4
Views
3K
  • · 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
39K
Replies
22
Views
4K
  • · Replies 9 ·
Replies
9
Views
9K
  • · Replies 1 ·
Replies
1
Views
2K