# Complex Exponentials to Trig Functions?

I have an expression

expr = 1/2 a E^(-3 I ω t) (E^(3 I ω t)+2 Cos[π x/a]) (1+2 E^(3 I ω t) Cos[π x/a]) Sin[π x/a]^2;
expr // TeXForm


$$\frac{1}{2} a e^{-3 i t \omega } \sin ^2\left(\frac{\pi x}{a}\right) \left(2 \cos \left(\frac{\pi x}{a}\right)+e^{3 i t \omega }\right) \left(1+2 e^{3 i t \omega } \cos \left(\frac{\pi x}{a}\right)\right)$$

It is in complex exponential form, and I need it in trigonometric form. How do I do this? I see that in the Wolfram Language (https://reference.wolfram.com/language/guide/ComplexNumbers.html) there is a function for it, but I do not seem to be able to use that, for when I enter it as an argument, nothing changes. I am using Mathematica 11.3. How would I go about getting this into trigonometric form?

• it looks like you need to add SPACE between some letter. As in Pi x and not Pix and same for Iwt try with I w t. There is also a function call TrigToExp you can try. SPACE is important in Mathematica, unlike in Latex (most of the time). So Pix is not the same as Pi x which internally becomes Pi*x. I actually prefer to write explicit * and not use SPACE. For me, it is more clear and also this way I do not make the same mistake as you did by accident. – Nasser May 7 '19 at 23:01

expr = 1/2 a E^(-3 I ω t) (E^(3 I ω t)+2 Cos[π x/a]) (1+2 E^(3 I ω t) Cos[π x/a]) Sin[π x/a]^2;

$$\frac{1}{2} a \sin ^2\left(\frac{\pi x}{a}\right) (\cos (3 t \omega )-i \sin (3 t \omega )) \left(2 \cos \left(\frac{\pi x}{a}\right)+i \sin (3 t \omega )+\cos (3 t \omega )\right) \left(2 \cos \left(\frac{\pi x}{a}\right) \cos (3 t \omega )+2 i \cos \left(\frac{\pi x}{a}\right) \sin (3 t \omega )+1\right)$$
• expr // ExpToTrig // FullSimplify will provide a cleaner form. – Bob Hanlon May 8 '19 at 3:43