from numpy import * import matplotlib.pyplot as plt from scipy.linalg import hilbert n = arange(1,21) ch = zeros(20) cv = zeros(20) for k in n: ch[k-1] = linalg.cond(hilbert(k)) gens = linspace(-1,1,k).reshape((1,-1)) cv[k-1] = linalg.cond(gens**(arange(k).reshape((-1,1)))) plt.semilogy(n,ch,n,cv) plt.legend(['Hilbert','Uniform Vandermonde']) plt.show()