Opened 12 years ago

Closed 12 years ago

#1294 closed defect (fixed)

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

Reported by: jason Owned by: mhansen
Priority: minor Milestone: sage-2.10.1
Component: linear algebra Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

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.

Attachments (1)

1294.patch (9.2 KB) - added by mhansen 12 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 12 years ago by mabshoff

  • Milestone changed from sage-2.10 to sage-2.9.1

Changed 12 years ago by mhansen

comment:2 Changed 12 years ago by mhansen

  • Owner changed from was to mhansen
  • Status changed from new to assigned
  • Summary changed from v.n() function blows up when v is a vector to [with patch] v.n() function blows up when v is a vector

comment:3 Changed 12 years ago by rlm

  • Summary changed from [with patch] v.n() function blows up when v is a vector to [with patch, needs review] v.n() function blows up when v is a vector

comment:4 Changed 12 years ago by ncalexan

  • Summary changed from [with patch, needs review] v.n() function blows up when v is a vector to [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 12 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from assigned to closed

Merged in Sage 2.10.1.alpha1

Note: See TracTickets for help on using tickets.