Cosine(A/3)

The cosine triple angle formula is: $$\cos (3\theta) = 4 \cos^3\theta - 3 \cos\theta.$$ This formula, of form $$y = 4 x^3 - 3 x$$, permits $$\cos (3\theta)$$ to be calculated if $$\cos\theta$$ is known.

If $$\cos (3\theta)$$ is known and the value of $$\cos\theta$$ is desired, this identity becomes: $$4 \cos^3\theta - 3 \cos\theta - \cos (3\theta) = 0.$$ $$\cos\theta$$ is the solution of this cubic equation.

In fact this equation has three solutions, the other two being $$\cos (\theta \pm 120^\circ).$$

$$\cos (3(\theta \pm 120^\circ)) = \cos (3\theta \pm 360^\circ) = \cos (3\theta).$$

Perhaps the simplest solution of the cubic equation with three real roots depends on the calculation of $$\cos \frac{A}{3}.$$ The two are mutually dependent.

This page contains a method for calculating $$\cos\theta$$ from $$\cos (3\theta)$$ that is not dependent on:


 * calculus,


 * the solution of a cubic equation, or


 * either value of $$\theta$$ or $$3\theta.$$

=Background=

The value $$\frac{1}{3}$$ can be approximated by the sequence $$\frac{1}{4} + \frac{1}{4^2} + \frac{1}{4^3} + \frac{1}{4^4} + \cdots$$

For example $$\frac{1}{4} + \frac{1}{4^2} + \frac{1}{4^3} + \cdots + \frac{1}{4^{20}}$$ equals $$0.33333333333303017\cdots$$

Testing with sequences of different lengths indicates that, if sequence contains $$N$$ terms, result is accurate to $$0.6 N$$ places of decimals.

In this example the sequence contains $$20$$ terms and result is accurate to $$12$$ places of decimals.

$$\cos \frac{A}{3} = \cos( A (\frac{1}{4} + \frac{1}{4^2} + \frac{1}{4^3} + \frac{1}{4^4} + \cdots) )$$ $$= \cos( \frac{A}{4} + \frac{A}{4^2} + \frac{A}{4^3} + \frac{A}{4^4} + \cdots )$$

=Implementation=

Result is accurate to about half the precision. For example, if precision is set to $$100,$$ result is accurate to approximately $$50$$ places of decimals, and is achieved with about 81 passes through loop.