Opened 15 years ago

Closed 15 years ago

# [with patch, with positive review] v.n() function blows up when v is a vector

Reported by: Owned by: Jason Grout Mike Hansen minor sage-2.10.1 linear algebra N/A

### Description

sage: v=vector(QQ,[1,2,3])
sage: v.n()
---------------------------------------------------------------------------
<type 'exceptions.TypeError'>             Traceback (most recent call last)

/home/grout/sage/devel/sage-main/sage/graphs/<ipython console> in <module>()

/home/grout/sage/devel/sage-main/sage/graphs/element.pyx in sage.structure.element.Element.n()

/home/grout/sage/local/lib/python2.5/site-packages/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/site-packages/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/sage-main/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.

### comment:1 Changed 15 years ago by Michael Abshoff

Milestone: sage-2.10 → sage-2.9.1

### Changed 15 years ago by Mike Hansen

Attachment: 1294.patch​ added

### comment:2 Changed 15 years ago by Mike Hansen

Owner: changed from William Stein to Mike Hansen new → assigned v.n() function blows up when v is a vector → [with patch] v.n() function blows up when v is a vector

### comment:3 Changed 15 years ago by Robert Miller

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

### comment:4 Changed 15 years ago by ncalexan

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

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

### comment:5 Changed 15 years ago by Michael Abshoff

Resolution: → fixed assigned → closed

Merged in Sage 2.10.1.alpha1

Note: See TracTickets for help on using tickets.