> John Cremona
>
> 2008/9/23 aniura <[EMAIL PROTECTED]>:
>
>
>
> > hi,
>
> > I wanted to know if there is a way to work in Sage with arrays of
> > matrices or something similar (something like a[i,j,k], so that
> > a[i,:,:], a[:,j,:] and a[:,:,k] are all matrices. I tried to use a
> > list of matrices but apparently sage interprets it as a list of
> > vectors:
>
> > sage: m=matrix(RR,2,range(1,5))
> > sage: m1=matrix(RR,2,range(6,10))
> > sage: lm=list(m)
> > sage: lm.append(m1)
> > sage: lm
>
> > [(1.00000000000000, 2.00000000000000),
> >  (3.00000000000000, 4.00000000000000),
> >  [6.00000000000000 7.00000000000000]
> > [8.00000000000000 9.00000000000000]]
> > sage: lm[1]
> > (3.00000000000000, 4.00000000000000)
>
> > I also wanted to know if there is a command to create a list (or
> > matrix, or vector) of equal elements;
> > to sum the entries of vectors, particularly of rows of matrices,
>
> > thanks in advance,
>
> > Aniura

Depending on what you're doing, you may also want to look into numpy
arrays, which you can use from within Sage.

from numpy import array

You might also want to work in python mode (%python as the first line
of a cell in the notebook) if you're doing much in numpy, to avoid
having ints get preprocessed to Integers, etc.

Regards,

JM
--~--~---------~--~----~------------~-------~--~----~
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