Ask Your Question

Revision history [back]

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) 
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].

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) 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) 
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].

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;
((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].