If you want an exact symbolic imaginary number, use sympy.I. For
instance, Rational(1, 2)*I (or just I/2) will give an exact number.
The reason you get 0.5*I above is that SymPy automatically evaluates
rational numbers to floats when you multiply them by a float. For
instance, Rational(1, 2)*1.0 gives 0.5. 1j is a Python floating point
complex number. They are always represented as floats, that is, 1j is
the same as 1.0j, so if you use it in a SymPy, it will act like float
would and cause things to evaluate to floats.
Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
sympy+un...@googlegroups.com.
> To post to this group, send email to
sy...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/sympy.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/sympy/758f1cbe-3a5a-4518-9155-2702dfa74838%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.