A=matrix([[1,1,1,1,1],[1,1,1,1,1],[1,1,1,1,1]]);A
B=matrix([[1,1,1],[1,1,1],[1,1,1],[1,1,1],[1,1,1]]);B
C=matrix([[1],[1],[1],[1],[1]]);C
D=matrix([[1],[1],[1]]);D
import numpy as np
AB=np.dot(A,B)
BA=np.dot(B,A)
ABD=np.dot(AB,D)
E=np.dot(D,B)#it gives an error as the rows of AB and cols of D are different
DBA=np.dot(E,A)
E=B+C    #these both donot have the same order
np.dot(A,E)

Strang-ex-1.4-39-U (last edited 2010-12-17 12:28:42 by prasad)