Imaginary part of expression too difficult to calculateFinding real and imaginary partsMathematica taking too long to calculate recursive functionComplex Plot with Imaginary Part encoded in colorGetting the real part of a expressionAbout Complex Numbers, Real part and Imaginary part (symbolic calculus)Bug in HypergeometricPFQRegularized?Equivalence of ComplexExpand and assuming real argumentsSummation of complex and complex conjugate - elimination of imaginary partHow to get the real part of a complex expressionRoots of an expression

The English Debate

Did Nintendo change its mind about 68000 SNES?

UK Tourist Visa- Enquiry

Would it be believable to defy demographics in a story?

Can "few" be used as a subject? If so, what is the rule?

TDE Master Key Rotation

How to remove space in section title at KOMA-Script

PTIJ: Which Dr. Seuss books should one obtain?

How are passwords stolen from companies if they only store hashes?

Why is this tree refusing to shed its dead leaves?

Print last inputted byte

Justification failure in beamer enumerate list

Friend wants my recommendation but I don't want to

Why does Surtur say that Thor is Asgard's doom?

CLI: Get information Ubuntu releases

What is the tangent at a sharp point on a curve?

What is it called when someone votes for an option that's not their first choice?

Knife as defense against stray dogs

Homology of the fiber

Imaginary part of expression too difficult to calculate

Is xar preinstalled on macOS?

Is a square zero matrix positive semidefinite?

When did hardware antialiasing start being available?

Turning a hard to access nut?



Imaginary part of expression too difficult to calculate


Finding real and imaginary partsMathematica taking too long to calculate recursive functionComplex Plot with Imaginary Part encoded in colorGetting the real part of a expressionAbout Complex Numbers, Real part and Imaginary part (symbolic calculus)Bug in HypergeometricPFQRegularized?Equivalence of ComplexExpand and assuming real argumentsSummation of complex and complex conjugate - elimination of imaginary partHow to get the real part of a complex expressionRoots of an expression













2












$begingroup$


I am trying to calculate the imaginary part of a long expression. It's a long enough expression that Mathematica "hangs" when you run:



imFUN2 = ComplexExpand[Im[expression]];


Is there something I can do that can help speed things up?



Here is my full code:



