0

I have a problem understanding how Mathematica handles real values in complex numbers. E.g.

a \[Element] Reals;
b \[Element] Reals;
z = a + b I;
t = z^2 + Conjugate[z]

gives the somewhat unexpected answer

(a + I b)^2 + Conjugate[a] - I Conjugate[b]

while

t = z^2 + Conjugate[z] // ComplexExpand

gives the more 'correct'

a + a^2 - b^2 + I (-b + 2 a b)

I don't understand why Conjugate does not compute to a - b i in the first case.

Further,

Re[t]

does not give the expected

a + a^2 - b^2

but instead

-Im[-b + 2 a b] + Re[a + a^2 - b^2]

which I don't understand.

Is there someone that could kindly explain this to me, and perhaps link to some document that have 'exercises' in complex arithmetic using Mathematica that one could practise on? TIA.

mf67
  • 1,293
  • 7
  • 10

1 Answers1

4

a \[Element] Reals; has no effect. It evaluates a, checks to see if the result can be identified as real or not, yields True, False, or a \[Element] Reals (if it can't decide), and finally throws away the result using ;.

I suggest you look up ComplexExpand or Simplify with Assumptions.

John Doty
  • 13,712
  • 1
  • 22
  • 42