0
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ $cos x = c(x)$; $\cos 2x = 2c^2 - 1$; $\cos 3x = \cos2x \cos x - \sin2x \sin x = (2c^2-1)c - 2c(1-c^2)$; what's your problem with this? $\endgroup$ – Vinícius Ferraz Feb 19 '15 at 15:27
  • $\begingroup$ @ViníciusFerraz uh ... it is reverse? $\endgroup$ – the swine Feb 19 '15 at 15:28
1
$\begingroup$

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

$\endgroup$
  • $\begingroup$ Only real (says so in the question) :(. $\endgroup$ – the swine Feb 19 '15 at 15:01
  • $\begingroup$ Ah, that's real nice, thanks. $\endgroup$ – the swine Feb 19 '15 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.