# Factoring out complex exponentials

Hi, If I have an expression as follows $\frac{3}{8} {{E}_y^-}^{2} \overline{{E_y^+}} e^{\left(i \omega t + 3 i k x\right)} + \frac{3}{8} \, {{E}_y^-}^{2} \overline{{{E}_y^-}} e^{\left(i \omega t + i k x\right)} + \frac{3}{4} \, {{E}_y^-} {E_y^+} \overline{{E_y^+}} e^{\left(i \, \omega t + i \, k x\right)} + \frac{3}{4} \, {{E}_y^-} {E_y^+} \overline{{{E}_y^-}} e^{\left(i \omega t - i k x\right)} + \frac{3}{8} \, {E_y^+}^{2} \overline{{E_y^+}} e^{\left(i \, \omega t - i \, k x\right)} + \frac{3}{8} \, {E_y^+}^{2} \overline{{{E}_y^-}} e^{\left(i \omega t - 3 i k x\right)}$

How do I factor out a complex exponential $e^{i\omega t - ikx}$ from the expression above using a command?

edit retag close merge delete

Maybe: fc = e^(i*omega*t - i*k*x); f = ((f/fc).expand())*fc; f

( 2017-02-09 06:41:26 -0500 )edit

Sort by ยป oldest newest most voted

An example:

Let $$f = a e^{\left(i \omega t + 3 i k x\right)} + b_{1} e^{\left(i \omega t + i k x\right)} + b_{2} e^{\left(i \omega t + i k x\right)} + c_{1} e^{\left(i \omega t - i k x\right)} + c_{2} e^{\left(i \omega t - i k x\right)} + d e^{\left(i \omega t - 3 i k x\right)}.$$ Then

var('omega t k x a b1 b2 c1 c2 d ')
f = a*exp(I*omega*t+3*I*k*x) + b1*exp(I*omega*t+I*k*x) + b2*exp(I*omega*t+I*k*x) + c1*exp(I*omega*t-I*k*x) + c2*exp(I*omega*t-I*k*x) + d*exp(I*omega*t-3*I*k*x)
fc = exp(I*omega*t-I*k*x)
g = ((f/fc).expand())*fc


produces $$g = \left(a e^{\left(4 i k x\right)} + b_{1} e^{\left(2 i k x\right)} + b_{2} e^{\left(2 i k x\right)} + d e^{\left(-2 i k x\right)} + c_{1} + c_{2}\right) e^{\left(i \omega t - i k x\right)},$$ and we can recover the term inside the parentheses with g.operands()[0].

more