График: Your text to link here…
import numpy as np import matplotlib.pyplot as plt from math import * x = np.linspace(0,3,20) y = np.zeros(20) a = np.random.normal(0,0.3,size=2E1) for i in range(20): y[i] = x[i]**2 + a[i] A = np.vstack([x, np.ones(len(x))]).T m, c = np.linalg.lstsq(A, y)[0] plt.plot(x, y, 'bo-', lw = 1, label=u'Function') plt.plot(x, m*x + c, 'r', label='Average') std = np.zeros(20) for i in range(20): std[i] = (sqrt((y[i] - (m*x[i] + c))**2)) plt.errorbar(x, y, std, label=u'Std') plt.legend(loc='best') plt.title(u'Plots') plt.xlabel('X') plt.ylabel('Y') plt.grid() plt.show()