x = Symbol('x', real=True)
Then you can use the functions re() and im(), or the method
.as_real_imag() to get the real and imaginary parts.
In [1]: x, y = symbols('x y', real=True)
In [2]: (x + I*y).as_real_imag()
Out[2]: (x, y)
In [3]: re(x + I*y)
Out[3]: x
In [4]: im(x + I*y)
Out[4]: y
Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to
> sympy+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>
What about re(1/(x+I*y))? It does not evaluate. Is there a function that I should call before re() so I have something with real denominator?
Aaron Meurer
Aaron Meurer