In what version of Sage was n implemented for matrices? Right now,
N(m) gives an error in my version 2.9.2

sage: N(m)
---------------------------------------------------------------------------
<type 'exceptions.TypeError'>             Traceback (most recent call
last)

/home/sasha/<ipython console> in <module>()

/opt/sage/local/lib/python2.5/site-packages/sage/misc/functional.py in
numerical_approx(x, prec, digits)
    732             return sage.rings.real_mpfr.RealField(prec)(x)
    733         except TypeError:
--> 734             return sage.rings.complex_field.ComplexField(prec)
(x)
    735
    736 n = numerical_approx

/opt/sage/local/lib/python2.5/site-packages/sage/rings/
complex_field.py in __call__(self, x, im)
    207             except AttributeError:
    208                 pass
--> 209         return complex_number.ComplexNumber(self, x, im)
    210
    211     def _coerce_impl(self, x):

/home/sasha/complex_number.pyx in
sage.rings.complex_number.ComplexNumber.__init__()

<type 'exceptions.TypeError'>: unable to coerce to a ComplexNumber


On Apr 21, 6:51 am, Jason Grout <[EMAIL PROTECTED]> wrote:
> Simon King wrote:
> >> ... and since you wanted amatrixof *numbers* out of m, you may do
> >> sage: m(1.,2.)
>
> > Oops, i just see that your original example was x=pi/2, y=pi. That is
> > fine:
> > sage: m(pi/2,pi)
> > [0 0]
> > [0 0]
>
> > and is of course better than going via RR:
> > sage: m(RR(pi/2),RR(pi))
> > [  6.12323399573676e-17                      0]
> > [                     0 -1.224646799147353e-16]
>
> I don't have the source/sage system handy, but I think the n() function
> was implemented recently for symbolic matrices, so the following should
> work and be consistent with other things in Sage (example off the top of
> my head with hand-constructed output, but something like this should be
> possible soon, if not now):
>
> sage: m(1,2).n()
> [ 0.540302305868140                  0]
> [                 0 -0.909297426825682]
>
> Seehttp://trac.sagemath.org/sage_trac/ticket/2857
>
> -Jason
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to