If you type m.<tab> you will see lots of things you can do with a
matrix m.  For example m.subdivide? allows you to pick out a
submatrix.

The rest of your query is hard to interpret.  To "create a list of
equal elements", say a list of 5 copies of the matrix m, do this:
sage: [m]*5

[[1.00000000000000 2.00000000000000]
[3.00000000000000 4.00000000000000],
 [1.00000000000000 2.00000000000000]
[3.00000000000000 4.00000000000000],
 [1.00000000000000 2.00000000000000]
[3.00000000000000 4.00000000000000],
 [1.00000000000000 2.00000000000000]
[3.00000000000000 4.00000000000000],
 [1.00000000000000 2.00000000000000]
[3.00000000000000 4.00000000000000]]

To add the entries of a vector:
sage: v=vector(range(100))
sage: sum(v)
4950

I'll leave row sums of a matrix as an exercise!

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

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