0
$\begingroup$
exp=(E^(-(t/trMz)) (-Gr0 tr+coff1^2 Gr0 tr+Gr0 trMz-coff1^2 Gr0 trMz+2 coff1 Gr0 theta tr trMz wn-2 coff1^2 Gr0 theta tr trMz wn-2 coff1 Gr0 theta trMz^2 wn+2 coff1^2 Gr0 theta trMz^2 wn))/(Gr0Mz trMz (1-2 coff1 theta trMz wn+coff1^2 trMz^2 wn^2))+(I Sqrt[1-theta^2] (coff1 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta wn-2 coff1^2 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta wn+coff1^3 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta wn-coff1 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta wn+2 coff1^2 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta wn-coff1^3 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta wn-I coff1 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 Sqrt[1-theta^2] wn+I coff1^3 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 Sqrt[1-theta^2] wn-I coff1 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 Sqrt[1-theta^2] wn+I coff1^3 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 Sqrt[1-theta^2] wn-coff1^2 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 tr wn^2+coff1^4 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 tr wn^2+coff1^2 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 tr wn^2-coff1^4 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 tr wn^2+2 coff1^3 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta^2 tr wn^2-2 coff1^4 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta^2 tr wn^2-2 coff1^3 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta^2 tr wn^2+2 coff1^4 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta^2 tr wn^2+2 I coff1^3 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta Sqrt[1-theta^2] tr wn^2-2 I coff1^4 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta Sqrt[1-theta^2] tr wn^2+2 I coff1^3 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta Sqrt[1-theta^2] tr wn^2-2 I coff1^4 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta Sqrt[1-theta^2] tr wn^2+coff1^2 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 trMz wn^2-coff1^4 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 trMz wn^2-coff1^2 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 trMz wn^2+coff1^4 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 trMz wn^2-2 coff1^2 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta^2 trMz wn^2+2 coff1^3 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta^2 trMz wn^2+2 coff1^2 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta^2 trMz wn^2-2 coff1^3 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta^2 trMz wn^2+2 I coff1^2 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta Sqrt[1-theta^2] trMz wn^2-2 I coff1^3 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta Sqrt[1-theta^2] trMz wn^2+2 I coff1^2 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta Sqrt[1-theta^2] trMz wn^2-2 I coff1^3 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta Sqrt[1-theta^2] trMz wn^2+coff1^3 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta tr trMz wn^3-2 coff1^4 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta tr trMz wn^3+coff1^5 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 theta tr trMz wn^3-coff1^3 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta tr trMz wn^3+2 coff1^4 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta tr trMz wn^3-coff1^5 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 theta tr trMz wn^3-I coff1^3 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 Sqrt[1-theta^2] tr trMz wn^3+I coff1^5 E^(t (-coff1 theta wn-I coff1 Sqrt[1-theta^2] wn)) Gr0 Sqrt[1-theta^2] tr trMz wn^3-I coff1^3 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 Sqrt[1-theta^2] tr trMz wn^3+I coff1^5 E^(t (-coff1 theta wn+I coff1 Sqrt[1-theta^2] wn)) Gr0 Sqrt[1-theta^2] tr trMz wn^3))/(2 coff1 Gr0Mz (-1+theta^2) wn (1-2 coff1 theta trMz wn+coff1^2 trMz^2 wn^2))

I want to get the "I" coefficient. How to do?

$\endgroup$
  • $\begingroup$ If all of the variables are real: exp // Im // ComplexExpand[#, TargetFunctions -> {Re, Im}] & // Simplify $\endgroup$ – Bob Hanlon Jul 2 '18 at 0:42
1
$\begingroup$

Enter

ComplexExpand[exp]

and your expression will be evaluated considering all variables as real.

In order to obtain the imaginary part, Im[%]

$\endgroup$
  • $\begingroup$ If the variables that explicitly appear in the expression are real than this won't help. After the evaluation of ComplexExpand, Mathematica doesn't know anymore that you want the variables to be treated as real. Consider the difference between Im[ComplexExpand[a + I*b]] and ComplexExpand[Im[a + I*b]]. I assume the OP wants the latter, but I'm not sure. $\endgroup$ – halirutan Jul 1 '18 at 23:42
  • $\begingroup$ It will work. To answer your comment, you obtain respectively Im[a] + Re[b] and b. They are correct since Im is zero on any real number. $\endgroup$ – Ed 209 Jul 2 '18 at 15:04
0
$\begingroup$

While Im@ComplexExpand@exp does give you the imaginary part I also think your expression is wrong, as Im[exp] seems to be 0 for any numerical values I set.

First I extracted the symbols from the expression

sym = Cases[Level[exp, {-1}] // Union, _Symbol]

Then I set some test values:

exp /. {coff1 -> 0.2, Gr0 -> 100, Gr0Mz -> 100, theta -> 0.01, 
  tr -> 2, trMz -> 2, wn -> 50}
Plot[{Re[%], Im[%]}, {t, 0, 10}, PlotRange -> Full]

enter image description here

The imaginary plot only gives 0 for many test values I tried. Real part has boring decaying harmonic oscillations

I hope some of it helps.

$\endgroup$

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.