31 Interpolation and Polynomial Approximation
In this section, we discuss methods to approximate a function with polynomials, and estimating the value of the function where its value is unknown. Estimating the value between the given, i.e. known, data points is called interpolation, and outside, the value of unknown points, is called extrapolation. Indeed, interpolation is less-prone to error, and likely error will be smaller near the known data points. As such, we need to exercise caution in extrapolation, as the behavior of fitted curve or approximating polynomial may be far off from the real function.
Also, the function of interest may or may not be known. When the function is known, our goal would be obtaining reasonably accurate estimates with much less burden of computation. One famous example, though not applicable to every function, is the Taylor expansion. Note the motivation of developing Taylor expansion was to express differentiable non-polynomial functions as a polynomial.
A familiar example of approximating an unknown function would be interpolation and extrapolation with census data. Due to its expensive resource consumption, census is not conducted annually but at several years of interval. In fact, while usually is the case the census bureau interpolates population of intercensal period with an exponential function, for illustration purpose, here we shall estimate with a polynomial.
We begin this section by introducing the method, the Lagrange interpolating polynomial.
Interpolation and the Lagrange Polynomial
The -th Lagrange interpolating polynomial is the formula to construct a unique polynomial connecting distinct points.
Theorem. (-th Lagrange Interpolating Polynomial [7])
Given for , the -th Lagrange interpolating polynomial is a unique polynomial of at most degree satisfying given by
where
Let us illustrate with an example.
Example. Estimating U.S. Population in 2020
Following are the historical U.S. population data from the U.S. Census Bureau [1].
Using the Lagrange interpolating method, estimate the U.S. population in 2005 and 2020.
We have 3 data points. Therefore, the Lagrange polynomial, where is year, will be of a second order as follows:
Therefore,
Therefore, the estimated U.S. population in 2005 and in 2020 are approximately 296 and 333 millions, respectively.
Now, let us have a look at another example of a known function.
Example. Construct a Lagrange interpolating polynomial of with the nodes , and examine the accuracy of and .
Let us construct the Lagrange polynomial first. As we have 3 data points, , , and , the Lagrange polynomial will be in the second order as follows:
Therefore,
Therefore, errors are
Unlike the previous example of estimating U.S. population, we observe errors in our estimates. Note that . In fact, the magnitude of error is much larger at than at . This is within our expectation that the farther away the interpolating or extrapolating points are located from the data points we know, the more error there likely is.
Error Analysis of Lagrange Polynomial
The remainder term for Lagrange polynomial is a derivation of the truncation error of Taylor expansion. First, let us restate the Taylor polynomial as follows:
where denotes the -th order Taylor polynomial.
The Lagrange polynomial uses information from different points rather than a single point in Taylor expansion. Therefore, we obtain the remainder term of Lagrange polynomial by replacing with as follows:
The truncation error of -th order Lagrange polynomial is
where denotes the -th order Lagrange polynomial.
Let us illustrate with an example.
Example. Determine the maximum possible error, i.e. error bound, of the previous example.
The truncation error of the 2nd order Lagrange polynomial is
Then, for ,
Therefore,
Let .
Then, .
Then, has a local minimum and maximum at
Therefore, the max of on is at .
Therefore, for ,
Therefore, the maximum error of for on is approximately 1.06.
Divided Difference
We have explored a little bit of interpolating polynomials. However, the downside of constructing a Lagrange polynomial is it is computationally expensive. That is, constructing a second order polynomial with only 3 data points was already bulky, and as reflected in the formula of Lagrange interpolating polynomial, the computation required increases exponentially as we have more data points. Therefore, another method requiring less calculation, or more efficient mechanism, was developed by Newton, and is called Newton’s divided-difference formula or Newton’s interpolating polynomial.
Theorem. (Newton’s Interpolating Polynomial)
The -th Lagrange interpolating polynomial penetrating of a continuous function for is unique, but also can be expressed in an alternative form, Newton’s interpolating polynomial as follows:
where and denotes the -th divided difference of defined as
Proof.
First, write a -th polynomial as follows:
Then, determine the coefficient ‘s where .
, since
, since
Next, introduce the divided difference notation.
The 0th divided difference of is
The 1st divided difference of is
The 2nd divided difference of is
The -th divided difference of is
By letting and , we have the -th divided difference of as follows:
Then, we have
Finally, express the coefficients ‘s in divided difference notation
The following table shows the generation of divided differences. Note that the order of inputs, i.e. ‘s are irrelevant.
Let us conclude this section with an illustrative example.
Example. Find the Newton’s interpolating polynomial of the following dataset.
First, we construct a divided difference table.
Detailed calculations in the following steps are overly complex to be carried out by hand, and thus omitted. Also, note that the aim of this summary is to understand important concepts and theorems, and know how to apply those. The author recommends the use of a computer package such as Python, Wolfram Mathematica, SAS, R, and Stata. Following is the result with a graph generated using Microsoft Excel 2020.
Cubic Spline Interpolation
Computational challenge of constructing a high-order Lagrange interpolating polynomial has been substantially reduced with the introduction of Newton’s method using divided difference, a method of sequentially adding information than to use all data points all at once.
However, another problem occurs called Runge’s phenomenon, the problem of oscillation at the edges of fitted polynomial, especially when fitting a polynomial with equally spaced nodes (Figure 23). The red curve in the figure denotes the Runge’s function, the blue curve is a polynomial fitted with 5 data points, and the green curve fitted with 9 data points. It is contrary to the general trend of increasing accuracy with more data points, but the oscillations at the edges result in substantial increase in errors. To resolve this issue, in this section we introduce piecewise interpolation.
The simplest form would be a piecewise linear function, simply “connecting the dots.” However, we omit this case, a series of straight lines, as this is a rudimentary form that is only continuous, but highly unlikely to be differentiable at the nodes. An advanced form is a piecewise-quadratic function. Constructing a series of second order polynomial connecting the points, so that the tangent evaluated at the nodes would agree in adjacent functions. Let us have a look at the simplest example with only 3 nodes.
Let be the nodes for . Then, to fit a piecewise-quadratic function, we need to construct 2 polynomials, and , satisfying the following conditions:
Note that there may be many polynomials satisfying the conditions above, i.e. the polynomial is not uniquely determined. Therefore, in general, an additional condition is given such as the derivative at one of the endpoints. However, the difficulty is we usually do not have enough information on the derivatives on the endpoints.
Another way, in fact the most commonly used piecewise polynomial, is the piecewise-cubic or cubic spline method, fitting cubic functions connecting specified nodes with a series of cubic function. The main advantage of this method is it may provide a smoother function by requiring the same concavity at each connecting node, yet at the cost of increased computations. Following is the general form of a cubic spline:
Let be nodes for the cubic spline for and denote each cubic polynomial as for , satisfying
and one of
Let us conclude this section with an illustrative example.
Example. Construct a clamped cubic spline of interpolating , , and , where and .
Let for .
Then, we have
We need to find polynomials and satisfying
Solving the linear system above, the yielded cubic polynomials are
Note that actual calculations were omitted. As the number of nodes increases, the required amount of computations involved rapidly increases accordingly. As such, sound judgement is required for the “tradeoff” between fitting a cubic spline vs a -th order interpolating polynomial.