









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!










In the previous sections we encountered two different ways of representing the unique n th order (or lower) polynomial required to pass through a given set of n +1 points. Yet another way of writing the polynomial, constrained in the same fashion, is presented here. It is referred to as Lagrange's form of the interpolating polynomial.
Once again, we assume the existence of a set of data points ( xi , yi ), i = 0, 1, …, n obtained from a function f ( x ) so that yi = f ( xi ), i = 0, 1, …, n. A suitable function for interpolation I ( x ) is expressible as
I x Li x f xi i
n ( ) = ( ) ⋅ ( ) =
0
= L (^) 0 ( ) x ⋅ f ( x (^) 0 ) + L 1 (^) ( ) x ⋅ f ( x (^) 1 ) .....+ + L (^) n ( ) x ⋅ f ( xn ) (4.1a)
The functions L (^) i ( x ), i = 0, 1, …, n are chosen to satisfy
L (^) i x
i i n
i
0 1 1 1 (4.2)
Before we actually define the L (^) i ( x ) functions, let's be certain we understand the implications of Equations (4.1) and (4.2). The best way to accomplish this is simply to choose a value for " n " and write out the resulting equations. Suppose we have the four data points [ x i , f ( x i )], i = 0, 1, 2, 3. From Equations (4.1) with n = 3, the interpolating function I ( x ) becomes
I x L (^) i x f xi i
=
0
3 (4.3)
= L (^) 0 ( ) x ⋅ f ( x (^) 0 ) + L 1 (^) ( ) x ⋅ f ( x (^) 1 ) + L (^) 2 ( ) x ⋅ f ( x (^) 2 ) + L (^) 3 ( ) x ⋅ f ( x 3 ) (4.3a)
and it remains to be shown that I ( x ) is identical to f ( x ) when x is any one of the four data points. Evaluating I ( x ) at x 0 , x 1 , x 2 and x 3 ,
I x ( (^) 0 ) = L (^) 0 ( x (^) 0 ) ⋅ f ( x (^) 0 ) + L 1 (^) ( x (^) 0 ) ⋅ f ( x 1 (^) ) + L 2 (^) ( x (^) 0 ) ⋅ f ( x (^) 2 ) + L (^) 3 ( x (^) 0 ) ⋅ f ( x 3 ) (4.4)
I x ( (^) 1 ) = L (^) 0 ( x (^) 1 ) ⋅ f ( x (^) 0 ) + L (^) 1 ( x 1 (^) ) ⋅ f ( x (^) 1 ) + L (^) 2 ( x (^) 1 ) ⋅ f ( x (^) 2 ) + L (^) 3 ( x (^) 1 ) ⋅ f ( x 3 ) (4.4a)
I x ( (^) 2 ) = L (^) 0 ( x (^) 2 ) ⋅ f ( x (^) 0 ) + L (^) 1 ( x (^) 2 ) ⋅ f ( x (^) 1 ) + L (^) 2 ( x (^) 2 ) ⋅ f ( x (^) 2 ) + L (^) 3 ( x (^) 2 ) ⋅ f ( x 3 ) (4.4b)
I x ( (^) 3 ) = L (^) 0 ( x (^) 3 ) ⋅ f ( x (^) 0 ) + L 1 (^) ( x (^) 3 ) ⋅ f ( x (^) 1 ) + L 2 (^) ( x (^) 3 ) ⋅ f ( x (^) 2 ) + L 3 (^) ( x (^) 3 ) ⋅ f ( x 3 ) (4.4c)
According to Equation (4.2), L 0 ( x 0 ) = 1 and L 1 ( x 0 ) = L 2 ( x 0 ) = L 3 ( x 0 ) = 0. Equation (4.4) is simplified as shown below.
I x L x f x L x f x L x f x L x f x
f x f x f x f x
f x
0 0 0 0 1 0 1 2 0 2 3 0 3
0 1 2 3
0
By the same reasoning, I ( x 1 ) = f ( x 1 ), I ( x 2 ) = f ( x 2 ), and I ( x 3 ) = f ( x 3 ) which means the interpolating function I ( x ) passes through the given set of data points.
The analytical form of I ( x ) depends on the functions L i ( x ), i = 0,1, …, n that satisfy Equation (4.2). They are called Lagrange coefficient polynomials and are defined as follows:
L x
x x x x i i^ n
j i j j i i n
, ..., , , ...,
= − +
0, 1 1 1
The symbol ∏ in Equation (4.5) is a symbolic notation for multiplication in the same way the symbol ∑ denotes summation of its arguments. To better understand Equation (4.5), L (^) i ( x ) are expressed in a more explicit form. Given below are expressions for L 1 ( x ) through L 3 ( x ) when there are four data points ( n = 3).
i L x
x x x x x x x x x x x x
0 1 0 2 0 3
i L x
x x x x x x x x x x x x
1 0 1 2 1 3
(4.6a)
i L x
x x x x x x x x x x x x
2 0 2 1 2 3
(4.6b)
i L x
x x x x x x x x x x x x
3 0 3 1 3 2
(4.6c)
t t t t t t t t t t t t t t t t
v t
t t t t t t t t t t t t t t t t
(^0 1 3 4) v t 2 0 2 1 2 3 2 4
2
0 1 2 4 3 0 3 1 3 2 3 4
3
t t t t t t t t t t t t t t t t
(^0 1 2 3) v t 4 0 4 1 4 2 4 3
f t t t t t t t t t
t t t t t t t t
4
1 2 3 4 0 1 0 2 0 3 0 4
140 2 3 4 1 0 1 2 1 3 1 4
130
1 3 4 2 0 2 1 2 3 2 4
100 1 2 4 3 0 3 1 3 2 3 4
0 40
( ) ( )( )( )( ) ( )( )( )( )
. ( )( )( ) ( )( )( )( )
.
( )( )( ) ( )( )( )( )
. (^ )(^ )(^ ) ( )( )( )( )
.
= − − − − − − − −
⋅ + − − − − − − −
⋅
− − − − − − −
⋅ + − − − − − − −
⋅
− − − − − − −
⋅
t t ( )( t )( t ) ( )( )( )( )
.
1 2 3 4 0 4 1 4 2 4 3
f (^) 4 ( ) t = 1 4 24.^ ( t − 1 )( t − 2 )( t − 3 )( t − 4 ) − 1 3 6. t t ( − 2 )( t − 3 )( t − 4 ) + 1004 t t ( − 1 )( t − 3 )( t − 4 )
− 0 40. 6 t t ( − 1 )( t − 2 )( t − 4 ) + 0 05 24. t t ( − 1 )( t − 2 )( t − 3 ) (4.9)
The same procedure is used to obtain the fourth order Lagrange interpolating polynomials for the two alkaline batteries. Figure 4.1 shows the data points and the fourth order interpolating polynomial for each battery.
It is generally advisable to begin with lower order polynomials for interpolation and then increase the order in a systematic fashion until the results are acceptable. In other words, a reduced subset of data points is chosen based on the expected range of the interpolant. Suppose we have n +1 data points measured from a function f ( x ) where the range of x is from x min to x max. Assuming interpolation over the entire interval is required with a single polynomial, we might choose a third or possibly fourth order polynomial (assuming n >4) based on a judicious choice of four or five points that include both extremes. Visual inspection of the polynomial and its relationship to the entire set of data points will determine if a higher order polynomial is required and which additional data point should be included.
When an additional data point is required, the higher order polynomial will generally exhibit more curvature than the previous one throughout the interpolation interval. For example, Figure 4.2 shows polynomials of order n =1, 2, 3, and 4 required to pass through data sets of two, three, four, and five points respectively
Figure 4.1 Fourth Order Interpolating Polynomials For Battery Data in Table 4.
It's clear that the quadratic polynomial f 2 ( x ) exhibits more curvature than the linear function f 1 ( x ) which of course has none. This is possible due to the presence of the x^2 term in f 2 ( x ). Similarly f 3 ( x ) curves more than f 2 ( x ) due to the additional point [ x 3 , f ( x 3 )] and the fourth order term x^4 in f 4 ( x ) accounts for the added curvature compared to f 3 ( x ) over the interval (0,4).
With an n th interpolating polynomial in standard form, Equation (2.1), or the Newton divided-difference form, Equation (3.1), there is only one high order term, i.e. a single term with xn. This is in contrast to the Lagrange form of the interpolating polynomial, Equation (4.1), in which each term of the overall expression is an n th order polynomial. If the order of the interpolating polynomial is to be increased from n to n + by including an additional data point, each Lagrange coefficient polynomial in Equation (4.5) increases in order from n to n +1 as well. Consequently, the entire Lagrange interpolating polynomial must be recomputed.
Despite the fact interpolating polynomials in standard form contain a single high order term, an extra data point requires recalculation of all the coefficients a i , i = 0,1,2, …, n in addition to the new coefficient a n +1. The system of equations to be solved was considered in Section 3.2 and enumerated in matrix form in Equation (2.3). The Vandermonde matrix and the column vectors of coefficients and function values in Equation (2.3) are ( n +1) × ( n +1), n × 1, and n × 1, respectively.
Ni-Cd
Alkaline, 1 st^ Charge
Alkaline, 2 nd^ Charge
advantage of Newton divided-difference interpolating polynomials is the reduced computational effort (compared with the Lagrange form) to obtain f (^) n +1 ( x ) when f (^) n ( x ) is already computed.
Example 4.
In Example 4.1, estimate the error incurred by the use of a fourth order Lagrange interpolating polynomial for approximating the voltage of a Ni-Cd battery after 1. hours. Assume an additional data point is available, namely t = 2.5 hours, v = 0.7 volts. From Equation (4.9),
f (^) 4 (. ) 15 = 1 4 24.^ (. 15 − 1 15)(. − 2 )(. 15 − 3 15)(. − 4 ) − 1 3 6 .15 15. (. − 2 )(. 15 − 3 15)(. − 4 )
f (^) 4 (. ) 15 = 11965.
Supplementing Table 4.1 with the new data point and determining the fifth order Lagrange interpolating polynomial yields,
f t t t t t t t t t t t 5
1 2 3 4 2 5 0 1 0 2 0 3 0 4 0 2 5
140 2 3 4 2 5 1 0 1 2 1 3 1 4 1 2 5
( ) 130 ( )( )( )( )(. ) ( )( )( )( )(. )
. ( )( )( )(. ) ( )( )( )( )(. )
=. − − − − − − − − − −
⋅ + − − − − − − − − −
− − − − − − − − −
⋅ + − − − − − − − − −
⋅ t t ( )( t )( t )( t. ) t t t t t ( )( )( )( )(. )
. ( )( )( )(. ) ( )( )( )( )(. )
. 1 3 4 2 5 2 0 2 1 2 3 2 4 2 2 5
100 1 2 4 2 5 3 0 3 1 3 2 3 4 3 2 5
0 40
− − − − − − − − −
⋅ +
− − − − − − − − −
t t ( )( t )( t )( t. ) t t t t t ( )( )( )( )(. )
.
( )( )( )( ) (. )(. )(. )(. )(. )
.
1 2 3 2 5 4 0 4 1 4 2 4 3 4 2 5
0 05
1 2 3 4 2 5 0 2 5 1 2 5 2 2 5 3 2 5 4
0 70
R 4 (1.5) is the difference between the true (unknown) function value f (1.5) and the fourth order interpolating polynomial estimate f 4 (1.5), i.e.
R (^) 4 (. ) 15 = f (. ) 15 − f 4 (. ) 15
We can estimate R 4 (1.5) using
R (^) 4 (. ) 15 ≈ f (^) 5 (. ) 15 − f 4 (. ) 15 ≈ 12148. − 11965. ≈ 0 0184.
Exercises
Density, ρ (vehicles/mile)
Velocity, u (mph) 20.5 39. 31.2 30. 50.4 22. 86.4 13. 120.9 6. 160.0 4.
Data for Problem 1
a) Graph the data points. b) Find a third order Lagrange polynomial u = f 3 (ρ) suitable for interpolation over the entire range of densities. Plot the polynomial on the same graph as the data points. c) Calculate the true error f (ρ) - f 3 (ρ), where u = f (ρ) is the true function, at the two remaining data points. d) Estimate the average speed of traffic when the mile and a half long tunnel has 75 cars uniformly spaced in it. e) Suppose the speed limit in the tunnel is 35 mph. Estimate the uniform traffic density throughout the tunnel at which traffic tends to flow at the speed limit. f) The traffic flow q (vehicles/hr) through the tunnel under steady-state conditions (uniform density and constant speed) is the product of traffic density, ρ (vehicles/mile) and vehicle speed, u (miles/hr). Generate a graph of q vs. ρ for the tunnel using the Lagrange polynomial from Part b). Traffic engineers refer to this as the Fundamental Diagram of Traffic Flow.
f) Try to find an interpolating polynomial that can be used to provide reasonably accurate estimates of g over the entire interval 0 ≤ h ≤ 50 × 10 6 m. Generate more data points from the true function g = f ( h ) if you think this will help. g) Use an appropriate Lagrange interpolating polynomial to estimate the distance from the earth's surface where you weigh one half of your weight on earth. h) Calculate the error in the estimated distance in Part g).
Graphs for Problem 3
a) Select one of the curves and generate a set of tightly spaced data points sampled from the curve. Represent the actual curve by a piecewise linear approximation through the data points. Graph the approximating function, which should appear smooth, as a dotted curve without showing the data points. Label it H = f ( D ). b) For the same curve selected in Part a) generate a reduced set of sampled data points (no more than 10) that captures the basic profile of the curve. c) Try to fit a Lagrange interpolating polynomial f (^) n ( D ) over the entire interval represented by the data points. Plot the piecewise function f ( D ), the interpolating polynomial f (^) n ( D ) and the data points on the same graph.
(volts)
(milliamperes)
(volts)
(milliamperes) 1.421 0.095 1.420 0. 1.441 0.155 1.440 0. 1.446 0.281 1.460 0. 1.487 0.461 1.480 0. 1.512 0.808 1.500 0. 1.535 1.390 1.520 1. 1.556 2.350 1.540 1. 1.557 4.080 1.560 2. 1.596 6.720 1.580 4.
Table for Problem 4
a) Plot the measured and calculated current vs. voltage data points on separate graphs. b) Find second, third and fourth order Lagrange interpolating polynomials for each set based on the following data points. MEASURED: ORDER DATA POINTS 2 (1.421,0.095),(1.512, 0.808),(1.596,6.720) 3 (1.421,0.095),(1.487, 0.461),(1.535,1.390),(1.596,6.720) 4 (1.421,0.095),(1.446, 0.281),(1.512, 0.808), 1.556, 2.350),(1.596,6.720)
b) Find the lowest order Lagrange interpolating polynomials that describe both profiles reasonably well. (They do not have to be the same order) c) Plot the polynomials from Part b) on the same graph as the data points. d) Select several additional data points from both profiles and calculate the true error f ( θ i )- f (^) n ( θ i ), where n is the order of the polynomial, at each of those points.
Loan Period n (months)
Annualized Interest rate i (%)
Monthly Payment A ($) 24 5.0 1535. 36 5.5 1056. 48 6.0 821. 60 6.5 684. 72 7.0 596.
Table for Problem 6
a) Plot the data points ( n (^) k , Ak ), k = 1,2,3,4,5. b) Find the 4 th^ order Lagrange interpolating polynomial A = f 4 ( n ) through the data points and plot it on the same graph. c) The bank is willing to write the loan for any number of months between 24 and
A f P i n P
i i n = = (^) i n
L N
M
O Q
( , , ) (^) P
1200 1200 1200
Find the true error in the estimated monthly payment f 4 (42) calculated in Part c), i.e. f (35000, i (42), 42) - f 4 (42). f) The car buyer can afford monthly payments of $770. Use the graph A = f 4 ( n ) to estimate (to the nearest month) the loan duration requiring this amount of payment.
g) Find the true loan duration (to the nearest month) when the monthly payment is $770. and compare the result to the answer in Part f). Hint: You will need to solve A = f ( P , i , n ) for n by trial and error since i is unknown as well.
Birth Year Net Lifetime Benefits 1885 $29, 1900 $51, 1915 $60, 1930 $14, 1945 -$18, 1960 -$33, 1975 -$32, 1985 -$31,
Data for Problem 7
a) Graph the data points. b) Find the seventh order Lagrange interpolating polynomial passing through the data points and plot it on the same graph. c) Estimate the year of birth for a social security recipient to have net benefits of zero. d) Estimate the maximum net lifetime social security benefits and the year of birth for recipients receiving the maximum.
i xi yi = f ( xi ) 0 ln1 1 1 ln12 12 2 ln7 7
Table for Problem 8
a) Find the first order Lagrange polynomial f 1 ( x ) to be used for estimating f (ln5).