expression = -((I Ωc (4 γa^4 + 16 Δd^4 - 48 Δd^3 Δp + 48 Δd^2 Δp^2 - 16 Δd Δp^3 + 4 I γa^3 
(3 Δc + 6 Δd - 4 Δp - Δs) - 16 Δd^3 Δs + 32 Δd^2 Δp Δs - 16 Δd Δp^2 Δs - 4 Δd^2 Ωc^2 +
4 Δd Δp Ωc^2 + 4 Δd Δs Ωc^2 - 4 I dephasing Δd Ωd^2 + 12 Δd^2 Ωd^2 +
4 I dephasing Δp Ωd^2 - 24 Δd Δp Ωd^2 + 12 Δp^2 Ωd^2 - 8 Δd Δs Ωd^2 +
8 Δp Δs Ωd^2 - Ωc^2 Ωd^2 + Ωd^4 + 4 Δc^2 (4 Δd^2 - 4 Δd Δp + Ωd^2) -
2 γa^2 (4 Δc^2 + 26 Δd^2 + 10 Δp^2 + 2 Δc (13 Δd - 7 Δp - 2 Δs) +
6 Δp Δs - 2 Δd (18 Δp + 5 Δs) - Ωc^2 + 4 Ωd^2) + 4 Δc (8 Δd^3 - 4 Δd^2 (4 Δp + Δs) -
(4 Δp + Δs) Ωd^2 + Δd (8 Δp^2 + 4 Δp Δs - Ωc^2 + 4 Ωd^2)) - 2 I γa (24 Δd^3 +
4 Δc^2 (3 Δd - Δp) - 4 Δp^3 - 4 Δp^2 Δs - 4 Δd^2 (13 Δp + 4 Δs) + Δp Ωc^2 + Δs Ωc^2 -
2 I dephasing Ωd^2 - 10 Δp Ωd^2 - 3 Δs Ωd^2 + Δc (36 Δd^2 + 8 Δp^2 + 4 Δp Δs -
4 Δd (11 Δp + 3 Δs) - Ωc^2 + 7 Ωd^2) + Δd (32 Δp^2 + 20 Δp Δs - 3 Ωc^2 + 10 Ωd^2))))/
((γa + 2 I Δd) (2 γa^2 - 4 Δc^2 + 4 Δd Δp - 4 Δp^2 + 4 Δd Δs - 8 Δp Δs - 4 Δs^2 +
2 I γa (3 Δc + Δd - 3 (Δp + Δs)) + Δc (-4 Δd + 8 (Δp + Δs)) + Ωd^2) (4 I γa^3 (Δc - Δp) -
16 Δc^2 Δd Δp - 16 Δc Δd^2 Δp + 16 Δc^2 Δp^2 + 48 Δc Δd Δp^2 + 16 Δd^2 Δp^2 - 32 Δc Δp^3 -
32 Δd Δp^3 + 16 Δp^4 - 4 Δc Δd Ωc^2 - 4 Δd^2 Ωc^2 + 8 Δc Δp Ωc^2 + 8 Δd Δp Ωc^2 -
8 Δp^2 Ωc^2 + Ωc^4 - 4 Δc^2 Ωd^2 - 4 Δc Δd Ωd^2 + 8 Δc Δp Ωd^2 + 8 Δd Δp Ωd^2 -
8 Δp^2 Ωd^2 - 2 Ωc^2 Ωd^2 + Ωd^4 + 2 γa^2 (-4 Δc^2 - 6 Δc Δd + 14 Δc Δp + 6 Δd Δp -
10 Δp^2 + Ωc^2 + Ωd^2) - 2 I γa (4 Δc^2 (Δd - 3 Δp) - 4 Δd^2 Δp + Δd (20 Δp^2 -
3 Ωc^2 - Ωd^2) + Δc (4 Δd^2 - 24 Δd Δp + 28 Δp^2 - 3 Ωc^2 - Ωd^2) + 4 Δp (-4 Δp^2 +
Ωc^2 + Ωd^2)) + 2 dephasing (2 γa^3 + 2 I γa^2 (2 Δc + 3 Δd - 5 Δp) + γa (-4 Δd^2 -
4 Δc (Δd - 3 Δp) + 20 Δd Δp - 16 Δp^2 + Ωc^2 + Ωd^2) + 2 I (4 Δd^2 Δp - 8 Δd Δp^2 +
4 Δp^3 - Δp Ωc^2 + Δd Ωd^2 - Δp Ωd^2 + Δc (4 Δd Δp - 4 Δp^2 + Ωd^2)))))) /.
γa -> 1, dephasing -> 10^-4;

imFUN2 = ComplexExpand[Im[expression]];









share|improve this question











