Say I enter the following code:

FullSimplify[Im[r*Exp[I*theta]^2 + (s + I*t)*Exp[I*theta]], 
  Element[theta | r | s | t, Reals]]

I expect to get:

2*r*Cos[theta]*Sin[theta] + s*Sin[theta] + t*Cos[theta]

But what Mathematica gives me is:

Im[Exp(I*theta)*(Exp(I*theta)*r + s + I*t)]

What's going on, why isn't Mathematica successfully using the assumptions to compute the imaginary part? When I take out any one of the three terms in the original expression, Mathematica successfully produces the simplified output.

  • 1
    $\begingroup$ The See Also section of the documentation for FullSimplify (as well as that for Simplify) includes a link to ComplexExpand $\endgroup$ – Bob Hanlon Dec 10 '17 at 2:48

If you use ComplexExpand

Simplify[ComplexExpand[Im[r*Exp[I*theta]^2 + (s + I*t)*Exp[I*theta]]]]

Mathematica graphics

I expect to get:

2*r*Cos[theta]Sin[theta] + sSin[theta] + t*Cos[theta]

It now agrees with what you expected

 (* 0 *)

On 11.1.

I think ComplexExpand does a little more than just assumptions on variables being real. It seems to do more special manipulations internally. That is why

Assuming[Element[{theta, r,s,t},Reals],

did not give same result as ComplexExpand. So when in doubt, use ComplexExpand.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.