Consider a simple trigonometric expression below :
(cos(x)+2)^6+(sin(y)+1)^4 Now following outputs were obtained from Mathematica 10
Expand[((1 + Sin[y])^2)^2 + ((2 + Cos[x])^3)^2] 65 + 192 Cos[x] + 240 Cos[x]^2 + 160 Cos[x]^3 + 60 Cos[x]^4 + 12 Cos[x]^5 + Cos[x]^6 + 4 Sin[y] + 6 Sin[y]^2 + 4 Sin[y]^3 + Sin[y]^4 Hence, as expected Expand multiplied out the products and positive integral powers in the highest level of the expression giving the above result.
However
TrigExpand[((1 + Sin[y])^2)^2 + ((2 + Cos[x])^3)^2] 3379/16 + (639 Cos[x])/2 + (4815 Cos[x]^2)/32 + (175 Cos[x]^3)/4 + ( 123 Cos[x]^4)/16 + (3 Cos[x]^5)/4 + Cos[x]^6/32 - (7 Cos[y]^2)/2 + Cos[y]^4/8 - (4815 Sin[x]^2)/32 - 525/4 Cos[x] Sin[x]^2 - 369/8 Cos[x]^2 Sin[x]^2 - 15/2 Cos[x]^3 Sin[x]^2 - 15/32 Cos[x]^4 Sin[x]^2 + (123 Sin[x]^4)/16 + 15/4 Cos[x] Sin[x]^4 + 15/32 Cos[x]^2 Sin[x]^4 - Sin[x]^6/32 + 7 Sin[y] - 3 Cos[y]^2 Sin[y] + (7 Sin[y]^2)/2 - 3/4 Cos[y]^2 Sin[y]^2 + Sin[y]^3 + Sin[y]^4/8 Mathematica documentation states the following about TrigExpand :
TrigExpand splits up sums and integer multiples that appear in arguments of trigonometric functions, and then expands out products of trigonometric functions into sums of powers, using trigonometric identities when possible.
However
- There were no products of trigonometric functions in the input above.
- The final output contains products of trigonometric functions.
What is the reason for this behavior?
SimplifyonTrigExpandand see what happens. $\endgroup$Expand) you have powers of trigs, e.g.Cos[x]^6. In the second (TrigExpand), afterSimplyfying it, there are harmonics, e.g.Cos[6 x]. So,TrigExpanddoes exactly what the docs say. Consider also a simpler example:Expand[Sin[x]^2 + Cos[x]^2]andTrigExpand[Sin[x]^2 + Cos[x]^2], as well as the first two examples forSimplifyin the docs. $\endgroup$TrigExpandencounters the input expression, and expands the exponents, it should see the output whichExpandgives. At that moment there are no multiple angles (e.g6x) in the argument of the trigonometric functions. So, ideally shouldn't it stop there ? What does it innovate to bring about a harmonic representation ? This begs the question, that doesTrigExpandtry to use identities to force a harmonic representation of an expression before producing the expansion and giving the final result ? Unfortunately, these intricacies are mentioned nowhere in my knowledge. $\endgroup$Expandworks on polynomials,TrigExpnduses trig properties. One can makeExpandwork on trigs by addingTrig -> True(also from the docs). $\endgroup$