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$

1 Answer 1

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$
2
  • $\begingroup$ Thanks. Why isn't any $a$ in your final solution? $\endgroup$
    – user67794
    Oct 8, 2019 at 23:53
  • 4
    $\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, 2019 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.