import numpy as np import pylab as pl from scipy.interpolate import lagrange import matplotlib.pyplot as plt xi = np.linspace(-1, 1, 10) yi = 1 / (1 + 25 * xi * xi) x = np.linspace(-1, 1, 100) p = lagrange(xi, yi) plt.xlabel(u'x') plt.ylabel(u'y') plt.plot(xi, yi, "o", label=u"date") plt.plot(x, p(x), label=u"lagrange interpolation") pl.legend() pl.show()



