Simple math question about Sin, Cos, Tan

Started by
11 comments, last by LowRad 23 years, 8 months ago
If you''re in C/C++, use atan2(x,y). It automatically
deals with special cases like x=0 y=1, where
regular atan(t) causes a divide by 0 error or
returns NaN, inf, or some other floating point code.
I''m sure any other language you use will have a
similar function.
Advertisement
interestingly no-one seems to have mentioned that tan^-1 is how arctan is represented in mathematics.
[email=ehremo@hotmail.com][/email]
quote: Original post by remo

interestingly no-one seems to have mentioned that tan^-1 is how arctan is represented in mathematics.


Lets clear some things up here...

tan(x) to the POWER of -1 is 1/tan(x) - which is the same as cotan(x) - in mathematics.

tan(x) with -1 superscript in mathematics is the inverse of tan(x). Which is arctan(x) in C++.

Now, if you ever need to do stuff with a non-right angled triangle, you can use either the sine rule or cosine rule, dependant on which is more useful. (these both work with right angled triangles too)

this is where:

a,b, and c are lengths of the sides of the triange.

A, B and C are the angles opposite to its corresponding side. Doesnt matter what its measured in (degrees, radians or quadrants (sp?) if you're weird like that) as long as all they're all the same.

sine rule:

a/sin(A) = b/sin(B) = c/sin(C)


cosine rule:

a^2 = b^2 + c^2 - 2bc . cos(A)

or b^2 = a^2 + c^2 - 2ac . cos(B)

or c^2 = a^2 + b^2 - 2ab . cos(C)

Of course, all of these can be rearranged to whatever you need it to do.

jumble
-----------
Microsoft patents ones and zeroes - remind you of Hasbro?

Edited by - jumble on July 24, 2000 2:45:06 PM
jumble-----------

This topic is closed to new replies.

Advertisement