[with patch, with positive review] v.n() function blows up when v is a vector
sage: v=vector(QQ,[1,2,3])
sage: v.n()

<type 'exceptions.TypeError'> Traceback (most recent call last)
/home/grout/sage/devel/sagemain/sage/graphs/<ipython console> in <module>()
/home/grout/sage/devel/sagemain/sage/graphs/element.pyx in sage.structure.element.Element.n()
/home/grout/sage/local/lib/python2.5/sitepackages/sage/misc/functional.py in numerical_approx(x, prec, digits)
731 return sage.rings.real_mpfr.RealField(prec)(x)
732 except TypeError:
> 733 return sage.rings.complex_field.ComplexField(prec)(x)
734
735 n = numerical_approx
/home/grout/sage/local/lib/python2.5/sitepackages/sage/rings/complex_field.py in __call__(self, x, im)
179 except AttributeError:
180 pass
> 181 return complex_number.ComplexNumber(self, x, im)
182
183 def _coerce_impl(self, x):
/home/grout/sage/devel/sagemain/sage/graphs/complex_number.pyx in sage.rings.complex_number.ComplexNumber.__init__()
<type 'exceptions.TypeError'>: unable to coerce to a ComplexNumber
I'm not sure what it should do, but maybe call n() on each entry would make sense.
Change History (6)
Milestone: 
sage2.10 →
sage2.9.1

Owner: 
changed from William Stein to Mike Hansen

Status: 
new →
assigned

Summary: 
v.n() function blows up when v is a vector →
[with patch] v.n() function blows up when v is a vector

Summary: 
[with patch] v.n() function blows up when v is a vector →
[with patch, needs review] v.n() function blows up when v is a vector

Summary: 
[with patch, needs review] v.n() function blows up when v is a vector →
[with patch, with positive review] v.n() function blows up when v is a vector

Resolution: 
→ fixed

Status: 
assigned →
closed

Frustrating that the same snippet of code is duplicated, but this is the correct way to fix this. Apply.