$endgroup$
















    2












    $begingroup$


    I am trying to calculate the imaginary part of a long expression. It's a long enough expression that Mathematica "hangs" when you run:



    imFUN2 = ComplexExpand[Im[expression]];


    Is there something I can do that can help speed things up?



    Here is my full code:



    expression = -((I Ωc (4 γa^4 + 16 Δd^4 - 48 Δd^3 Δp + 48 Δd^2 Δp^2 - 16 Δd Δp^3 + 4 I γa^3 
    (3 Δc + 6 Δd - 4 Δp - Δs) - 16 Δd^3 Δs + 32 Δd^2 Δp Δs - 16 Δd Δp^2 Δs - 4 Δd^2 Ωc^2 +
    4 Δd Δp Ωc^2 + 4 Δd Δs Ωc^2 - 4 I dephasing Δd Ωd^2 + 12 Δd^2 Ωd^2 +
    4 I dephasing Δp Ωd^2 - 24 Δd Δp Ωd^2 + 12 Δp^2 Ωd^2 - 8 Δd Δs Ωd^2 +
    8 Δp Δs Ωd^2 - Ωc^2 Ωd^2 + Ωd^4 + 4 Δc^2 (4 Δd^2 - 4 Δd Δp + Ωd^2) -
    2 γa^2 (4 Δc^2 + 26 Δd^2 + 10 Δp^2 + 2 Δc (13 Δd - 7 Δp - 2 Δs) +
    6 Δp Δs - 2 Δd (18 Δp + 5 Δs) - Ωc^2 + 4 Ωd^2) + 4 Δc (8 Δd^3 - 4 Δd^2 (4 Δp + Δs) -
    (4 Δp + Δs) Ωd^2 + Δd (8 Δp^2 + 4 Δp Δs - Ωc^2 + 4 Ωd^2)) - 2 I γa (24 Δd^3 +
    4 Δc^2 (3 Δd - Δp) - 4 Δp^3 - 4 Δp^2 Δs - 4 Δd^2 (13 Δp + 4 Δs) + Δp Ωc^2 + Δs Ωc^2 -
    2 I dephasing Ωd^2 - 10 Δp Ωd^2 - 3 Δs Ωd^2 + Δc (36 Δd^2 + 8 Δp^2 + 4 Δp Δs -
    4 Δd (11 Δp + 3 Δs) - Ωc^2 + 7 Ωd^2) + Δd (32 Δp^2 + 20 Δp Δs - 3 Ωc^2 + 10 Ωd^2))))/
    ((γa + 2 I Δd) (2 γa^2 - 4 Δc^2 + 4 Δd Δp - 4 Δp^2 + 4 Δd Δs - 8 Δp Δs - 4 Δs^2 +
    2 I γa (3 Δc + Δd - 3 (Δp + Δs)) + Δc (-4 Δd + 8 (Δp + Δs)) + Ωd^2) (4 I γa^3 (Δc - Δp) -
    16 Δc^2 Δd Δp - 16 Δc Δd^2 Δp + 16 Δc^2 Δp^2 + 48 Δc Δd Δp^2 + 16 Δd^2 Δp^2 - 32 Δc Δp^3 -
    32 Δd Δp^3 + 16 Δp^4 - 4 Δc Δd Ωc^2 - 4 Δd^2 Ωc^2 + 8 Δc Δp Ωc^2 + 8 Δd Δp Ωc^2 -
    8 Δp^2 Ωc^2 + Ωc^4 - 4 Δc^2 Ωd^2 - 4 Δc Δd Ωd^2 + 8 Δc Δp Ωd^2 + 8 Δd Δp Ωd^2 -
    8 Δp^2 Ωd^2 - 2 Ωc^2 Ωd^2 + Ωd^4 + 2 γa^2 (-4 Δc^2 - 6 Δc Δd + 14 Δc Δp + 6 Δd Δp -
    10 Δp^2 + Ωc^2 + Ωd^2) - 2 I γa (4 Δc^2 (Δd - 3 Δp) - 4 Δd^2 Δp + Δd (20 Δp^2 -
    3 Ωc^2 - Ωd^2) + Δc (4 Δd^2 - 24 Δd Δp + 28 Δp^2 - 3 Ωc^2 - Ωd^2) + 4 Δp (-4 Δp^2 +
    Ωc^2 + Ωd^2)) + 2 dephasing (2 γa^3 + 2 I γa^2 (2 Δc + 3 Δd - 5 Δp) + γa (-4 Δd^2 -
    4 Δc (Δd - 3 Δp) + 20 Δd Δp - 16 Δp^2 + Ωc^2 + Ωd^2) + 2 I (4 Δd^2 Δp - 8 Δd Δp^2 +
    4 Δp^3 - Δp Ωc^2 + Δd Ωd^2 - Δp Ωd^2 + Δc (4 Δd Δp - 4 Δp^2 + Ωd^2)))))) /.
    γa -> 1, dephasing -> 10^-4;

    imFUN2 = ComplexExpand[Im[expression]];









    share|improve this question











    $endgroup$














      2












      2








      2





      $begingroup$


      I am trying to calculate the imaginary part of a long expression. It's a long enough expression that Mathematica "hangs" when you run:



      imFUN2 = ComplexExpand[Im[expression]];


      Is there something I can do that can help speed things up?



      Here is my full code:



      expression = -((I Ωc (4 γa^4 + 16 Δd^4 - 48 Δd^3 Δp + 48 Δd^2 Δp^2 - 16 Δd Δp^3 + 4 I γa^3 
      (3 Δc + 6 Δd - 4 Δp - Δs) - 16 Δd^3 Δs + 32 Δd^2 Δp Δs - 16 Δd Δp^2 Δs - 4 Δd^2 Ωc^2 +
      4 Δd Δp Ωc^2 + 4 Δd Δs Ωc^2 - 4 I dephasing Δd Ωd^2 + 12 Δd^2 Ωd^2 +
      4 I dephasing Δp Ωd^2 - 24 Δd Δp Ωd^2 + 12 Δp^2 Ωd^2 - 8 Δd Δs Ωd^2 +
      8 Δp Δs Ωd^2 - Ωc^2 Ωd^2 + Ωd^4 + 4 Δc^2 (4 Δd^2 - 4 Δd Δp + Ωd^2) -
      2 γa^2 (4 Δc^2 + 26 Δd^2 + 10 Δp^2 + 2 Δc (13 Δd - 7 Δp - 2 Δs) +
      6 Δp Δs - 2 Δd (18 Δp + 5 Δs) - Ωc^2 + 4 Ωd^2) + 4 Δc (8 Δd^3 - 4 Δd^2 (4 Δp + Δs) -
      (4 Δp + Δs) Ωd^2 + Δd (8 Δp^2 + 4 Δp Δs - Ωc^2 + 4 Ωd^2)) - 2 I γa (24 Δd^3 +
      4 Δc^2 (3 Δd - Δp) - 4 Δp^3 - 4 Δp^2 Δs - 4 Δd^2 (13 Δp + 4 Δs) + Δp Ωc^2 + Δs Ωc^2 -
      2 I dephasing Ωd^2 - 10 Δp Ωd^2 - 3 Δs Ωd^2 + Δc (36 Δd^2 + 8 Δp^2 + 4 Δp Δs -
      4 Δd (11 Δp + 3 Δs) - Ωc^2 + 7 Ωd^2) + Δd (32 Δp^2 + 20 Δp Δs - 3 Ωc^2 + 10 Ωd^2))))/
      ((γa + 2 I Δd) (2 γa^2 - 4 Δc^2 + 4 Δd Δp - 4 Δp^2 + 4 Δd Δs - 8 Δp Δs - 4 Δs^2 +
      2 I γa (3 Δc + Δd - 3 (Δp + Δs)) + Δc (-4 Δd + 8 (Δp + Δs)) + Ωd^2) (4 I γa^3 (Δc - Δp) -
      16 Δc^2 Δd Δp - 16 Δc Δd^2 Δp + 16 Δc^2 Δp^2 + 48 Δc Δd Δp^2 + 16 Δd^2 Δp^2 - 32 Δc Δp^3 -
      32 Δd Δp^3 + 16 Δp^4 - 4 Δc Δd Ωc^2 - 4 Δd^2 Ωc^2 + 8 Δc Δp Ωc^2 + 8 Δd Δp Ωc^2 -
      8 Δp^2 Ωc^2 + Ωc^4 - 4 Δc^2 Ωd^2 - 4 Δc Δd Ωd^2 + 8 Δc Δp Ωd^2 + 8 Δd Δp Ωd^2 -
      8 Δp^2 Ωd^2 - 2 Ωc^2 Ωd^2 + Ωd^4 + 2 γa^2 (-4 Δc^2 - 6 Δc Δd + 14 Δc Δp + 6 Δd Δp -
      10 Δp^2 + Ωc^2 + Ωd^2) - 2 I γa (4 Δc^2 (Δd - 3 Δp) - 4 Δd^2 Δp + Δd (20 Δp^2 -
      3 Ωc^2 - Ωd^2) + Δc (4 Δd^2 - 24 Δd Δp + 28 Δp^2 - 3 Ωc^2 - Ωd^2) + 4 Δp (-4 Δp^2 +
      Ωc^2 + Ωd^2)) + 2 dephasing (2 γa^3 + 2 I γa^2 (2 Δc + 3 Δd - 5 Δp) + γa (-4 Δd^2 -
      4 Δc (Δd - 3 Δp) + 20 Δd Δp - 16 Δp^2 + Ωc^2 + Ωd^2) + 2 I (4 Δd^2 Δp - 8 Δd Δp^2 +
      4 Δp^3 - Δp Ωc^2 + Δd Ωd^2 - Δp Ωd^2 + Δc (4 Δd Δp - 4 Δp^2 + Ωd^2)))))) /.
      γa -> 1, dephasing -> 10^-4;

      imFUN2 = ComplexExpand[Im[expression]];









      share|improve this question











      $endgroup$




      I am trying to calculate the imaginary part of a long expression. It's a long enough expression that Mathematica "hangs" when you run:



      imFUN2 = ComplexExpand[Im[expression]];


      Is there something I can do that can help speed things up?



      Here is my full code:



      expression = -((I Ωc (4 γa^4 + 16 Δd^4 - 48 Δd^3 Δp + 48 Δd^2 Δp^2 - 16 Δd Δp^3 + 4 I γa^3 
      (3 Δc + 6 Δd - 4 Δp - Δs) - 16 Δd^3 Δs + 32 Δd^2 Δp Δs - 16 Δd Δp^2 Δs - 4 Δd^2 Ωc^2 +
      4 Δd Δp Ωc^2 + 4 Δd Δs Ωc^2 - 4 I dephasing Δd Ωd^2 + 12 Δd^2 Ωd^2 +
      4 I dephasing Δp Ωd^2 - 24 Δd Δp Ωd^2 + 12 Δp^2 Ωd^2 - 8 Δd Δs Ωd^2 +
      8 Δp Δs Ωd^2 - Ωc^2 Ωd^2 + Ωd^4 + 4 Δc^2 (4 Δd^2 - 4 Δd Δp + Ωd^2) -
      2 γa^2 (4 Δc^2 + 26 Δd^2 + 10 Δp^2 + 2 Δc (13 Δd - 7 Δp - 2 Δs) +
      6 Δp Δs - 2 Δd (18 Δp + 5 Δs) - Ωc^2 + 4 Ωd^2) + 4 Δc (8 Δd^3 - 4 Δd^2 (4 Δp + Δs) -
      (4 Δp + Δs) Ωd^2 + Δd (8 Δp^2 + 4 Δp Δs - Ωc^2 + 4 Ωd^2)) - 2 I γa (24 Δd^3 +
      4 Δc^2 (3 Δd - Δp) - 4 Δp^3 - 4 Δp^2 Δs - 4 Δd^2 (13 Δp + 4 Δs) + Δp Ωc^2 + Δs Ωc^2 -
      2 I dephasing Ωd^2 - 10 Δp Ωd^2 - 3 Δs Ωd^2 + Δc (36 Δd^2 + 8 Δp^2 + 4 Δp Δs -
      4 Δd (11 Δp + 3 Δs) - Ωc^2 + 7 Ωd^2) + Δd (32 Δp^2 + 20 Δp Δs - 3 Ωc^2 + 10 Ωd^2))))/
      ((γa + 2 I Δd) (2 γa^2 - 4 Δc^2 + 4 Δd Δp - 4 Δp^2 + 4 Δd Δs - 8 Δp Δs - 4 Δs^2 +
      2 I γa (3 Δc + Δd - 3 (Δp + Δs)) + Δc (-4 Δd + 8 (Δp + Δs)) + Ωd^2) (4 I γa^3 (Δc - Δp) -
      16 Δc^2 Δd Δp - 16 Δc Δd^2 Δp + 16 Δc^2 Δp^2 + 48 Δc Δd Δp^2 + 16 Δd^2 Δp^2 - 32 Δc Δp^3 -
      32 Δd Δp^3 + 16 Δp^4 - 4 Δc Δd Ωc^2 - 4 Δd^2 Ωc^2 + 8 Δc Δp Ωc^2 + 8 Δd Δp Ωc^2 -
      8 Δp^2 Ωc^2 + Ωc^4 - 4 Δc^2 Ωd^2 - 4 Δc Δd Ωd^2 + 8 Δc Δp Ωd^2 + 8 Δd Δp Ωd^2 -
      8 Δp^2 Ωd^2 - 2 Ωc^2 Ωd^2 + Ωd^4 + 2 γa^2 (-4 Δc^2 - 6 Δc Δd + 14 Δc Δp + 6 Δd Δp -
      10 Δp^2 + Ωc^2 + Ωd^2) - 2 I γa (4 Δc^2 (Δd - 3 Δp) - 4 Δd^2 Δp + Δd (20 Δp^2 -
      3 Ωc^2 - Ωd^2) + Δc (4 Δd^2 - 24 Δd Δp + 28 Δp^2 - 3 Ωc^2 - Ωd^2) + 4 Δp (-4 Δp^2 +
      Ωc^2 + Ωd^2)) + 2 dephasing (2 γa^3 + 2 I γa^2 (2 Δc + 3 Δd - 5 Δp) + γa (-4 Δd^2 -
      4 Δc (Δd - 3 Δp) + 20 Δd Δp - 16 Δp^2 + Ωc^2 + Ωd^2) + 2 I (4 Δd^2 Δp - 8 Δd Δp^2 +
      4 Δp^3 - Δp Ωc^2 + Δd Ωd^2 - Δp Ωd^2 + Δc (4 Δd Δp - 4 Δp^2 + Ωd^2)))))) /.
      γa -> 1, dephasing -> 10^-4;

      imFUN2 = ComplexExpand[Im[expression]];






      performance-tuning simplifying-expressions complex






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 3 hours ago









      MarcoB

      37.5k556113




      37.5k556113










      asked 4 hours ago









      Steven SagonaSteven Sagona

      1866




      1866




















          1 Answer
          1






          active

          oldest

          votes


















          5












          $begingroup$

          Not an elegant solution but it works



          num = Numerator[expression];
          den = Denominator[expression];
          reNum, imNum = ComplexExpand[ReIm[num]];
          reDen, imDen = ComplexExpand[ReIm[den]];
          (imNum reDen - reNum imDen)/(reDen^2 + imDen^2)


          I think the problem is the denominator which is huge but I am surprised that my approach is not included in ComplexExpand






          share|improve this answer









          $endgroup$












          • $begingroup$
            This works for me, thanks. It is interesting though that you call ComplexExpand[ReIm[num]] inside your function. I guess I should always make sure I don't have fractions-inside-fractions before calling this. Also for completion it might be helpful for others to know that the real part is: (reNum reDen + imNum imDen)/(reDen^2 + imDen^2)
            $endgroup$
            – Steven Sagona
            3 hours ago










          Your Answer





          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "387"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193509%2fimaginary-part-of-expression-too-difficult-to-calculate%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5












          $begingroup$

          Not an elegant solution but it works



          num = Numerator[expression];
          den = Denominator[expression];
          reNum, imNum = ComplexExpand[ReIm[num]];
          reDen, imDen = ComplexExpand[ReIm[den]];
          (imNum reDen - reNum imDen)/(reDen^2 + imDen^2)


          I think the problem is the denominator which is huge but I am surprised that my approach is not included in ComplexExpand






          share|improve this answer









          $endgroup$












          • $begingroup$
            This works for me, thanks. It is interesting though that you call ComplexExpand[ReIm[num]] inside your function. I guess I should always make sure I don't have fractions-inside-fractions before calling this. Also for completion it might be helpful for others to know that the real part is: (reNum reDen + imNum imDen)/(reDen^2 + imDen^2)
            $endgroup$
            – Steven Sagona
            3 hours ago















          5












          $begingroup$

          Not an elegant solution but it works



          num = Numerator[expression];
          den = Denominator[expression];
          reNum, imNum = ComplexExpand[ReIm[num]];
          reDen, imDen = ComplexExpand[ReIm[den]];
          (imNum reDen - reNum imDen)/(reDen^2 + imDen^2)


          I think the problem is the denominator which is huge but I am surprised that my approach is not included in ComplexExpand






          share|improve this answer









          $endgroup$












          • $begingroup$
            This works for me, thanks. It is interesting though that you call ComplexExpand[ReIm[num]] inside your function. I guess I should always make sure I don't have fractions-inside-fractions before calling this. Also for completion it might be helpful for others to know that the real part is: (reNum reDen + imNum imDen)/(reDen^2 + imDen^2)
            $endgroup$
            – Steven Sagona
            3 hours ago













          5












          5








          5





          $begingroup$

          Not an elegant solution but it works



          num = Numerator[expression];
          den = Denominator[expression];
          reNum, imNum = ComplexExpand[ReIm[num]];
          reDen, imDen = ComplexExpand[ReIm[den]];
          (imNum reDen - reNum imDen)/(reDen^2 + imDen^2)


          I think the problem is the denominator which is huge but I am surprised that my approach is not included in ComplexExpand






          share|improve this answer









          $endgroup$



          Not an elegant solution but it works



          num = Numerator[expression];
          den = Denominator[expression];
          reNum, imNum = ComplexExpand[ReIm[num]];
          reDen, imDen = ComplexExpand[ReIm[den]];
          (imNum reDen - reNum imDen)/(reDen^2 + imDen^2)


          I think the problem is the denominator which is huge but I am surprised that my approach is not included in ComplexExpand







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 3 hours ago









          HughHugh

          6,58421945




          6,58421945











          • $begingroup$
            This works for me, thanks. It is interesting though that you call ComplexExpand[ReIm[num]] inside your function. I guess I should always make sure I don't have fractions-inside-fractions before calling this. Also for completion it might be helpful for others to know that the real part is: (reNum reDen + imNum imDen)/(reDen^2 + imDen^2)
            $endgroup$
            – Steven Sagona
            3 hours ago
















          • $begingroup$
            This works for me, thanks. It is interesting though that you call ComplexExpand[ReIm[num]] inside your function. I guess I should always make sure I don't have fractions-inside-fractions before calling this. Also for completion it might be helpful for others to know that the real part is: (reNum reDen + imNum imDen)/(reDen^2 + imDen^2)
            $endgroup$
            – Steven Sagona
            3 hours ago















          $begingroup$
          This works for me, thanks. It is interesting though that you call ComplexExpand[ReIm[num]] inside your function. I guess I should always make sure I don't have fractions-inside-fractions before calling this. Also for completion it might be helpful for others to know that the real part is: (reNum reDen + imNum imDen)/(reDen^2 + imDen^2)
          $endgroup$
          – Steven Sagona
          3 hours ago




          $begingroup$
          This works for me, thanks. It is interesting though that you call ComplexExpand[ReIm[num]] inside your function. I guess I should always make sure I don't have fractions-inside-fractions before calling this. Also for completion it might be helpful for others to know that the real part is: (reNum reDen + imNum imDen)/(reDen^2 + imDen^2)
          $endgroup$
          – Steven Sagona
          3 hours ago

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Mathematica Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193509%2fimaginary-part-of-expression-too-difficult-to-calculate%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Are there any AGPL-style licences that require source code modifications to be public? Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Force derivative works to be publicAre there any GPL like licenses for Apple App Store?Do you violate the GPL if you provide source code that cannot be compiled?GPL - is it distribution to use libraries in an appliance loaned to customers?Distributing App for free which uses GPL'ed codeModifications of server software under GPL, with web/CLI interfaceDoes using an AGPLv3-licensed library prevent me from dual-licensing my own source code?Can I publish only select code under GPLv3 from a private project?Is there published precedent regarding the scope of covered work that uses AGPL software?If MIT licensed code links to GPL licensed code what should be the license of the resulting binary program?If I use a public API endpoint that has its source code licensed under AGPL in my app, do I need to disclose my source?

          2013 GY136 Descoberta | Órbita | Referências Menu de navegação«List Of Centaurs and Scattered-Disk Objects»«List of Known Trans-Neptunian Objects»

          Button changing it's text & action. Good or terrible? The 2019 Stack Overflow Developer Survey Results Are Inchanging text on user mouseoverShould certain functions be “hard to find” for powerusers to discover?Custom liking function - do I need user login?Using different checkbox style for different checkbox behaviorBest Practices: Save and Exit in Software UIInteraction with remote validated formMore efficient UI to progress the user through a complicated process?Designing a popup notice for a gameShould bulk-editing functions be hidden until a table row is selected, or is there a better solution?Is it bad practice to disable (replace) the context menu?