|   | 1 |  initial version  | 
Your code is very close. Try a modification to your list comprehension to get what you are looking for.
S=[X*Y for X in M for Y in M]
I'm not clear on your last question. Can you give an example?
|   | 2 |  No.2 Revision  | 
Your code is very close. Try a modification to your list comprehension to get what you are looking for.
S=[X*Y for X in M for Y in M]
I'm not clear on For your last question.  Can you give an example?question, one approach is:
s=range(4)
q=Permutations(s,3)
print len(q)
print q
a = matrix(ZZ,[[1,0],[0,1]])
b = matrix(ZZ,[[0,1],[1,0]])
c = matrix(ZZ,[[1,1],[0,1]])
d = matrix(ZZ,[[0,1],[0,1]])
M=[a,b,c,d]
S=[prod([M[i] for i in list(p)]) for p in q]
print S
 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
 
                
                Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.