Mathematica Asked on July 25, 2021
I have some enormous expression with many complex exponentials. Some of these are time varying, others are just phase terms. Here is a small piece of the expression that I hope fully captures the behavior of the full expression for the purposes of this question.
expr = 4 E^((6 I L w)/c + (4 I L wm)/c + 2 I t wm) E0^2 r1^2 +
4 E^((4 I L w)/c + (4 I L wm)/c - I t wm) E0^2 r1 r2 tr^2 +
4 E^((8 I L w)/c + (2 I L wm)/c + I t wm) E0^2 r1 r2 tr^2 +
4 E^((8 I L w)/c + (4 I L wm)/c + 2 I t wm) E0^2 r1 r2 tr^2
I would like to collect these expressions so that each oscillating frequency is factored out like so:
E^(-I t wm) (4 E^((8 I L w)/c + (2 I L wm)/c) E0^2 r1 r2 tr^2 +
4 E^((4 I L w)/c + (4 I L wm)/c) E0^2 r1 r2 tr^2) +
E^(2 I t wm) (4 E^((6 I L w)/c + (4 I L wm)/c) E0^2 r1^2 +
4 E^((8 I L w)/c + (4 I L wm)/c) E0^2 r1 r2 tr^2)
I can do this with Collect[expr, {E^(2 I t wm), E^(- I t wm)}]
just fine, but I have a lot of different frequencies and I don’t want to manually enumerate them. I guess I could try to extract them from the big expression, but I feel like I should be able to do this with just Collect
. I’ve tried the most obvious thing Collect[expr, E^(__ t)]
. But that doesn’t seem to work.
One approach is to turn your expression into a polynomial in a new variable, say z
expr2 = expr /. Exp[u_] :> Exp[(u /. t -> -I Log[z]/wm)]
(* (4 E^((4 I L w)/c + (4 I L wm)/c) E0^2 r1 r2 tr^2)/z +
4 E^((8 I L w)/c + (2 I L wm)/c) E0^2 r1 r2 tr^2 z +
4 E^((6 I L w)/c + (4 I L wm)/c) E0^2 r1^2 z^2 +
4 E^((8 I L w)/c + (4 I L wm)/c) E0^2 r1 r2 t z^2 *)
Some manipulations will be much simpler in this form
Collect[expr2, z, FullSimplify]
(* (4 E^((4 I L (w + wm))/c) E0^2 r1 r2 tr^2)/z +
4 E^((2 I L (4 w + wm))/c) E0^2 r1 r2 tr^2 z +
4 E^((2 I L (3 w + 2 wm))/c) E0^2 r1 (r1 + E^((2 I L w)/c) r2 t) z^2 *)
Substituting back to obtain the exponential form you seek is trivial.
Correct answer by mikado on July 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP