Welcome! Log In Create A New Profile

Advanced

Sine Inaccuracy

Posted by g_man 
Sine Inaccuracy
September 02, 2009 06:55AM
Is it normall for sin(x) and cos(x) to be extreamly inaccurate.

I'm trying to use them in a program I'm making and something wasn't working, so i told the program to just print the values to screen. Compared to the values my Calculator gave me the wii answers were completly off.


I also made a quick sample program on windows, and they values were also off.

Wii: sin(25) = -0.132352
PC:sin(25) = -0.132352
Calc:sin(25) = 0.422618

Wii: cos(25) = 0.991203
PC: cos(25) = 0.991203
Calc: cos(25) = .906308

My calculator is the Texas Instruments TI-84 Plus

Is there a different function i can use, maybe from a different library. The results should just be the same.
Re: Sine Inaccuracy
September 02, 2009 07:00AM
what do they teach you kids these days in school!!!

they are all correct!

The Wii and the PC (and most all computers, coding languages and advanced calculators) are using radians (25 radians in your example).
The Calc is using degrees (25 degrees in your example).

so the sin of 25 degrees is .422618
the sin of 25 radians is -0.13235175


1 radian = (180/pi) degrees or 57.29577951... degrees

So to find the sin of 25 degrees on the wii you would need to do sin(25*pi/180) which gives .422618262....



edits: all this math and i can't spell worth crap!



Edited 5 time(s). Last edit at 09/02/2009 07:05AM by mdbrim.
Re: Sine Inaccuracy
September 02, 2009 01:05PM
Quote
mdbrim
what do they teach you kids these days in school!!!
they miss out radians in high school, they leave that for college in the uk, every teacher says what you learn in high school is a complete lie
Re: Sine Inaccuracy
September 02, 2009 05:08PM
Forgot about that I haven't learns anything about radians, I was told to just change my calc to degree mode.
Re: Sine Inaccuracy
September 03, 2009 02:01AM
sweet!!!

yeah that's another thing too, most calculators will let you tell it what you are going to be using and then you can just plug away!!!

It is easier to learn about degrees first because it is easier to visualize what a degree is (vs what a radian is) so they teach it in degrees... but as you do higher and higher level math, you'll learn that it is way more efficient and useful (in most applications) to use radians. Hence, most programming languages use radians.

Just wait until you find something that uses GRADIANS!
Re: Sine Inaccuracy
September 03, 2009 06:42PM
I bewt i'll start learning radians this year, pre-calc, Why is a radian useful anyway?
Re: Sine Inaccuracy
September 03, 2009 07:16PM
I guess because it's directly related to the constant number PI... 1 degree = PI/180 radian, thus 360 degree is simply 360*PI/180 = 2PI radian...

From a programmer's viewpoint it doesn't matter much... you need to deal with floating point numbers either way.

[en.wikipedia.org]
Re: Sine Inaccuracy
September 04, 2009 10:42AM
Quote
g_man
Why is a radian useful anyway?

Simply because if you want to calulate a function's derivative or integral you cannot use degrees and must convert to radians by the definitions of sine and cosine.

If you don't know what a derivative or an integral is, read about it here: [en.wikipedia.org] and here: [en.wikipedia.org].
Re: Sine Inaccuracy
September 05, 2009 04:39AM
Quote
Simply because if you want to calulate a function's derivative or integral you cannot use degrees and must convert to radians by the definitions of sine and cosine.

Not entirely true... it's just much SIMPLER to do it with radians... which is why it is preferred.

Not to turn this into a spirited math debate, but it's all about arc length... at one radian... the arc of the circle bounded by one radian is equal to the length of the radius.

as wiki says

"radians have a mathematical "naturalness" that leads to a more elegant formulation"

so, computer code likes it better too :D
Re: Sine Inaccuracy
September 05, 2009 11:04AM
@mdbrim: kk, you're right too!
Sorry, only registered users may post in this forum.

Click here to login