Trig Question: ACOS() formula problems
I read that the formula for calculating ACOS() is:
ACOS(X) = ATAN( -X / SQR( -X * X + 1) ) + 2 * ATAN(1)
Assuming: X = -0.985793f
I get two different values.
ACOS(X) = 2.97283 // Using ACOS() function.
ACOS(X) = 3.14078 // Using method described above.
Anybody know why that may be? I realize that some precision is lost when working with floats but this example amounts to roughly 9-degrees difference.
Am I misunderstanding this formula? I want to know because I like to know the method behind the madness of trigonometry...
Any assistance in this matter would be greatly appreciated.
Regards,
Jumpster
Semper Fi
Here are a few general observations that will come in handy:
1) 2 * arctan(1) = 2 * (pi / 4) = pi / 2
2) sin(-x) = -sin(x)
3) arccos(x) = (pi / 2) - arcsin(x)
Note how #1 and #3 combine to explain the last term in your formula. Also noteworthy is that #3 is defined over the interval -1 <= x <= 1 only.
Here's the tricky part for some people. The formula we want for arcsin(x) comes from Taylor series expansion:
arcsin(x) = x + ((x^3)/(2*3)) + ((3*x^5)/*(2*4*5)) + ...
You can look up Taylor series in a univariate Calculus book if you're curious to see how it works. The above expression simplifies down to the following power series:
(note n goes from 0 to positive infinity)
arcsin(x) = Σ ((2*n)!)*(x^((2*n)+1)) / ((2^n)*n!)*((2*n)+1)
Combine this with #3 and you're all set.
Edited by - Graylien on October 16, 2000 11:42:00 PM
1) 2 * arctan(1) = 2 * (pi / 4) = pi / 2
2) sin(-x) = -sin(x)
3) arccos(x) = (pi / 2) - arcsin(x)
Note how #1 and #3 combine to explain the last term in your formula. Also noteworthy is that #3 is defined over the interval -1 <= x <= 1 only.
Here's the tricky part for some people. The formula we want for arcsin(x) comes from Taylor series expansion:
arcsin(x) = x + ((x^3)/(2*3)) + ((3*x^5)/*(2*4*5)) + ...
You can look up Taylor series in a univariate Calculus book if you're curious to see how it works. The above expression simplifies down to the following power series:
(note n goes from 0 to positive infinity)
arcsin(x) = Σ ((2*n)!)*(x^((2*n)+1)) / ((2^n)*n!)*((2*n)+1)
Combine this with #3 and you're all set.
Edited by - Graylien on October 16, 2000 11:42:00 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement