You are on page 1of 17

4.

Interpolation
Class 07. Numerical Analysis
Interpolation techniques

Dr. Josept Revuelta


Interpolation
In simple words, interpolation means estimating a value inside a set of
data points. Imagine for a moment that the daily sales of an ice cream
company in the hot and humid Coatzacoalcos depends on the
temperature (See the plot):

We can se that the points are the sample data we randomly collected from
the salesman. However, we are interested in knowing the sales when the
temperature is 21 Celsius since it the mean annual temperature. We see
that we do not have that information at hand.
To solve this inconvenient, we can use linear interpolation between the
closest points or linear regression. The former is the topic of this unit. We
are going to explore some interpolation methods.

We use linear
interpolation to
estimate data
between known
points.

A. Lagrange interpolation
B. Newton differences
C. Splines
Interpolation
A function is said to interpolate a set of data points if it passes through
those points. Suppose that a set of (x, y) data points has been collected,
such as (0, 1), (2, 2), and (3, 4). There is a parabola that passes through the
three points, shown in Figure 1. This parabola is called the degree 2
interpolating polynomial passing through the three points

1 2 1
Figure 1. Points interpolate for the function P(x) = x − x + 1
2 2
Interpolation
Definition: the function y = P(x) interpolates the data points (x1, y1),...,
(xn, yn) if P(xi) = yi for each 1 ≤ i ≤ n.

We can make some observations:

A. P is required to be a function
B. x values have to be all distinct, there is not restriction in y.
C. We are using only polynomials.
D. Is there always a polynomial? If all x’s are distinct, the answer is
yes. No matter how many points are given, there is some
polynomial y = P(x) that runs through all the points.

Why do we use polynomials? Polynomials are very often used for


interpolation because of their straightforward mathematical
properties.
Lagrange interpolation
Assume that n data points (x1, y1),...,(xn, yn) are given, and that we
would like to find an interpolating polynomial. There is an explicit
formula, called the Lagrange interpolating formula, for writing down a
polynomial of degree d = n − 1 that interpolates the points. For
example, suppose that we are given three points(x1, y1), (x2, y2),
(x3, y3). Then the polynomial

Is the Lagrange Interpolating polynomial for these points.


Example 1:
Find an interpolating polynomial for the data points (0,1),(2,2), and (3,4)

Check that P2(0) = 1, P2(2) = 2, and P2(3) = 4.


In general, suppose that we are presented with n points (x1, y1),...,(xn, yn).
For each k between 1 and n, define the degree n − 1 polynomial.

The interesting property of Lk is that Lk(xk)= 1, while Lk(xj) = 0, where xj


is any of the other data points. Then define the degree n − 1 polynomial

This is a straightforward generalization of the polynomial in Example 1 and


works the same way. Substituting xk for x yields
Example 2:
Find the polynomial of degree 3 or less that interpolates the points (0, 2),
(1, 1), (2, 0), and (3, −1).

The Lagrange form is as follows:

We can say that there exists exactly one interpolating polynomial of


degree 3 or less. In this particular example, the data points are collinear,
so the interpolating polynomial has degree 1.
Newton’s divided differences
The Lagrange interpolation method, as described before, is a constructive
way to write the unique interpolation polynomial. However, it is seldom
used for calculation because alternative methods result in more
manageable and less computationally complex forms. Newton’s divided
differences give a particularly simple way to write the interpolating
polynomial. Given n data points, the result will be a polynomial of degree
at most n − 1, just as Lagrange form does. The idea of divided
differences is fairly simple, but some notation needs to be mastered first.
Assume that the data points come from a function f(x), so that our goal is
to interpolate(x1, f(x1)),...,(xn, f(xn)).

n−1
Definition: Denote by f [x1 . . . xn] the coefficient of the x term in the
(unique) polynomial that interpolates (x1, f(x1)),…,(xn, f(xn)).
Using this definition, the following somewhat remarkable alternative
formula for the interpolating polynomial holds, called the Newton’s
divided difference formula

Moreover, the coefficients f [x1 . . . xk] from the above definition can be
recursively calculated as follows. List the data points in a table:
Now define the divided differences, which are the real numbers:

Let’s do an example to make all these theory clear.


Example 3:
Use divided differences to find the interpolating polynomial passing
through the points (0, 1), (2, 2), (3, 4)
Example 3:
Example 4:
Add the fourth data point (1,0) to the list in Example 3.
Example 4:
Exercises

You might also like