Comment #19 on issue 1467 by asmeurer: sorting values with imaginary  
numbers in radical
http://code.google.com/p/sympy/issues/detail?id=1467

OK, so I was looking for sorted([3, I]) instead of sorted([3, sqrt(I)]).   
Based on a quick git bisect, the second one
was fixed with this commit:

b3f7e6bbae92ee0cf7c286a7d26ce0df899e62c6 is first bad commit
commit b3f7e6bbae92ee0cf7c286a7d26ce0df899e62c6
Author: Chris Smith <smi...@gmail.com>
Date:   Fri Oct 16 08:32:59 2009 +0545

     1634: better comparisons and minor code edit

         == sympy\core\basic.py
            o Smarter comparison for relationals implemented:

              Here is an interesting example where one thing works
              and one doesn't, even though they are (to the human)
              almost the same:

                 In [124]: pi < 0
                 Out[124]: False

                 In [125]: pi > 0
                 Out[125]: -pi < 0

               pi<0 is recognized as a number comparison and goes to
               lt of numbers.py whereas -pi is an expression and calls
               up the basic.py lt routine.

               This patch makes the basic relational operators return
               a True or False if the sign of the quantities involved
               can be determined. This will result in more answers
               rather than restatments ('True" instead of "-pi < 0").

            o In as_coeff, "expr" was changed to "args" to avoid confusion

         == sympy\core\tests\test_basic.py
            test smarter relational tests

:040000 040000 271608692dfbe701891b5d540821080cf26b1923
6d2aed5dc2aab4e6febdbf980c3daab97c5106e5 M      sympy

Also, I didn't notice:

In [3]: 3<I
Out[3]: False

In [4]: I<3
Out[4]: False

So this is not as bad as before, though it leads to non-canonical results:

In [11]: sorted([sqrt(I), 3])
Out[11]:
⎡4 ⎽⎽⎽⎽   ⎤
⎣╲╱ -1 , 3⎦

In [12]: sorted([3, sqrt(I)])
Out[12]:
⎡   4 ⎽⎽⎽⎽⎤
⎣3, ╲╱ -1 ⎦

At any rate, this should be fixed:

In [7]: bool(x<y)
Out[7]: True

In [8]: bool(y<x)
Out[8]: False

Or at least make it so x<y isn't a Lt class (see above comment).

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
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