I want to expand the following expression into powers of $\cos(u)$ only:
a1 + a2 Cos[2 u] + a3 Cos[4 u] + a4 Cos[6 u]
The answer that I want (and which I found by hand) is :
(a1 + a3 - a2 - a4) + (2 a2 - 8 a3 + 18 a4) Cos[u]^2 + (8 a3 - 48 a4) Cos[u]^4 + (32 a4) Cos[u]^6
As you see it contains only powers of $\cos (u)$.
But when I use the TrigExpand
, which is supposed to simplify the expression into powers of trigonometric functions, it gives this:
1 + a2 Cos[u]^2 + a3 Cos[u]^4 + a4 Cos[u]^6 - a2 Sin[u]^2 - 6 a3 Cos[u]^2 Sin[u]^2
- 15 a4 Cos[u]^4 Sin[u]^2 + a3 Sin[u]^4 + 15 a4 Cos[u]^2 Sin[u]^4 - a4 Sin[u]^6
Is it possible to make TrigExpand
to simplify only in terms of $\cos (u)$ or $\sin (u)$? (or maybe using another command instead of TrigExpand
)
By the way, It is my first work done in Mathematica.
TrigExpand
withPolynomialReduce
in order to exchange one trig in favor of the other.In[8]:= PolynomialReduce[TrigExpand[expr], Sin[u]^2 + Cos[u]^2 - 1, Cos[u]][[2]] Out[8]= a1 + a2 + a3 + a4 - 2 a2 Sin[u]^2 - 8 a3 Sin[u]^2 - 18 a4 Sin[u]^2 + 8 a3 Sin[u]^4 + 48 a4 Sin[u]^4 - 32 a4 Sin[u]^6
$\endgroup$