Sign in to follow this  

how does SIN and COSINE work?

This topic is 4560 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Do you mean, what do they do as mathematical functions... or how are sines and cosines computed on computer hardware?

Share this post


Link to post
Share on other sites
Mathematically its related to the exponential function in complex (you know "i = sqrt(-1)") space.

Look up eulers "e" function.

where e^(i*theta) generates the unit circle when turned 2pi degrees.

e^(i*theta) - e^(-i*theta)
--------------------------
2i

I believe is the function for sin. Just take the derivitive with respect to theta to get cos.

(http://en.wikipedia.org/wiki/Cosine)

[Edited by - c0dedrag0n on June 24, 2005 1:46:57 PM]

Share this post


Link to post
Share on other sites
Mathematically, their infinite series definition is often used as the primary definition for determining various properties about them. The computation is often done using Taylor series or look-up tables. I don't know all the specifics, especially regarding which methods are most typically used, but I'm sure those Wikipedia articles will reveal a lot.

Share this post


Link to post
Share on other sites
Mmm, since your website states you're 14, maybe a more basic explanation is in order. (I don't know how good education is in Norway, though :-) )
Sine and cosine (and tangent too) basically are the ratios of the sides of a triangle:

+
/|
H / | O
/ |
/a |
+----+
A

The angle a is (almost completely) defined by the lengths of the sides. (Imagine moving the upmost point around). The sine of the angle a in this triangle is the length O divided by H. The cosine is A divided by H. The tangent of a is O divided by A.
So, what's the use? Say we know the left-bottom point of the triangle is (0,0) and the upmost point is (3,4). Now we now that A=3 and O=4, giving tan a=4/3. On most calculators you have a button called tan-1 or atan. Using this we can now found the angle that corresponds to our tan a of 4/3. My calculator says the angle is 53 degrees.
Et voila, now you can convert coordinates on screen or in your game world into angles: something you will do quite often.
Of course, as stated above, sine and cosine are used in tons of other calculations. But that's something for another day, I guess.

Share this post


Link to post
Share on other sites
Draw a circle, make the radius equal to 1.
Go ahead, get a piece of paper and actually draw it.
Draw a horizontal line through the center of the circle.
Draw another line from the center of the circle to any point on the circle.

Look at the angle between the two lines. We'll call it "theta".
Now look at the point where the second line touches the circle.
The horizontal distance from the center of the circle to this point is called "cosine theta".
The vertical distance is called "sine theta".

That's the basics. It gets more complicated from there. It turns out that cosine and sine have some really useful practical properties.

Share this post


Link to post
Share on other sites

This topic is 4560 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this