Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Calculators TI-84 multiples of 2-pi

  1. Jul 30, 2012 #1
    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.
  2. jcsd
  3. Jul 30, 2012 #2
    Something interesting, though. sin(10pi), sin(100pi), sin(1000pi) and so on give back 0.
  4. Jul 30, 2012 #3
    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.
  5. Aug 3, 2012 #4
    Why's it only for 84 though? 89 is fine, my cheap $10 scientific doesn't do that.
  6. Sep 12, 2012 #5
    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 realise 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!
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: TI-84 multiples of 2-pi
  1. TI-84 Problem (Replies: 1)