So I was trying to show the difference between a polynomial interpolation and a spline interpolation for an assignment and I wrote the below code.
f[x_] := 1/(1 + 25 x^2)
data[n_] := Table[{x, f[x]}, {x, -1, 1, 2/n}];
polyinterpolate[order_, n_] := LinearModelFit[data[n], Table[X^i, {i, 1, order, 1}], X]
cubicspline[order_, n_] := Interpolation[data[n], Method -> "Spline", InterpolationOrder -> order]
"f" is the function I want to fit to in the domain -1 to 1, "data" creates a table of n evenly spaced points on the function. "polyinterpolate" fits the points to a polynomial of order o. "cubicspline" interpolates using the spline method to order o.
I'm not sure what is wrong with my code but polyinterpolate and cubicspline give the same fits to any n points. Could InterpolationOrder be overriding Method-> in some way?
Thanks!