Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Note that you are trying to multiply a matrix by a list. Instead of using a list you should use another matrix. Here's a way you can do it:

m = Matrix([[1, 0, 0],[0, 1, 0], [0, 0, 1]])
v = Matrix(3,1,[1,2,3])
m * v

Note several things

  • m is the identity matrix, which you can create as m = Matrix.identity(3)
  • the vector v is created by giving the dimensions, 3x1 in this case, and then giving a list of entries read along the rows from left to right and from top to bottom.