from math import * import numpy as np m=n=None x = np.array([12,23,52,32,12,12,23,52,32,12]) y = np.array([43,34,11,67,44,43,34,11,67,44]) m = [] for k in range (1,4): m.append(x/y+k) flat_list = [item for sublist in m for item in sublist] q=[[fl[2:3]],[fl[3:4]]] #2*1 non square matrix p=[[fl[2:3],fl[3:4]],[fl[2:3],fl[3:4]]] #2*2 matrix mm=np.dot(q,p) print (mm) # It gets error, ValueError: shapes (2,1,1) and (2,2,1) not aligned

1- k must be change from 1 to 3 (k=1,2,3) but it would not change the final answer but it just repeat the out put 3 times and they are identical and just use k=1. why? we need to print answer with k=1 and k=2 and k=3

2- 2- how can multiply two or more matrix with this way:

q=[[fl[2:3]],[fl[3:4]]] #2*1 non square matrix

p=[[fl[2:3],fl[3:4]],[fl[2:3],fl[3:4]]] #2*2 matrix

mm=np.dot(q,p)