On Sep 23, 3:31 pm, "John Cremona" <[EMAIL PROTECTED]> wrote:
> 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

But this would not create a list of 5 *copies* of m. The five entries
of that list are one and the same object, namely m:
  sage: m=Matrix(ZZ,[[1,2,3]])
  sage: L=[m]*5
  sage: L[0] is L[1]
  True

Any change to L[0] would also imply a change to L[1] and even to m:
sage: L[1]
[1 2 3]
sage: L[0][0,0]=0
sage: L[1]
[0 2 3]
sage: m
[0 2 3]


Hence, Aniura, if you want to manipulate individual copies of m, then
you should do
  sage: L=[copy(m) for i in range(5)]
Then, you have
  sage: L[0] is L[1]
  False
  sage: L=[copy(m) for i in range(5)]
  sage: L[1]
  [1 2 3]
  sage: L[0][0,0]=0
  sage: L[0]
  [0 2 3]
  sage: L[1]
  [1 2 3]
  sage: m
  [1 2 3]


But i am afraid that does not answer the question of the original
post, which was about creating an "array" A such that A[i;;], A[;j;]
and A[;;k] are matrices. Jason's reply ("use numpy") is probably
better.

Cheers
      Simon

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