Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 9 years ago

j0equ1nn gravatar image

How do I define a list of products of matrices from a given list?

I'm trying to define a list of products of matrices from another list. This how I've tried to do it (using simplified data).

a = matrix(ZZ,[[1,0],[0,1]])
b = matrix(ZZ,[[0,1],[1,0]])
c = matrix(ZZ,[[1,1],[0,1]])
M=[a,b,c]
S=[X*Y for X, Y in M]
S

The output I get is

[0, 0, 1]

Obviously this is not the list of desired products, moreover it is not a list of matrices, and the list has 3 items rather than the 6 possible things that should occur. Beyond this simple example, I'd also like to be able to do this with longer products and more complicated initial lists.

click to hide/show revision 2
No.2 Revision

How do I define a list of products of matrices from a given list?

I'm trying to define a list of products of matrices from another list. This how I've tried to do it (using simplified data).

a = matrix(ZZ,[[1,0],[0,1]])
b = matrix(ZZ,[[0,1],[1,0]])
c = matrix(ZZ,[[1,1],[0,1]])
M=[a,b,c]
S=[X*Y for X, Y in M]
S

The output I get is

[0, 0, 1]

Obviously this is not the list of desired products, moreover it is not a list of matrices, and the list has 3 items rather than the 6 possible things that should occur. Beyond this simple example, I'd also like to be able to do this with longer products and more complicated initial lists.

This probably has a simple answer (I am a beginner). My next question though would be, how could I define a function that inputs some lN and outputs the list of products of that length?

click to hide/show revision 3
No.3 Revision

How do I define a list of products of matrices from a given list?

I'm trying to define a list of products of matrices matrices, of a set length, from another list. list of matrices. This how I've tried to do it (using simplified data).data and length 2).

a = matrix(ZZ,[[1,0],[0,1]])
b = matrix(ZZ,[[0,1],[1,0]])
c = matrix(ZZ,[[1,1],[0,1]])
M=[a,b,c]
S=[X*Y for X, Y in M]
S

The output I get is

[0, 0, 1]

Obviously this is not the list of desired products, moreover it is not a list of matrices, and the list has 3 items rather than the 6 possible things that should occur. Beyond this simple example, I'd also like to be able to do this with longer products and more complicated initial lists.

This probably has a simple answer (I am a beginner). My next question though would be, how could I define a function that inputs some lN and outputs the list of products of that length?