Lagrange, Newton, Interpolation, Python, Mathematics.
takes an array of x and y values and the value you want to interpolate, xx. Compared to the Newton’s polynomial function, this is set up to compute a single nth-order prediction, where n + 1 is the number of data points. def lagrange_interpolation(x,y,xx): n = len(x) sum = 0 for i in range(n):