from numpy import * import matplotlib.pyplot as plt n=3 x=linspace(0,1,100).reshape((100,1)) x_powers = x**(arange(n+1)) p1 = array([[0],[1],[0],[0]]) p2 = array([[0],[0],[1],[0]]) p3 = array([[0],[0],[0],[1]]) Y = x_powers@block([p1,p2,p3]) plt.plot(x,Y) plt.legend(['p_1','p_2','p_3']) plt.show() plt.plot(x, Y[:,0]) plt.plot(x, Y[:,1]) plt.plot(x, Y[:,2]) plt.show() plt.plot(x, Y[:,0], x, Y[:,1], x, Y[:,2]) plt.show() A = array([[1,1,1],[1,1,1]]) B = array([[2,2],[ 2,2]]) C = array([[3,3,3],[3,3,3],[3,3,3]]) D = array([[4,4],[4,4],[4,4]]) print( block([[A,B],[C,D]]) )