# Sine Inaccuracy

Posted by g_man
 g_man Sine Inaccuracy September 02, 2009 06:55AM Registered: 12 years agoPosts: 444
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.
 mdbrim Re: Sine Inaccuracy September 02, 2009 07:00AM Registered: 12 years agoPosts: 552
what do they teach you kids these days in school!!!

they are all correct!

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.
 SteelSLasher Re: Sine Inaccuracy September 02, 2009 01:05PM Registered: 13 years agoPosts: 405
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
 g_man Re: Sine Inaccuracy September 02, 2009 05:08PM Registered: 12 years agoPosts: 444
Forgot about that I haven't learns anything about radians, I was told to just change my calc to degree mode.
 mdbrim Re: Sine Inaccuracy September 03, 2009 02:01AM Registered: 12 years agoPosts: 552
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!
 g_man Re: Sine Inaccuracy September 03, 2009 06:42PM Registered: 12 years agoPosts: 444
I bewt i'll start learning radians this year, pre-calc, Why is a radian useful anyway?
 I.R.on Re: Sine Inaccuracy September 03, 2009 07:16PM Registered: 12 years agoPosts: 116
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]
 profetylen Re: Sine Inaccuracy September 04, 2009 10:42AM Registered: 13 years agoPosts: 384
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].
 mdbrim Re: Sine Inaccuracy September 05, 2009 04:39AM Registered: 12 years agoPosts: 552
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
 profetylen Re: Sine Inaccuracy September 05, 2009 11:04AM Registered: 13 years agoPosts: 384
@mdbrim: kk, you're right too!
Sorry, only registered users may post in this forum.