Tuesday, 6 May 2014

calculus - Calculate cos(x/3) from sin(x) and cos(x)



I'm trying to solve some equations using extended precision arithmetics, and I don't have inverse trigonometric functions to simply calculate cos(arccos(cos(x))3). I do have (real) square / cube roots and powers.




I think that if I wanted cos(3x) from sin(x) and cos(x), this could be solved using Euler formula and binomial expansion easily.



However, since I want cos(x3) from sin(x) and cos(x) (the third angle instead of three angles), I think this will ultimately lead to solving a cubic equation. Is that so, or is there a simpler way how to calculate it?


Answer



If your program can do complex cube-roots, then (cosx+isinx)1/3=cos(x/3)+isin(x/3)
Unfortunately, the standard, Cardano solution to the cubic involves complex cube-roots whenever the three solutions are real. And they are real because they are cos(x/3),cos((x+2π)/3),cos((x2π)/3).
Otherwise, you could do Newton's Method to find the answer as precisely as you want.
I see you tagged it precalculus, so here is Newton's Method:
If y=cos(x/3), then 4y33y=cosx.
f(y)=4y33ycosxg(y)=12y23y0= anything, say y0=0y1=y0f(y0)/g(y0)y2=y1f(y1)/g(y1)y3=y2f(y2)/g(y2)

and continue until yn settles down. Which it should settle down pretty quickly


No comments:

Post a Comment

real analysis - How to find limhrightarrow0fracsin(ha)h

How to find lim without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...