Skip to article frontmatterSkip to article content

Interpolation

from pylab import *

Suppose we know the values of a function y=f(x)y=f(x) at a set of discrete points, say in a tabular form

xxf(x)f(x)
x0x_0f(x0)f(x_0)
x1x_1f(x1)f(x_1)
\vdots\vdots
xNx_Nf(xN)f(x_N)

e.g., table of logarithms, sine, cosine, or perhaps the results of some experimental measurement. We may want to know the value of the function at some xx that is not present in the table. This is an interpolation problem.

Using the available information, we will first construct an approximation f~(x)\tilde{f} (x) to the unknown function f(x)f(x). Then

  1. We can use f~\tilde{f} to evaluate an approximation to ff at any value xx

    f(x)f~(x)f(x) \approx \tilde{f}(x)
  2. We can use f~\tilde{f} to compute approximations to derivatives or integrals of ff

    ddxf(x)ddxf~(x),abf(x)dxabf~(x)dx \dd{}{x}f(x) \approx \dd{}{x}\tilde{f}(x), \qquad \int_a^b f(x) \ud x \approx \int_a^b \tilde{f}(x)\ud x

To simplify the formulae, let us write

yi=f(xi)y_i = f(x_i)

In fact this is true for any degree of the interpolating polynomial. Thus the interpolation problem leads to a unique polynomial, and does not depend on the choice of the basis function for the space of polynomials.

1Some questions

  1. What basis functions to choose ?

    • polynomials: Easy to evaulate. But there are several choices, monomials, Lagrange, Newton, Chebychev, Legendre, etc.

    • rational polynomials

    • trigonometric functions: sines and cosines

    • radial basis functions

  2. The basis functions may have compact support or be globally supported. Using globally supported functions gives high accuracy for smooth functions and leads to what are called spectral methods. Compactly supported basis functions are useful when functions are less regular, and are used in finite element methods.

  3. How to sample the data, uniformly or otherwise ?

  4. How to interpolate/approximate arbitrarily scattered data, especially in high dimensions ?

  5. Interpolation/approximation can be performed using only function values, or using derivative information when available, leading to Hermite methods.

  6. Should we exactly fit the data as in interpolation, or approximate it, e.g., using a least squares fit ? This is also a question of norms to measure the approximation error. Usually the data has some noise and then it may not be a good idea to interpolate.