I have a list with exponential terms. This terms depend of real and imaginary parameters, for example: $ e^{\gamma_1 +\gamma_2 +iw_1+iw_2}$, $ e^{\gamma_3 +\gamma_4 +iw_5+iw_6}$, Is there a way to select the imaginary terms of this expression, in this case the w parameters?


  • $\begingroup$ expr /. E^z_ :> ComplexExpand[Im[z]] $\endgroup$ – Bob Hanlon Mar 25 at 3:24

Will this do what you want?

{E^(g1+g2+I w1+I w2),E^(g3+g4+I w5+I w6)}/.E^(a_+b_+I c_+I d_):>c+d

which instantly returns

| improve this answer | |
  • $\begingroup$ but if I have terms of the form $e^{t (3g_1 + 4 g_2 - I (w_1 - 2w_2))}$ this instructions does not work. $\endgroup$ – Nico Mar 24 at 20:48
  • $\begingroup$ Im[{E^(g1+g2+I w1+I w2),E^(g3+g4+I w5+I w6)}/.E^(a_):>a], thanks so much $\endgroup$ – Nico Mar 24 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.