# select the imaginary part of an exponential term

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?

Thanks

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

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

{w1+w2,w5+w6}

• 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. – Nico Mar 24 at 20:48