Numerical Computation Interpolation
Data and interpolating functions
DEFINITION: The function
In polynomial interpolation, we find a polynomial (or set of polynomials) that passes through each data point.
Lagrange Interpolation
Given two (different) data points
NOTE: Consider the function
Clearly,
DEFINITION: For a given set of
DEFINITION: We define a Lagrange Interpolating polynomial
EXAMPLE
Find an interpolating polynomial for the data points
SOLUTION:
THEOREM:
Let
PROOF:
The existence is proved by the explicit formula for Lagrange interpolation.
To show there is only one, assume for the sake of argument that there are two, say,
Newton Interpolation
In Newton’s method, we create a polynomial
The difference is that we construct
That is we construct a sequence of polynomials
Algorithm:
- Let
( matches data at ) - Suppose we have calculated
then, set for some constant .
NOTE:
and solve for
EXAMPLE
Find an interpolating polynomial for the data points
Let
Let
Let
Hence,
which is the same as the result we found by Lagrange interpolating method.
Newton’s Nested formula
Newton’s Method vs Lagrange:
- Both methods produce the same polynomial.
- Newton’s Method is more flexible. It is easy to add new data points and get a new interpolating polynomial.
- The coefficients in Newton’s Method (determined by solving for the constants
) can be calculated very efficiently. (Newton divide difference)
From previous example, without calculating the coefficient, we can write
It can be rewritten as
In general,
can be rewritten as
called Newton’s nested formula.
allows a better way of calculating
Then,
Following we will introduce an efficient way to calculate the coefficient
DEFINITION:
For a given collection of data
THEOREM
For Newton’s Interpolation formula
the coefficients
The recursive definition of the Newton’s divided differences allows arrangement into a convenient table. For three points the table has the form
The coefficients of the Newton’s Interpolation formula can be read from the top edge of the triangle.
EXAMPLE
Use divided differences to find the interpolating polynomial passing through the points
SOLUTION
The divided differences are calculated as follows:
The coefficients of the polynomial
or, in nested form
Approximating Polynomials and Interpolation Error
A major use of polynomial interpolation is to replace evaluation of a complicated function by evaluation of a polynomial, which involves only elementary computer operations like addition, subtraction, and multiplication.
EXAMPLE:
Interpolate the function
SOLUTION
We can repeat the process on the interval
The error for degree 3 interpolation of
In order to get enough correct digits to fill the calculator readout, we’ll need to know a little more about interpolation error.
[A graph is shown here with the function
| error | |||
|---|---|---|---|
| 1 | 0.8415 | 0.8411 | 0.0004 |
| 2 | 0.9093 | 0.9102 | 0.0009 |
| 3 | 0.1411 | 0.1428 | 0.0017 |
| 4 | 0.0011 | ||
| 14 | 0.9906 | 0.9928 | 0.0022 |
| 1000 | 0.8269 | 0.8263 | 0.0006 |
THEOREM
Assume that
where
PROOF
Consider adding one more point
At the point
Now define
Note that
By Rolle’s theorem, there are
Furthermore, there are
Continuing in this way, there must be one point
Takes
because the
which leads to
EXAMPLE
Find an upper bound for the difference at
SOLUTION
which
At
At
Cubic Splines
A spline curve is a curve that is made of a set of simple curves (lines, quadratics, cubic) that are joined together. A spline is piece-wise defined. That is, it is defined over a set of sub-intervals of a given interval. This set is called a partition.
DEFINITION: A partition of an interval
The numbers
DEFINITION: A function
- The domain of
is is continuous on - There is a partition
of points on such that is a linear function on each sub-interval
A linear spline is defined by its values at the set of knots. Given the table of values there is a unique linear spline with those values.
On each sub-interval,
Then,
EXAMPLE:
| 0.0 | 0.1 | 0.4 | 0.5 | 0.75 | 1.0 | |
|---|---|---|---|---|---|---|
| 1.3 | 4.5 | 2.0 | 2.1 | 5.0 | 3.0 |
[A graph of a linear spline connecting the points from the table is shown here]
Quadratic Spline
DEFINITION: A function
- The domain of
is is continuous on is continuous on - There is a partition
of points on such that is a polynomial of degree on each sub-interval
Thus, we need to determine
We know that:
This gives
Need one more condition on
EXAMPLE Data
By quadratic spline definition,
Hence
- 计算步长:
。 - 利用插值条件: 直接得出
。 - 利用连续性: 列出关于
和 的递归关系。 - 利用一阶导数连续: 得到
。 - 代入边界条件: 假设
,然后从左到右依次解出所有的 和 。
Cubic Spline
DEFINITION: A function
- The domain of
is is continuous on is continuous on is continuous on - There is a partition
of points on such that is a polynomial of degree on each sub-interval
Property 1:
Property 2:
Property 3:
EXERCISE Check that
satisfies all cubic spline properties for the data points
Constructing a spline from a set of data points means finding the coefficients
Property 4 Natural spline
Property 1:
Property 2:
Property 3:
Let
From property 1 we can solve
for
Substituting
for
Property 4 Natural spline
This gives a total of
EXAMPLE
Find the natural cubic spline through
SOLUTION
Therefore, the cubic spline is