On Mon, Apr 21, 2008 at 9:22 AM, Aleksandr <[EMAIL PROTECTED]> wrote:
>
> In what version of Sage was n implemented for matrices? Right now,
> N(m) gives an error in my version 2.9.2
This is *only* in Sage-3.0, which hasn't been released yet. There you
will be able to do:
sage: m = matrix([[2
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)
---
Traceback (most recent call
last)
/home/sasha/ in ()
/opt/sage/local/lib/python2.5/site-
Simon King wrote:
>> ... and since you wanted a matrix of *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)
> ... and since you wanted a matrix of *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
Hi Aleksandr,
On Apr 21, 4:25 am, "Mike Hansen" <[EMAIL PROTECTED]> wrote:
> sage: m(1,2)
> [ cos(1) 0]
> [ 0 -sin(2)]
>
... and since you wanted a matrix of *numbers* out of m, you may do
sage: m(1.,2.)
[ 0.540302305868140 0]
[ 0 -0.909297426825682]
Hi Aleks,
You can just treat m as any symoblic expression and call it as a function.
sage: x,y = var('x,y')
sage: m = matrix([[cos(x),0],[0,-sin(y)]])
sage: m
[ cos(x) 0]
[ 0 -sin(y)]
sage: m(x=1, y=2)
[ cos(1) 0]
[ 0 -sin(2)]
sage: m.variables()
(x, y)
sage: m(1,2)
[ cos(1