#14088: Comparison of python and sage complex numbers
--------------------------------+-------------------------------------------
   Reporter:  tscrim            |             Owner:  tscrim  
       Type:  defect            |            Status:  new     
   Priority:  major             |         Milestone:  sage-5.7
  Component:  basic arithmetic  |          Keywords:          
Work issues:                    |   Report Upstream:  N/A     
  Reviewers:                    |           Authors:          
  Merged in:                    |      Dependencies:          
   Stopgaps:                    |  
--------------------------------+-------------------------------------------
 We have the following behavior:
 {{{
 sage: complex('inf')
 (inf+0j)
 sage: CC(oo)
 +infinity

 sage: complex('inf') < complex(0) # This is good
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 <ipython-input-84-743f29f99a3c> in <module>()
 ----> 1 complex('inf') < complex(Integer(0))

 TypeError: no ordering relation is defined for complex numbers

 sage: complex('inf') < float(0) # Still good
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 <ipython-input-85-ec0c40060e5d> in <module>()
 ----> 1 complex('inf') < float(Integer(0))

 TypeError: no ordering relation is defined for complex numbers

 # These are all not good
 sage: complex('inf') < 0
 True
 sage: complex(oo) < RR(0)
 True
 sage: complex(oo) < RR(oo)
 False
 sage: complex(oo) < RR(-oo)
 True
 }}}

 We also have the comparison failures with sage's complex infinity:
 {{{
 sage: CC(oo) < 0 # This is okay
 False
 sage: CC(oo) > 0
 True
 sage: CC(oo) > CC(2+5*i)
 True
 sage: CC(2+4*i) < CC(2+5*i)
 True
 sage: CC(2+6*i) < CC(2+5*i)
 False
 }}}

 I believe all comparisons in the complex number should raise a `TypeError`
 to be consistent with python. The other alternative should be they always
 return `False`.

 There is also the related #11506.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14088>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to