Skip to main content
Post Closed as "Duplicate" by Kuba
edited tags
Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751
Post Reopened by Kuba
Post Closed as "Not suitable for this site" by Bob Hanlon, LCarvalho, m_goldberg, Henrik Schumacher, Sektor
Source Link

Trouble getting Mathematica to assume some parameters are real and simplify the expression

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.