I am trying to get the real part of the result of an operation that includes an undefined variable (say x ).
How can I return Mathematica x when I execute Re[x] if I know that x will never be a complex number? I think this involves passing Mathematica that x is real, but I don't know how to do it.
In my case, the expression for which I want the real part is more complicated than a simple variable, but the concept will remain the same.
Some examples:
INPUT OUTPUT DESIRED RESULT ----- ------ -------------- Re[x] Re[x] x Re[1] 1 1 Re[Sin[x]] Re[Sin[x]] Sin[x] Re[1+x+I] 1 + Re[x] 1+x Re[1 + x*I] 1-Im[x] 1
source share