1
$\begingroup$

I see no problem with following calculation.

Refine[ComplexExpand[b I /(a + b I)], {Element[a, Reals], Element[b, Reals]}]
(I a b)/(a^2 + b^2) + b^2/(a^2 + b^2)

The real and imaginary parts are nicely separated.

However, the next calculations are confusing to me. Please explain how I get the output. Should I get

b^2/(a^2 + b^2) 

as I declared a and b are real?

Refine[
  Re[(I a b)/(a^2 + b^2) + b^2/(a^2 + b^2)], {Element[a, Reals], Element[b, Reals]}]
-a b Im[1/(a^2 + b^2)] + b^2 Re[1/(a^2 + b^2)]
$\endgroup$
1
$\begingroup$

You must also tell Mathematica that a^2 + b^2 is not zero.

Refine[
  Re[(I a b)/(a^2 + b^2) + b^2/(a^2 + b^2)], {a, b} ∈ Reals && a^2 + b^2 > 0]
b^2/(a^2 + b^2)
$\endgroup$
  • $\begingroup$ If a^2 +b^2 is zero, the outputs are also not valid. The 'ComplexExpand[]' function behave as I expected. The 'Re[]' function seems weird to me, still. The 'Im[1/(a^2 + b^2)]' is always zero if a and b are real provided nonzero a^2 +b^2 . $\endgroup$ – Cookie Monster Jul 3 '18 at 7:50

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.