Comment #1 on issue 1595 by asmeurer: LambertW(-number) and sorted don't  
cooperate
http://code.google.com/p/sympy/issues/detail?id=1595

This is related to issue 1467.  sorted calls cmp, which calls  
StrictInequality.__nonzero__.  This ends up returning
Lambert(-10).evalf() < log(2).evalf().  Lambert(-10) is 1.36998096852127 +  
2.14019452707471*I, which cannot be
compared to the real log(2), so it keeps it as a StrictInequality class  
instead of returning a bool.

Even Python won't let you sort these numbers:

sorted([1.36998096852127 + 2.14019452707471j, 0.693147180559945])
TypeError: no ordering relation is defined for complex numbers

I think we would like to sort things somehow, but I do not know what the  
best way to do it is.  It is mathematically
impossible to define an ordering on complex numbers that satisfies basic  
inequality laws (like if a > b then a + c >
b + c), so any sorting rule would have to be something arbitrary that  
doesn't work for that.

smichr and I were talking on IRC about maybe defining some kind of sorting  
counter-clockwise around the complex
plane, with ties broken by a signed modulus, starting with the negative  
real axis (0 would come first).  This would
have the benefit of sorting real numbers and imaginary normally (except for  
0), but it would create a consistent way
to sort complex numbers.

--
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to