#11283: algdep throws exception on valid input
-----------------------------+----------------------------------------------
   Reporter:  dunfield       |          Owner:  was       
       Type:  defect         |         Status:  new       
   Priority:  major          |      Milestone:  sage-4.7.1
  Component:  number theory  |       Keywords:            
Work_issues:                 |       Upstream:  N/A       
   Reviewer:                 |         Author:            
     Merged:                 |   Dependencies:            
-----------------------------+----------------------------------------------
 The algdep function chokes when the input is a vanilla Python complex
 number.   There is explicit code in algdep to handle this case, but it
 tries to convert the input to a Sage ComplexField element by a nonexistent
 method.    Really, the traceback says it all:

 {{{
 sage: z = complex("1+2j")
 sage: z
 (1+2j)
 sage: type(z)
 <type 'complex'>
 sage: algdep(z, 4)
 ---------------------------------------------------------------------------
 AttributeError                            Traceback (most recent call
 last)

 /Users/dunfield/Dropbox/knot-genus/Genus-Comp/<ipython console> in
 <module>()

 /pkgs/sage-4.6/local/lib/python2.6/site-packages/sage/rings/arith.pyc in
 algdep(z, degree, known_bits, use_bits, known_digits, use_digits,
 height_bound, proof)
     190         z = sage.rings.real_mpfr.RR(z)
     191     elif isinstance(z, complex):
 --> 192         z = sage.rings.complex_field.CC(z)
     193
     194     if isinstance(z, (sage.rings.real_mpfr.RealNumber,

 AttributeError: 'module' object has no attribute 'CC'
 }}}

 This could be fixed simply by changing line 192 to
 {{{
 z = sage.rings.complex_field.ComplexField()(z)
 }}}
 but I'm not sure if this the canonical way to do things, and hence didn't
 submit a patch.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11283>
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 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/sage-trac?hl=en.

Reply via email to