Lagrange's interpolation to solve for 0 of y(x)

224 Views Asked by At

I have the data composing of 7 elements

x is from 0 → 3 incrementing by 0.5 y is from 1.8241 → -1.5427

I am supposed to use Lagrange's interpolation of three nearest neighbor data points.

I am supposed to write the code to do so in python but am struggling with setting up the equation.

I know l[0] = (x-x1/(x[0]-x[1])(x[0]-x[2])

But given the question that doesn't seem to be what I need and if so, using the 3 nearest neighbor data points do I still start at l[0].

Thanks for the help.