Comment #4 on issue 2625 by matt...@gmail.com: Imaginary unit in R, ordering of complex numbers
http://code.google.com/p/sympy/issues/detail?id=2625

Just to note this: we use the following ordering when sorting expressions (involving imaginary unit):

In [1]: sorted([2 + 3*I, 2 + I, I, -I, 3, -I + 1, 2*I, -1], key=lambda x: sympify(x).sort_key())
Out[1]: [-1, 3, -ⅈ, ⅈ, 2⋅ⅈ, 1 - ⅈ, 2 + ⅈ, 2 + 3⋅ⅈ]

Reals come first (natural order), then complexes are ordered by (re(z), im(z)). This ordering is used by (for example) by functions that return roots of polynomials:

In [2]: roots((x - 1)*(x + 2)*x*(x - 1 + I)*(x - 1 - I)*(x + I), x, multiple=True)
Out[2]: [-2, 0, 1, -ⅈ, 1 - ⅈ, 1 + ⅈ]

But that doesn't imply that < and > have to work on complexes.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to