I'm trying to solve some equations using extended precision arithmetics, and I don't have inverse trigonometric functions to simply calculate $\cos\left(\frac{\arccos(\cos(x))}{3}\right)$. 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\left(\frac{x}{3}\right)$ 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 $(\cos x+i\sin x)^{1/3}=\cos(x/3)+i\sin(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\pi)/3),\cos((x-2\pi)/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 $4y^3-3y=\cos x$.
$$\begin{eqnarray}f(y)&=&4y^3-3y-\cos x\\
g(y)&=&12y^2-3\\
y_0&=&\text{ anything, say }y_0=0\\
y_1&=&y_0-f(y_0)/g(y_0)\\
y_2&=&y_1-f(y_1)/g(y_1)\\
y_3&=&y_2-f(y_2)/g(y_2)\end{eqnarray}$$
and continue until $y_n$ settles down. Which it should settle down pretty quickly
No comments:
Post a Comment