4
$\begingroup$

I need to obtain the real and imaginary parts of the below expression with Mathematica:

$(- i a - m^2) \ln(\frac{i m^2}{2 a})$,

where $a$ and $m$ are real.

So we have:

Refine[Re[(-I a - m^2) Log[(I m^2)/(2 a)]], {Element[a, Reals], Element[m, Reals]}]

However, Mathematica returns the command again. How can I proceed?

$\endgroup$
6
$\begingroup$

Use ComplexExpand and then Simplify:

Simplify[ComplexExpand[ReIm[(-I a - m^2) Log[(I m^2)/(2 a)]]], a > 0]
Simplify[ComplexExpand[ReIm[(-I a - m^2) Log[(I m^2)/(2 a)]]], a < 0]

{(a π)/2 - m^2 Log[1/(2 a)] - m^2 Log[m^2], -((m^2 π)/2) - a Log[1/(2 a)] - a Log[m^2]}

{-((a π)/2) - m^2 Log[-(1/(2 a))] - m^2 Log[m^2], (m^2 π)/2 - a Log[-(1/(2 a))] - a Log[m^2]}

An alternative, as Bob Hanlon mentions, is to use ComplexExpand with the option TargetFunctions->{Re, Im}

$\endgroup$
  • $\begingroup$ Thanks. Why isn't any $a$ in your final solution? $\endgroup$ – user67794 Oct 8 at 23:53
  • 3
    $\begingroup$ @Carl appears to have set a = 2. For arbitrary a use ComplexExpand[ReIm[(-I a - m^2) Log[(I m^2)/(2 a)]], TargetFunctions -> {Re, Im}] $\endgroup$ – Bob Hanlon Oct 9 at 0:23

Your Answer

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