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
AI Thread Summary
The discussion centers on the unexpected results from calculating the sine of multiples of 2π, particularly with the TI-84 calculator, which returns values like -4*10^-13 instead of the expected 0. This phenomenon is attributed to the calculator's use of 9-byte floating point numbers, which limits precision to 14 digits. As a result, calculations involving powers and factorials can lead to significant divergence from actual values due to rounding errors. In contrast, the TI-89 employs a computer algebra system (CAS) that enhances accuracy by optimizing calculations, such as recognizing multiples of π and returning exact values like 0, 1, or -1. The TI-89's arbitrary precision system allows it to store numbers more accurately than the TI-84, which contributes to the discrepancies observed in sine calculations.
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 came across a video regarding the use of AI/ML to work through complex datasets to determine complicated protein structures. It is a promising and beneficial use of AI/ML. AlphaFold - The Most Useful Thing AI Has Ever Done https://www.ebi.ac.uk/training/online/courses/alphafold/an-introductory-guide-to-its-strengths-and-limitations/what-is-alphafold/ https://en.wikipedia.org/wiki/AlphaFold https://deepmind.google/about/ Edit/update: The AlphaFold article in Nature John Jumper...
Thread 'Urgent: Physically repair - or bypass - power button on Asus laptop'
Asus Vivobook S14 flip. The power button is wrecked. Unable to turn it on AT ALL. We can get into how and why it got wrecked later, but suffice to say a kitchen knife was involved: These buttons do want to NOT come off, not like other lappies, where they can snap in and out. And they sure don't go back on. So, in the absence of a longer-term solution that might involve a replacement, is there any way I can activate the power button, like with a paperclip or wire or something? It looks...

Similar threads

Replies
6
Views
23K
Replies
8
Views
9K
Replies
6
Views
62K
Replies
5
Views
7K
Replies
1
Views
4K
Replies
5
Views
38K
Replies
1
Views
2K
Back
Top