Thread: math.h library
View Single Post
  #19   Spotlight this post!  
Unread 07-01-2004, 00:16
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
inverse trig functions

i found another point of the taylor series to give arcsin.

arcsin(x)= x + (1/2)(x^3/3)+(1/2)(3/4)(x^5/5)+(1/2)(3/4)(5/6)(x^7/7)...

from this we can then derive both arc cos and arctan.

for arccos, use the first and most basic trig Identity:

sin^2(x)+cos^2(x)=1
sin^2(x)=1-cos^2(x)
sin(x)=sqrt(1-cos^2(x))

so just plug the cos value (now called c) into sqrt(1-c^2) then evaluate arcsin using taylor series with the value you pulled out of sqrt(1-c^2).

so arccos(x)=c+(1/2)(c^3/3)+(1/2)(3/4)(c^5/5)+(1/2)(3/4)(5/6)(c^7/7) where c=sqrt(1-cos^2(x)).

now for arctan. I used a triangle.

/|C
/ |
/ |
sqrt(x^2+1) / |
/ | x
/ |
/ |
/ |
A -------B
1

(if the triangle displays correctly, good for you, but if it doesn't, it is set up such that Leg AB is 1, Leg BC is x, angle B is 90 degrees, and hypotenuse AC is sqrt(x^2+1).)

therefore sin(A)=x/sqrt(x^2+1) and tan(A)=x/1=x
so then A=arcsin(x/sqrt(x^2+1)) and A=arctan(x)
therefore arctan(x)=arcsin(x/sqrt(x^2+1))

hope you have fun with this
-Kesich
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year