Use Lagrange interpolating polynomial method and cubic spline interpolation to evaluate the function f(x) at 100 equally spaced points in the interval [0,5]. Use cubic polynomial for Lagrange’s method as well. The points to be used in interpolations should include first and last point (0 and 5), other two points should be chosen such that those points would represent significant change in f(x). Show the plots for Lagrange’s method, cubic spline and the given data in one graph. Discuss which method is better.
Calculate the total error for both methods by using the following formula. Here yi is the given y value for xi , and f(xi) is the value of the interpolating function at point xi .
I WROTE THIS CODE, BUT I JUST WANT TO MAKE SURE IT'S WORKING OR NOT. CAN YOU PLEASE CHECK MY CODE, ACCORDING TO THE MY PARAGRAPH. I WILL BE WAITING YOUR HELP.
SINCERELY,
KUTLU YIGITTURK.