How do I tell Mathematica that a variable is a real number. I searched for this question here and in Google and nothing that was suggested seems to work for me. I must be missing something. My code is below, any help will be greatly appreciated.
Note: I restarted the kernel before executing this code.
The function Re does not work properly because it does not know x is a real number.
In[1]:= Re[x + I y]
Out[1]= -Im[y] + Re[x]
This does not work:
In[2]:= $Assumptions = {x \[Element] Reals, y \[Element] Reals};
Re[x + I y]
Out[3]= -Im[y] + Re[x]
This does not work either:
In[4]:= x > 0; y > 0;
Re[x + I y]
Out[5]= -Im[y] + Re[x]
And neither does this:
In[6]:= x = x2^2; y = y2^2;
Re[x + I y]
Out[7]= -Im[y2^2] + Re[x2^2]