#10761: Numerical approximation of an algebraic number raises a ValueError
-----------------------------+----------------------------------------------
   Reporter:  slabbe         |       Owner:  tbd       
       Type:  defect         |      Status:  new       
   Priority:  major          |   Milestone:  sage-4.6.2
  Component:  PLEASE CHANGE  |    Keywords:            
     Author:                 |    Upstream:  N/A       
   Reviewer:                 |      Merged:            
Work_issues:                 |  
-----------------------------+----------------------------------------------
 Numerical approximation works for complex numbers:

 {{{
 sage: n(1 + I)
 1.00000000000000 + 1.00000000000000*I
 sage: (1 + I).n()
 1.00000000000000 + 1.00000000000000*I
 }}}

 but not for algebraic numbers:

 {{{
 sage: m = matrix(3, [3,1,6,5,2,9,7,3,13])
 sage: E = m.eigenvalues()
 sage: E
 [18.16815365088822?, -0.08407682544410650? - 0.2190261484802906?*I,
 -0.08407682544410650? + 0.2190261484802906?*I]
 sage: map(type, E)
 [<class 'sage.rings.qqbar.AlgebraicNumber'>, <class
 'sage.rings.qqbar.AlgebraicNumber'>, <class
 'sage.rings.qqbar.AlgebraicNumber'>]
 sage: map(n, E)
 Traceback (most recent call last):
 ...
 ValueError: Cannot coerce algebraic number with non-zero imaginary part to
 algebraic real
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10761>
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