By Adam Mallen What is it? How is it different from regression? When would you use it? What can go wrong? How do we find the interpolating polynomial? Can you do this in Matlab? What else? The interpolating polynomial is the polynomial of least degree which passes through all the data points Formally: A unique solution to this problem is guaranteed X 0 10 20 30 40 50 60 Y -10 3 -30 6 10 -2 15 40 30 20 10 0 -10 -20 -30 -40 -10 0 10 20 30 40 50 60 70 X 0 10 20 30 40 50 60 Y -10 3 -30 6 10 -2 15 40 30 20 10 0 -10 -20 -30 -40 -10 0 10 20 30 40 50 60 70 Interpolation models must take on the exact values of the known data points Regression models minimize the residuals Given n+1 data points: ◦ The “best fit” polynomials of degree < n form regression models. ◦ The “best fit” polynomial of degree = n is the interpolating polynomial because the sum of the residuals is exactly zero. 40 30 20 10 0 -10 -20 -30 -40 -10 0 10 20 30 40 50 60 70 3 2 1 0 -1 -2 -3 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1.5 1 0.5 0 -0.5 -1 -1.5 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Regression models assume that measurements have noise. Regression models estimate f(x) and may be used for forecasting future and past values. Interpolation models may be suitable when measurements are believed to be exact. Interpolation models estimate values between known data points. NOT for forecasting 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8 -1 0 2 4 6 8 10 Runge Phenomenon Divergence for some selection of nodes Splines can help solve these problems However, … ◦ Splines may only be differentiable a certain number of times at the data points. ◦ Polynomials are infinitely differentiable ◦ Splines can be more complicated to compute and store. 1.2 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1.2 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1.2 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1.2 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 We can represent this system of equations as function result = poly_interp(x, y) % x and y are column vectors with the x and y values of the data points % there are n+1 data points n = length(x) - 1; % construct the Vandermonde matrix V = zeros(n+1,n+1); for i=1:n+1 for j=1:n+1 V(i,j) = x(i).^(j-1); end %for end %for % solve the system of equations alpha = V\y; result = fliplr(alpha'); end Lagrange form of the interpolating Polynomial Newton form of the interpolating Polynomial Chebyshev nodes Hermite interpolation problem Harmonic function interpolation Lebesgue constants