Learning maths. Sin/Cos/Tan question.

Started by
7 comments, last by Evil Steve 16 years, 4 months ago
I've been teaching myself maths over the last year or so and thorougly enjoying it, with a view to bettering my understanding of game programming. I'm moving onto the book Trigonometry & Geometry for Calculus having finished the Practical Algebra book. My question relates to the usage of the Trigonometric functions, should I understand what is going on under the hood of these functions (i'm kind of intrigued as to what they are doing)? I use them to solve lots of problems - but I really do not have a clue what they are doing and I am struggling to visualise it? Is this because those functions are relative to calculus (I have not yet tackled calculus, but all in good time I guess)? Thanks again for your help.
Advertisement
I presume you haven't covered SOH CAH TOA in school yet?

Sin X = Opposite / Hypotenuse
Cos X = Adjacent / Hypotenuse
Tan X = Opposite / Adjacent

Where X is the angle, and Opposite, Adjacent and Hypotenuse are the three sides of a triangle. E.g.:
Hypotenuse|   +v  /|  / | Opposite /  |/X__+Adjacent

So if you have a triangle with angles 45 degrees, 90 degrees and 45 degrees, X = 45, Adjacent = Opposite = 1, Hypotenuse = sqrt(2), so:
Sin(x) = Opposite / Hypotenuse
Sin(45) = 1 / sqrt(2)
Gives you Sin(45) = 0.707...


I fail miserably at explaining these things, unfortunately [smile] It's important to know what they are, and not just magic functions. You'll cover them in Higher maths (And advanced higher / CSYS / whatever they are now if you choose to do that), and possibly touch on them at some point in Standard Grade.

[Edited by - Evil Steve on December 10, 2007 7:17:04 AM]
Sorry if my explanation sucked, I'm fully aware of the basics in working out how to manipulate and use the appropriate soh cah toa.

My question was actually regarding what the *actual functions* sin/tan/cos are doing 'under the hood' with the trignometric ratios that are passed in and if that was only understandble from the perspective of having understood calculus, then fair enough.. just take the functions for granted..?

I understand that we aquire the appropriate sides to work out the trig ratio for a given angle, but lets say I did not have sin/cos/tan calculator to hand, how would I work it out then (not that it's probably advised)? :)
Ah, I see. The Taylor Series is usually used by the implementation of these functions, although there may be a better way to work these out on paper.
I think you're reading worrying too much about nothing.
Having taking and passed all the calculus in college you need to be a programmer you really don't need anything more than memorize the unit circle and sin,cos,tan of 0,30,45,90 for everything.
I guess you could guesstimate it from your sin,cos,tan graphs which you should become a pro making.
Also your calc book might have some cool series that approximate tan,etc but they are too tedious and slow converging to be useful by hand.
In the old days before calculators they used slide rules from what I hear.

Many calculators use something called CORDIC ,which you won't learn in calculus, to internally calculate trig values.
[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
The computational side of this was discussed not long ago in this thread. Mathematicians treat the situation differently, using function identities and such right up until it is necessary to evaluate the answer (if ever), when they use a calculator [rolleyes].

Before calculators people would use a log-book, which is just pages and pages of lookup tables for common irrational functions. The values in these books were initially determined through painstaking manual evaluation of cleverly-crafted truncated series, presumably by monks or scholars. I'm guessing this isn't quite the 'under the hood' you were looking for, but the point is that there's no easy way to evaluate these with any accuracy, and no way to do it exactly, in general.
Ring3 Circus - Diary of a programmer, journal of a hacker.
Interesting replies guys, thanks for pointing me in the right direction.

I always wandered why we should just 'assume' accuracy with those functions when being taught basic math concepts without actually knowing their implementation (for the none the wiser like me, hehe).

A quick way to visualize the relations is by using http://en.wikipedia.org/wiki/Unit_circle and the Pythagorean theorem.

Small typo for Evil Steve's explanation:
sine = opposite / hypotenuse

And for application in game realm you might want to look at inverse sqrt next, as it seems to creep up at most rendering calculations (most famous is Carmack's inverse square, although he didn't think of it first, he used a famous magic number that allows for computation of 1/sqrt in 2 steps, way fast).


Quote:Original post by ttdeath
A quick way to visualize the relations is by using http://en.wikipedia.org/wiki/Unit_circle and the Pythagorean theorem.

Small typo for Evil Steve's explanation:
sine = opposite / hypotenuse
Whoops, good point. Fixed now.

This topic is closed to new replies.

Advertisement