















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















































[Photos: car shape, font with B´ezier splines] Polynomial interpolation is an ancient practice, but the heavy industrial use of interpolation be- gan with cubic splines in the 20th century. Motivated by practices in the shipbuilding and aircraft industries, engineers Paul de Casteljau and Pierre B´ezier at rival European car manufacturers Cit- roen and Renault, followed by work at General Motors in the U.S., spurred the development of what are now called cubic splines and B´ezier splines. Although developed for aerodynamic studies of automobiles, splines have been used for many applications, including computer typesetting. A revolution in printing was caused by two Xerox engineers who formed a company called Adobe, and released the PostScript language in 1984. It came to the attention of Steve Jobs at Apple Corporation, who was looking for a way to control a newly-invented laser printer. B´ezier splines were a simple way to adapt the same mathematical curves to multiple printer resolutions. Reality Check 3 explores how PostScript constructs letters using B´ezier splines. END FRONT NOTES————————–
FFICIENT ways of representing data are fundamental to advancing the understanding of scien- tific problems. At its most fundamental, approximating data by a polynomial is an act of data compression. Suppose points (x, y) are taken from a given function y = f (x), or perhaps from an experiment where x denotes temperature and y denotes reaction rate. A function on the real numbers represents an infinite amount of information. Finding a polynomial through the set of data means replacing the information with a rule that can be evaluated in a finite number of steps. Al- though it is unrealistic to expect the polynomial to represent the function exactly at new inputs x, it may be close enough to solve practical problems. This chapter introduces polynomial interpolation and spline interpolation as convenient tools for finding functions that pass through given data points.
function is said to interpolate a set of data points if it passes through those points. Suppose 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 3.1. This parabola is called the degree 2 interpolating polynomial passing through the three points.
Definition 3.1 The function y = P (x) interpolates the data points (x 1 , y 1 ),... , (xn, yn) if P (xi) = yi for each 1 ≤ i ≤ n.
−1 1 2 3 4 −
1
2
3
4
Figure 3.1: Interpolation by parabola. The points (0, 1), (2, 2), and (3, 4) are interpolated by the function P (x) = 12 x^2 − 12 x + 1.
Why polynomials? Polynomials are very often used for interpolation because of their straightforward mathematical properties. There is simple theory about when an interpolating polynomial of a given de- gree exists for a given set of points. More important, in a real sense polynomials are the most fundamental of functions for digital computers. Central processing units usually have fast methods in hardware for adding and multiplying floating points numbers, which are the operations needed to evaluate a polyno- mial. Complicated functions can be approximated by interpolating polynomials in order to make them computable with these two hardware operations.
Note that P is required to be a function, that is, each value x corresponds to a single y. This puts a restriction on the set of data points {(xi, yi)} that can be interpolated - the xi’s must be all distinct, in order for a function to pass through them. There is no such restriction on the yi’s. To begin, we will look for an interpolating polynomial. Does such a polynomial always exist? Assuming that the x-coordinates of the points 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. This and several other facts about interpolating polynomials are proved in this section. Interpolation is the reverse of evaluation. In polynomial evaluation (such as nested multiplica- tion of Chapter 0) we are given a polynomial and asked to evaluate a y-value for a given x-value - that is, compute points lying on the curve. Polynomial interpolation asks for the opposite process: Given these points, compute a polynomial that can generate them.
Theorem 3.2 (Main Theorem of Polynomial Interpolation) Let (x 1 , y 1 ),... , (xn, yn) be n points in the plane with distinct xi. Then there exists one and only one polynomial P of degree n − 1 or less that satisfies P (xi) = yi for i = 1,... , n.
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 P (x) and Q(x), that have degree at most n − 1 and that both interpolate all n points. That is, we are assuming P (x 1 ) = Q(x 1 ) = y 1 , P (x 2 ) = Q(x 2 ) = y 2 ,... , P (xn) = Q(xn) = yn. Now define the new polynomial H(x) = P (x) − Q(x). Clearly the degree of H is also at most n − 1 , and note that 0 = H(x 1 ) = H(x 2 ) = · · · = H(xn), that is H has n distinct zeros. According to the Fundamental Theorem of Algebra, a degree d polynomial can have at most d zeros, unless it is the identically zero polynomial. Therefore H is the identically zero polynomial, and P (x) ≡ Q(x). We conclude that there is a unique P (x) of degree ≤ n − 1 interpolating the n points (xi, yi).
Example 3.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
P 2 (x) = 2
(x − 1)(x − 2)(x − 3) (0 − 1)(0 − 2)(0 − 3)
(x − 0)(x − 2)(x − 3) (1 − 0)(1 − 2)(1 − 3)
(x − 0)(x − 1)(x − 3) (2 − 0)(2 − 1)(2 − 3)
(x − 0)(x − 1)(x − 2) (3 − 0)(3 − 1)(3 − 2) = −
(x^3 − 6 x^2 + 11x − 6) +
(x^3 − 5 x^2 + 6x) −
(x^3 − 3 x^2 + 2x) = −x + 2
Theorem 3.2 says that there exists exactly one interpolating polynomial of degree 3 or less, but it may or may not be exactly degree 3. In Example 3.2, the data points are collinear, so the interpo- lating polynomial has degree 1. Theorem 3.2 implies that there are no interpolating polynomials of degree two or three. It may be already intuitively obvious to you that no parabola or cubic curve can pass through four collinear points, but here is the reason.
3.1.2 Newton’s divided differences The Lagrange interpolation method, as described in the previous section, is a constructive way to write the unique polynomial promised by Theorem 3.2. It is also intuitive; one glance explains why it works. However, it is seldom used for calculation due to the existence of alternative methods that result in more manageable and less computationally complex forms. Newton divided differences give a particularly simple way to write the interpolating polynomial. Given n data points, the result will be a degree at most n− 1 polynomial, just as Lagrange form does. Theorem 3.2 says that it can be none other than the same as the lagrange interpolating polynomial, written in a disguised form. The idea of divided differences is fairly simple, but some notation needs to be mastered first. View the data points as given by some function f , and list the data points in a table:
x 1 f (x 1 ) x 2 f (x 2 ) .. .
xn f (xn)
Now define the divided differences, which are the real numbers
f [xk] = f (xk)
f [xk xk+1] = f [xk+1] − f [xk] xk+1 − xk
f [xk xk+1 xk+2] = f [xk+1 xk+2] − f [xk xk+1] xk+2 − xk
f [xk xk+1 xk+2 xk+3] =
f [xk+1 xk+2 xk+3] − f [xk xk+1 xk+2] xk+3 − xk
and so on. These numbers are the coefficients of the interpolating polynomial for the data points, which is given by the Newton’s divided difference formula
P (x) = f [x 1 ] + f [x 1 x 2 ](x − x 1 )
A proof of the fact that the polynomial interpolates the n data points is given in Section 3.2.2. No- tice that the divided difference formula gives the interpolating polynomial as a nested polynomial. It is automatically ready to be evaluated in an efficient way. Newton Divided Differences
Given x = [x 1 ,... , xn], y = [y 1 ,... , yn]
for j = 1,... , n f [xj ] = yj end for i = 2,... , n for j = 1,... , n + 1 − i f [xj... xj+i− 1 ] = (f [xj+1... xj+i− 1 ] − f [xj... xj+i− 2 ])/(xj+i− 1 − xj ) end end The interpolating polynomial is
P (x) =
∑^ n
i=
f [x 1... xi](x − x 1 ) · · · (x − xi− 1 )
Finally, the recursive definition of the Newton divided differences allows arrangement into a convenient table. For three points the table has form
Example 3.4 Add the fourth data point (1, 0) to the list in Example 3.3.
We can keep the calculations that were already done and just add a new bottom row to the triangle: 0 1 1 2 (^2 2 ) 2 − (^12) 3 4 0 2 1 0 The result is one new term to add to the original polynomial P 2 (x). Reading from the top edge of the triangle, we see that the new degree 3 interpolating polynomial is
P 3 (x) = 1 +
(x − 0) +
(x − 0)(x − 2) −
(x − 0)(x − 2)(x − 3).
Note that P 3 (x) = P 2 (x) − 12 (x − 0)(x − 2)(x − 3), so the previous polynomial can be reused as part of the new one.
It is interesting to compare the extra work necessary to add a new point using the Lagrange formulation versus the divided difference formulation. The Lagrange polynomial must be restarted from the beginning when a new point is added; none of the previous calculation can be used. On the other hand, in divided difference form, we keep the earlier work and add one new term to the polynomial. Therefore the divided difference approach has a “real-time updating” property that the Lagrange form lacks. The operation counts for Lagrange and divided difference interpolation are compared in Exercise 3.1.15.
Example 3.5 Use Newton’s divided differences to find the interpolating polynomial passing through (0, 2), (1, 1), (2, 0), (3, −1).
The divided difference triangle is 0 2 − 1 1 1 0 − 1 0 2 0 0 − 1 3 − 1 Reading off the coefficients, we find that the interpolating polynomials of degree 3 or less is
P (x) = 2 + (−1)(x − 0) = 2 − x,
agreeing with Example 3.2 but with much less work.
3.1.3 How many degree d polynomials pass through n points?
Theorem 3.2, the Main Theorem of polynomial interpolation, answers this question if 0 ≤ d ≤ n− 1. Given n = 3 points (0, 1), (2, 2), (3, 4), there is one interpolating polynomial of degree 2 or less. Example 3.1 shows that it is degree two, so there are no degree zero or one interpolating polynomials through the three data points. How many degree 3 polynomials interpolate the above three points? One way to construct one such polynomial is clear from the previous discussion - add a fourth point. Extending the Newton divided difference triangle gives a new top coefficient. In Example 3.4 the point (1, 0) was added. The resulting polynomial
P 3 (x) = P 2 (x) −
(x − 0)(x − 2)(x − 3) (3.4)
passes through the three points in question, in addition to the new point (1, 0). So there is at least one degree 3 polynomial passing through our three original points (0, 1), (2, 2), (3, 4). Of course, there are many different ways we could have chosen the fourth point. For example, if we keep the same x 4 = 1 and simply change y 4 from 0 , we must get a different degree 3 inter- polating polynomial, since a function can only go through one y value at x 4. Now we know there are infinitely many polynomials that interpolate the three points (x 1 , y 1 ), (x 2 , y 2 ), (x 3 , y 3 ), since for any fixed x 4 there are infinitely many ways y 4 can be chosen, each giving a different polynomial. This line of thinking shows that given n data points (xi, yi) with distinct xi, there are infinitely many degree n polynomials passing through them. A second look at (3.4) suggests a more direct way to produce interpolating polynomials of degree 3 through 3 points. Instead of adding a fourth point to generate a new degree 3 coefficient, why not just pencil in a new coefficient? Does the result interpolate the original 3 points? Yes, because P 2 (x) does, and the new term evaluates to zero at x 1 , x 2 and x 3. So there is really no need to construct the extra Newton divided differences for this purpose. Any degree 3 polynomial of the form P 3 (x) = P 2 (x) + cx(x − 2)(x − 3)
with c 6 = 0 will pass through (0, 1), (2, 2) and (3, 4). This technique will also easily construct (infinitely many) polynomials of degree ≥ n for n given data points, as illustrated in the next example.
Example 3.6 How many polynomials of each degree 0 ≤ d ≤ 5 pass through the points (− 1 , −5), (0, −1), (2, 1) and (3, 11)?
The Newton’s divided difference triangle is
− 1 − 5 4 0 − 1 − 1 1 1 2 1 3 10 3 11
will result in the plot shown in Figure 3.1. Now that we have Matlab code for finding the coefficients of the interpolating polynomial (newtdd.m) and for evaluating the polynomial (nest.m), we can put them together to build a polynomial interpolation routine. The program clickinterp.m uses Matlab’s graphics capa- bility to plot the interpolation polynomial as it is being created. Matlab’s mouse input command ginput is used to facilitate data entry.
Figure 3.2: Interpolation Program 3.2 using mouse input. Screenshot of Matlab code clickinterp.m with 4 input data points.
%Program 3.2. clickinterp.m Polynomial Interpolation Program %Left click in Matlab figure window to locate data point. % Continue, to add more points. % Right-click to terminate program. xl=-3;xr=3;yb=-3;yt=3; plot([xl xr],[0 0],’k’,[0 0],[yb yt],’k’);grid on; xlist=[];ylist=[]; button=1;k=0; % initialize counter k while(button ˜= 3) % if right click, terminate [xnew,ynew,button] = ginput(1); % get one mouse click if button == 1 % current click is a left click k=k+1; % k counts clicks xlist(k)=xnew; ylist(k)=ynew; % add new point to the list c=newtdd(xlist,ylist,k); % get interpolation coeffs x=xl:.01:xr; % define x coordinates of curve y=nest(k-1,c,x,xlist); % get y coordinates of curve plot(xlist,ylist,’o’,x,y,[xl xr],[0,0],’k’,[0 0],[yb yt],’k’); axis([xl xr yb yt]);grid on; end end
This is our first encounter with the concept of compression in numerical analysis. At first, interpolation may not seem like compression. After all, we take n points as input and deliver n coefficients (of the interpolating polynomial) as output. What has been compressed? Think of the data points as coming from somewhere, say as representatives chosen from the multitude of points on a curve y = f (x). The degree n − 1 polynomial, characterized by n coefficients, is a “compressed version” of f (x) , and may in some cases be used as a fairly simple representative of f (x) for computational purposes. For example, what happens when the sin button is pushed on a calculator? The calculator has hardware to add and multiply, but how does it compute the sin of a number? Somehow the operation must reduce to the evaluation of a polynomial, which requires exactly those operations. By choosing data points lying on the sine curve, an interpolating polynomial can be calculated and stored in the calculator as a compressed version of the sine function. This type of compression is “lossy compression”, meaning there will be error involved, since the sine function is not actually a polynomial. How much error is made when a function f (x) is replaced by an interpolating polynomial is the subject of the next section.
3.1.5 Representing functions by approximating polynomials. A major use of polynomial interpolation is to replace evaluation of a complicated function by eval- uation of a polynomial, which involves only elementary computer operations like addition, subtrac- tion and multiplication. Think of this as a form of compression: something complex is replaced with something simpler, and computable, with perhaps some loss in accuracy that we will have to analyze. We begin with an example from trigonometry.
Example 3.7 Interpolate the function sin x at 4 equally-spaced points on [0, π/2].
Let’s compress the sine function on the interval [0, π/2]. Take four data points at equally spaced points and form the divided difference triangle. We list the values to 4 correct places:
0 0. 0000
The degree 3 interpolating polynomial is therefore
P 3 (x) = 0 + 0. 9549 x − 0. 2443 x(x − π/6) − 0. 1139 x(x − π/6)(x − π/3) = 0 + x(0.9549 + (x − π/6)(− 0 .2443 + (x − π/3)(− 0 .1139))) (3.5)
−1 1
−
1
Figure 3.3: Degree 3 interpolation of sin x. The interpolation polynomial is plotted along with y = sin x. Equally-spaced interpolation nodes are at 0 , π/ 6 , 2 π/ 6 and 3 π/ 6. The approximation is very close between 0 and π/ 2.
Not bad for the first try. The error is usually under 1%. In order to get enough correct digits to fill the calculator readout we’ll need to know a little more about interpolation error, the topic of the next section.
Exercises 3. 3.1.1. Use Lagrange interpolation to find a polynomial that passes through the points. (a) (0, 1), (2, 3), (3, 0) (b) (− 1 , 0), (2, 1), (3, 1), (5, 2) (c) (0, −2), (2, 1), (4, 4) 3.1.2. Use Newton’s divided differences to find the interpolating polynomials of the points in Exercise 3.1.1, and verify agreement with the Lagrange interpolating polynomial. 3.1.3. How many degree d polynomials pass through the four points (− 1 , 3), (1, 1), (2, 3), (3, 7)? Write one down if possible. (a) d = 2 (b) d = 3 (c) d = 6 3.1.4. (a) Find a polynomial P (x) of degree 3 or less whose graph passes through the points (0, 0), (1, 1), (2, 2), (3, 7). (b) Find 2 other polynomials (of any degree) which pass through these 4 points. (c) Decide whether there exists a polynomial P (x) of degree 3 or less whose graph passes through the points (0, 0), (1, 1), (2, 2), (3, 7), and (4, 2). 3.1.5. (a) Find a polynomial P (x) of degree 3 or less whose graph passes through the four data points (− 2 , 8), (0, 4), (1, 2), (3, −2). (b) Describe any other polynomials of degree 4 or less which pass through the 4 points in part (a). 3.1.6. Write down a polynomial of degree exactly 5 that interpolates the four points (1, 1), (2, 3), (3, 3), (4, 4). 3.1.7. Find P (0), where P (x) is the degree 10 polynomial which is zero at x = 1,... , 10 and satisfies P (12) = 44. 3.1.8. Let P (x) be the degree 9 polynomial that takes the value 112 at x = 1, takes the value 2 at x = 10, and equals zero for x = 2,... , 9. Calculate P (0). 3.1.9. Give an example of the following or explain why no such example exists. (a) A degree 6 polynomial L(x) which is zero at x = 1, 2 , 3 , 4 , 5 , 6 and equal to 10 at x = 7. (b) A degree 6 polynomial L(x) which is zero at x = 1, 2 , 3 , 4 , 5 , 6 , equal to 10 at x = 7, and equal to 70 at x = 8. 3.1.10. Let P (x) be the degree 5 polynomial that takes the value 10 at x = 1, 2 , 3 , 4 , 5 and the value 15 at x = 6. Find P (7).
3.1.11. Let P 1 , P 2 , P 3 , and P 4 be four different points lying on a parabola y = ax^2 + bx + c. How many cubic (degree
Computer Problems 3. 3.1.1. Use the following world population figures to estimate the 1980 population, using (a) the straight line through the 1970 and 1990 estimates (b) the parabola through the 1960, 1970, and 1990 estimates, and (c) the cubic curve through all four data points. Compare with the 1980 estimate: 4,452,584,592. year population 1960 3,039,585, 1970 3,707,475, 1990 5,281,653, 2000 6,079,603, 3.1.2. Write a version of Program 3.2 that is a Matlab function, whose inputs x and y are equal length vectors of data points, and whose output is a plot of the interpolating polynomial. In this way, the points can be entered more accurately than by mouse input. Check your program by replicating Figure 3.4. 3.1.3. Write a Matlab function polyinterp.m that takes as input a set of (x, y) interpolating points, and another x 0 , and outputs y 0 , the value of the interpolating polynomial at x 0. The first line of the file should be function y = polyinterp(x,y,x0) where x and y are input vectors of data points. Your function may call newtdd from Program 3.1, and nest from Chapter 0, and may be structured similarly to Program 3.2, but without the graphics. Demonstrate that your function works. 3.1.4. Remodel the sin1 calculator key in Program 3.3 to build cos1, a cosine key that follows the same principles. First decide on the fundamental domain for cosine. 3.1.5. (a) Use the addition formulas for sin and cos to prove that tan(π/ 2 − x) = 1/ tan x. (b) Show that [0, π/4] can be used as a fundamental domain for tan x. (c) Design a tangent key, following the principles of Program 3.3, using degree 3 polynomial interpolation on this fundamental domain. (d) Empirically calculate the maximum error of the tangent key.
T
HE accuracy of our sin calculator key depends on the approximation in Figure 3.3. How close is it? We showed a table indicating that for a few examples, the first two digits are fairly reliable, but after that the digits are not always correct. In this section we investigate ways to measure this error and determine how to make it smaller.
−3 −2 −1 1 2
5
Figure 3.4: Interpolating polynomial for approximating f (x) = ex. Equally spaced base points − 1 , − 0. 5 , 0 , 0. 5 , 1
Note that we don’t need to construct the interpolating polynomial to find the bound. The interpola- tion error formula (3.6) gives
f (x) − P 4 (x) =
(x + 1)(x + 12 )x(x − 12 )(x − 1) 5! f (5)(c),
where − 1 < c < 1. The fifth derivative is f (5)(c) = ec. Since ex^ is increasing with x, its maximum is at the right-hand end of the interval and so |f (5)| ≤ e^1 on [− 1 , 1]. For − 1 ≤ x ≤ 1 , the error formula becomes
|ex^ − P 4 (x)| ≤
(x + 1)(x + 12 )x(x − 12 )(x − 1) 5!
e.
At x = 0. 25 , the interpolation error has the upper bound
|e^0.^25 − P 4 (0.25)| ≤
e =. 000995
At x = 0. 75 , the interpolation error is potentially larger:
|e^0.^75 − P 4 (0.75)| ≤
e =. 002323
Note again that the interpolation error will tend to be smaller close to the center of the interpolation interval.
3.2.2 Proof of Newton form and error formula
In this section we explain the reasoning behind two important facts used earlier. First we estab- lish the Newton divided difference form of the interpolating polynomial, and then we prove the interpolation error formula. Recall what we know so far. If x 1 ,... , xn are n distinct points on the real line, we know there is exactly one (degree at most n − 1 ) interpolating polynomial Pn− 1 (x) for these points. We also know that the Lagrange interpolating formula gives such a polynomial. The only thing we don’t know is whether the Newton divided difference formula also gives us an interpolating polynomial. Once we prove that it does in Theorem 3.7, we will know it must agree with the Lagrange version. We start by finding a formula for the degree n − 1 coefficient of Pn− 1 , and then specialize to the Newton form. Consider two other interpolating polynomials: Pn− 2 , which interpolates x 1 ,... , xn− 1 , and Qn− 2 , which interpolates x 2 ,... , xn. The following relation holds between them.
Lemma 3.4 (Pn− 1 (x) − Pn− 2 (x))(xn − x 1 ) = (x − x 1 )(Qn− 2 (x) − Pn− 2 (x))
Proof. Since the difference between the two sides is a polynomial of degree at most n − 1 , it suffices to prove the two sides are equal at any n distinct points. Then by the Fundamental Theorem of Algebra, the difference must be the identically zero polynomial. The n points we choose are the n interpolation points. At x = x 1 , the left side is zero because both Pn− 1 and Pn− 2 interpolate the point (x 1 , y 1 ). The right side is also zero. At x = x 2 ,... , xn− 1 , both sides are zero because all three polynomials, Pn− 1 , Pn− 2 , Qn− 2 interpolate the points. For x = xn, both sides are identical because Pn− 1 (xn) = Qn− 2 (xn). 2
Definition 3.5 We denote the degree n − 1 coefficient of the unique degree ≤ n − 1 polynomial interpo- lating x 1 ,... , xn by f [x 1... xn].
Using this definition, the degree n − 1 coefficient of the left-hand side in Lemma 3.4 is
f [x 1... xn](xn − x 1 )
and the degree n − 1 coefficient of the right-hand side is
f [x 2... xn] − f [x 1... xn− 1 ].
Since they must be equal, we have proved
Lemma 3.6 If f [x 1... xn] denotes the degree n − 1 coefficient of the degree ≤ n − 1 polynomial interpolating x 1 ,... , xn, then
f [x 1... xn] =
f [x 2... xn] − f [x 1... xn− 1 ] xn − x 1
Now we know how to find the degree n − 1 coefficient. Using the recursive nature of (3.8), we can evaluate it using a Newton divided difference triangle.
This formula is true for all x. Now define
h(t) = f (t) − Pn− 1 (t) − f [x 1... xnx](t − x 1 ) · · · (t − xn).
Note that h(x) = 0 by (3.14) and 0 = h(x 1 ) = · · · = h(xn) because Pn− 1 interpolates f at these points. Between each neighboring pair of the n + 1 points x, x 1 ,... , xn, there must be a new point where h′^ = 0, by Rolle’s Theorem (see Chapter 0). There are n of these points. Between each pair of these, there must be a new point where h′′^ = 0; there are n − 1 of these. Continuing in this way, there must be one point c for which h(n)(c) = 0, where c lies between the smallest and largest of x, x 1 ,... , xn. Note that h(n)(t) = f (n)(t) − n!f [x 1... xnx]
because the nth derivative of the polynomial Pn− 1 (t) is zero. Substituting c gives
f [x 1... xnx] = f (n)(c) n!
which leads to
f (x) = Pn− 1 (x) +
f (n)(c) n! (x − x 1 ) · · · (x − xn)
using (3.14).
3.2.3 Runge phenomenon
−3 −2 −1 1 2 3
−
−
−
1
2
3
Figure 3.5: Interpolation of triangular bump function. The interpolating polynomial wiggles much more than the input data points.
Polynomials can fit any set of data points, as Theorem 3.2 shows. However, there are some shapes that polynomials prefer above others. You can achieve a better understanding of this point by playing with Program 3.3. Try data points that cause the function to be zero at equally spaced points x = − 3 , − 2. 5 , − 2 , − 1. 5 ,... , 2. 5 , 3 except for x = 0, where we set a value of 1. The data points are flat along the x-axis except for a triangular ”bump” at x = 0, as shown in Figure 3.5.
The polynomial that goes through points situated like this refuses to stay between 0 and 1 , unlike the data points. This is an illustration of the so-called Runge phenomenon. It is usually used to describe extreme “polynomial wiggle” associated with high-degree polynomial interpolation at evenly-spaced points.
Example 3.9 Interpolate f (x) = 1/(1 + 12x^2 ) at evenly-spaced points in [− 1 , 1].
This is called the Runge example. The function has the same general shape as the triangular bump in Figure 3.5. Figure 3.6 shows the result of the interpolation, behavior that is characteristic of the Runge phenomenon - polynomial wiggle near the ends of the interpolation interval.
−1 1
−
−
1
2
−1 1
−
−
1
2
Figure 3.6: Runge example. Polynomial interpolation of the Runge function of Example 3.9 at evenly-spaced base points causes extreme variation near the ends of the interval, similar to Figure 3.5. (a) 15 base points (b) 25 base points.
As we have seen, examples with the Runge phenomenon characteristically have large error near the outside of the interval of data points. The cure for this problem is intuitive: move some of the interpolation points toward the outside of the interval, where the function producing the data can be better fit. We will see how to accomplish this in the next section on Chebyshev interpolation.
Exercises 3.
3.2.1. (a) Find the degree 2 interpolating polynomial P 2 (x) through the points (0, 0), (π/ 2 , 1), and (π, 0). (b) Calculate P 2 (π/4), an approximation for sin(π/4). (c) Use Theorem 3.3 to give an error bound for the approximation in part (b). (d) Using a calculator or Matlab, compare the actual error to your error bound. 3.2.2. (a) Given the data points (1, 0), (2, ln 2), (4, ln 4), find the degree 2 interpolating polynomial. (b) Use the result of (a) to approximate ln 3. (c) Use Theorem 3.3 to give an error bound for the approximation in part (b). (d) Compare the actual error to your error bound.