0

Possible Duplicate:
Extract real part of a complex expression better than Re does

I have an expression and I would like to find its real and imaginary parts. As a simplification, suppose the expression is $(a+bi)^2$ with $a,b\in\mathbb{R}.$

Of course

Re[(a + b I)^2]

does not work, since Mathematica doesn't know that $a$ and $b$ are real. So I tried

Assuming[Element[{a, b}, Reals], Re[(a + b I)^2]]

which also fails, even if I hit it with Simplify or FullSimplify. Then I thought that perhaps Re was impermeable to the simplification engine, so I expanded it first:

FullSimplify[Assuming[Element[{a, b}, Reals], Re[Expand[(a + b I)^2]]]]

This gives

Re(a^2-b^2)-2 Im(a b)

as the answer, which is closer but still maddeningly incomplete. (Either Mathematica doesn't know that the reals are closed under multiplication and addition or it doesn't know how to find the real or imaginary part of a real number.)

Is there a way I can better express my intentions to Mathematica?

Charles
  • 1,359
  • 8
  • 13

0 Answers0