3.
2 - Interpolation and Lagrange Polynomials
1. Polynomial Interpolation:
Problem: Given n 1 pairs of data points x i , y i , where y i fx i , i 0, 1, . . . , n for some function
fx, we want to find a polynomial P k x of lowest possible degree for which
P k x i y i , i 0, 1, . . . , n (P k x agrees with fx at x 0 , . . . , x n ).
The polynomial P k x is said to interpolate the data x i , y i , i 0, 1, . . . , n and is called an
interpolating polynomial. Graphically, P k x is an approximation to fx and satisfies the conditions:
P k x i fx i , i 0, 1, . . . , n.
For example,
y
10
-3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.5 1.0 1.5 2.0 2.5 3.0
x
-5
-10
— y fx, - - - y P k x
Obviously, for this example P k x is not a good approximation to fx though P k x satisfies the
conditions:
P k x i y i for i 0, 1, 2.
How to form P k x?
There are several ways to form P k x. Let us start with a way we know already. Let
P k x a 0 a 1 x a 2 x 2 . . . a k x k .
We want to find coefficients a 0 , a 1 , . . . , a k such that the following n 1 equations hold:
P k x i a 0 a 1 x a 2 x 2 . . . a k x k y i for i 0, 1, . . . , n.
Rewrite these n 1 equations in a matrix-vector form:
a0
1 x 0 x 20 x k0 y0
a1
1 x1 x 21 x k1 y1
(*) a2 .
1 x n x 2n x kn yn
ak
a0
a1
The vector a2 is a solution of the system (*) of n 1 linear equations in k 1 unknowns.
ak
1
Consider the case where k n. Recall in Linear Algebra, we learned that this system has a unique
1 x 0 x 20 x k0
1 x 1 x 21 x k1
solution if the coefficient matrix is nonsingular and the solution vector is of the
1 x n x 2n x kn
form:
a0 −1
1 x 0 x 20 x k0 y0
a1
1 x 1 x 21 x k1 y1
a2
1 x n x 2n x kn yn
ak
and can be solved by Gaussian-Elimination and Backward-Substution.
Example Let x 0 0, x 1 0. 6, x 2 0. 9, fx cosx 2 . Find P 2 x a 0 a 1 x a 2 x 2 . Sketch both
y fx and y P 2 x for x in 0, 1.
a0
Solve a1 from the following system:
a2
1 0 0 a0 1
1 0. 6 0. 36 a1 cos0. 36
1 0. 9 0. 81 a2 cos0. 81
−1
a0 1 0 0 1 1. 0
a1 1 0. 6 0. 36 cos0. 36 0. 369 487 601 .
a2 1 0. 9 0. 81 cos0. 81 −0. 793 877 047
Hence, P 2 x 1 0. 369 487 601x − 0. 793 877 047 x 2 .
y 1.0
0.9
0.8
0.7
0.6
0.0 0.2 0.4 0.6 0.8 1.0
x
— y fx, - - - y P 2 x
In MatLab, we can complete this example as follows.
xv[0;0.6;0.9];
A[ones(3,1) xv xv.^2];
2
yvcos(xv.^2);
coeffvinv(A)*yv
coeffv
1.000000000000000
0.369487600719125
-0.793877046537612
Now we sketch the graphs of y cosx 2 and y P 2 x 1 0. 369 487 601x − 0. 793 877 047 x 2 for x
in 0, 1.
xvnew0:0.01:1;
y1cos(xvnew.^2);
y2coeffv(1)coeffv(2)*xvnewcoeffv(3)*xvnew.^2;
plot(xvnew,y1,’r-’,xvnew,y2,’b-.’);
2
red - y=cos(x ), blue -. y=P (x)
2
1.3
1.2
1.1
0.9
0.8
0.7
0.6
0.5
0 0.2 0.4 0.6 0.8 1
If we want to add a pair of data 0. 3, cos0. 09, then we can go over the following steps.
xv[0;0.3;0.6;0.9];
A[ones(4,1) xv xv.^2 xv.^3];
yvcos(xv.^2);
coeffvinv(A)*yv
coeffv
1.000000000000000
-0.064958529434456
0.412917759444563
-0.804529870654783
Hence, P 3 x 1 − 0. 064958529434456x 0. 412917759444563x 2 − 0. 804529870654783x 3 . Now we
sketch the graphs of y cosx 2 and y P 3 x as follows. Remember that xvnew and y1 are still there.
We need to recompute y2.
y2coeffv(1)coeffv(2)*xvnewcoeffv(3)*xvnew.^2coeffv(4)*xvnew.^3;
plot(xvnew,y1,’r-’,xvnew,y2,’b-.’);
title(’red - ycos(x^2), blue -. yP_3(x) ’)
3
2
red - y=cos(x ), blue -. y=P (x)
3
1
0.95
0.9
0.85
0.8
0.75
0.7
0.65
0.6
0.55
0.5
0 0.2 0.4 0.6 0.8 1
Clearly, P 3 x fits y cosx 2 much better than P 2 x does.
Note that the system (*) of linear equations are getting more difficult to solve when n is large. Can
P k x be formed with less computation?
2. Lagrange Interpolating Polynomials:
a. Lagrange Polynomials:
For k 0, 1, . . . , n, define
n
x − x i x − x 0 . . . x − x k−1 x − x k1 . . . x − x n
L n,k x x k − x i
x k − x 0 . . . x k − x k−1 x k − x k1 . . . x k − x n
.
i0, i≠k
L n,k x are called Lagrange polynomials. For example, let x i i, i 0, 1, 2, 3. Then
x 0 0, x 1 1, x 2 2 and x 3 3, and
x − 0x − 2x − 3
L 3,1 x 1 xx − 2x − 3
1 − 01 − 21 − 3 2
xx − 1x − 3
L 3,2 x − 1 xx − 1x − 3
2 − 02 − 12 − 3 2
Observe that Lagrange Polynomials have the following properties:
i. L n,k x k 1
x k − x 0 . . . x k − x k−1 x k − x k1 . . . x k − x n
L n,k x k 1
x k − x 0 . . . x k − x k−1 x k − x k1 . . . x k − x n
ii. L n,k x i 0 for i ≠ k.
x i − x 0 . . . x i − x i . . . x i − x k−1 x i − x k1 . . . x i − x n
L n,k x i 0
x k − x 0 . . . x k − x i . . . x k − x k−1 x k − x k1 . . . x k − x n
For example,
22 − 12 − 3 11 − 11 − 3
L 3,2 2 1 and L 3,2 1 0.
2 − 02 − 12 − 3 2 − 02 − 12 − 3
b. Lagrange Interpolating Polynomials:
The polynomial
4
n
P n x ∑ y k L n,k x y 0 L n,0 x y 1 L n,1 x . . . y n L n,n x
k0
is called the nth Lagrange interpolating polynomial. Observe that for i 0, 1, . . . , n
n
P n x i ∑ y k L n,k x i y i L n,i x i y i .
k0
P n x is an nth polynomial that agrees with fx at x 0 , x 1 , . . . , x n .
Theorem Suppose that x 0 , . . . , x n are distinct numbers in the interval a, b and f n1 is continuous
in a, b . For each x in a, b , there exists a number cx in a, b such that
f n1 cx
fx P n x x − x 0 x − x 1 . . . x − x n .
n 1!
t − x
Proof For x ≠ x i and x in a, b , define ht ft − P n t − fx − P n x k0 x − xkk .
n
Clearly, hx i 0, i 0, 1, . . . , n. Observe that hx 0. Since x ≠ x i ,
ht 0 at t x 0 , x 1 , . . . , x n , x.
Since ht has n 2 distinct zeros in a, b , by Rolle’s Theorem, we know there exists a
constant c in a, b such that h n1 c 0.
n 1!
h n1 t f n1 t − 0 − fx − P n x
x − x 0 x − x 1 x − x n
n 1!
h n1 c f n1 c − 0 − fx − P n x 0
x − x 0 x − x 1 . . . x − x n
f n1 c
R n x fx − P n x x − x 0 x − x 1 x − x n .
n 1!
Recall in Calculus II, we studied nth degree Taylor polynomial at x c :
′′
f ′ c f c f n c
P Taylor x fc x − c x − c 2 x − c n
1! 2! n!
and its error
f n1
R Taylor x x − c n1 where is between x and c.
n 1!
Note that the differences between a kth degree Taylor polynomial and a kth degree interpolating
polynomial are:
a. P Taylor x fx at only x x 0 and P interpolating x fx, at x x 0 , x 1 , . . . , x n .
′ ′′
b. P Taylor requires knowledge of f , f , . . . but P interpolating requires fx 0 , fx 1 , . . . , fx n . Recall in
Calculus II, we studied nth degree Taylor polynomial at x c :
′′
f ′ c f c f n c
P Taylor x fc x − c x − c 2 x − c n
1! 2! n!
and its error
f n1
R Taylor x x − c n1 where is between x and c.
n 1!
Note that the differences between a kth degree Taylor polynomial and a kth degree interpolating
5
polynomial are:
a. P Taylor x fx at only x x 0 and P interpolating x fx, at x x 0 , x 1 , . . . , x n .
′ ′′
b. P Taylor requires knowledge of f , f , . . . but P interpolating requires fx 0 , fx 1 , . . . , fx n .
Example Let x 0 0, x 1 0. 6, x 2 0. 9, fx cosx 2 .
(1) Find the Lagrange interpolating polynomial P 2 x and R 2 x.
(2) Use P 2 x to approximate f0. 45 and estimate the approximation error.
1 1
(3) Approximate cosx 2 dx by P 2 xdx.
0 0
(1)
x − 0. 6x − 0. 9 xx − 0. 9 xx − 0. 6
P 2 x f0 f0. 6 f0. 9
−0. 6−0. 9 0. 6−0. 3 0. 90. 3
cos0. 36 cos0. 81
P 2 x 1 x − 0. 6x − 0. 9 − xx − 0. 9 xx − 0. 6
0. 54 0. 18 0. 27
y 1.0
0.9
0.8
0.7
0.6
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
x
— y cosx 2 , - - - y P 2 x
′ ′′
f x −2x sinx 2 , f x −2sinx 2 2x 2 cosx 2 ,
′′′
f x −22x cosx 2 4x cosx 2 − 4x 3 sinx 2 −43x cosx 2 − 2x 3 sinx 2
− 43c cosc 2 − 2c 3 sinc 2
R 2 x xx − 0. 6x − 0. 9
6
where c is in 0, 1 .
(2)
f0. 45 ≈ P 2 0. 45
1 −0. 15−0. 45 − cos0. 36 0. 45−0. 45 cos0. 81 0. 45−0. 15
0. 54 0. 18 0. 27
1. 005 509
True error cos 0. 45 2 − P 2 0. 45 0. 979 566 8 − 1. 005 509 0. 025 942 2
Find the approximation error:
′′′
f x ≤ max − 43x cosx 2 − 2x 3 sinx 2 ≤ 43 2 20
x in 0,1
6
′′′ ′′′
or check out the graph of f x to have a better estimate of an upper bound of f x :
y6
′′′
5 f x ≤ 6. 5, for x in 0, 1
4
R 2 0. 45 ≤ 6. 5 0. 45−0. 15−0. 45
3 6
2 0. 03290
1
0
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
x
y |−43x cosx 2 − 2x 3 sinx 2 |
(3)
1 1
0 P 2 xdx 0 1 x − 0. 6x − 0. 9 − cos0. 36 xx − 0. 9 cos0. 81 xx − 0. 6 dx
0. 54 0. 18 0. 27
1 cos0. 36 1 2
1 x − 0. 6 2 − 0. 3x − 0. 6 dx − 0 x − 0. 9xdx
0. 54 0 0. 18
cos0. 81 1 2
0. 27
0 x − 0. 6xdx
cos0. 36 cos0. 81
1 0. 123 333 333 − −0. 116 666 667 3. 333 333 33 10 −2
0. 54 0. 18 0. 27
0. 920 118 119
3. Neville’s Iterated Interpolation:
If we need to add more points x n1 , . . . from P n x to construct an interpolation polynomial with
larger degree, can we construct an interpolation polynomial iteratively? The answer is yes. The method
is called the Neville Method.
Let m 1 , m 2 , . . . , m k be k distinct integers where 0 ≤ m i ≤ n for each i. Let P m 1 ,m 2 ...,m k x be the
Lagrange polynomial that agrees with f at the k points: x m 1 , x m 2 , . . . , x m k . For example,
x − x 2 x − x 4 x − x 1 x − x 4 x − x 1 x − x 2
P 1,2,4 x fx 1 fx 2 fx 4
x 1 − x 2 x 1 − x 4 x 2 − x 1 x 2 − x 4 x 4 − x 1 x 4 − x 2
is the Lagrange polynomial that agrees with fx at 3 points: x 1 , x 2 , x 4 :
P 1,2,4 x 1 fx 1 , P 1,2,4 x 2 fx 2 , P 1,2,4 x 3 fx 3 .
Theorem Let f be defined at x 0 , x 1 , . . . , x k , and x j and x k be two distinct numbers. Then
x − x j P 0,1,...,j−1,j1,...,k x − x − x i P 0,1,...,i−1,i1,...,k x
P 0,1,....,k x xi − xj .
Proof We know that both polynomials P 0,1,...,j−1,j1,...,k x and P 0,1,...,i−1,i1,...,k x are degree k − 1. So,
the degree of P 0,1,....,k x is k. Check if P 0,1,....,k x l fx l for l 0, 1, . . . , k : since
P 0,1,...,j−1,j1,...,k x l fx l if l ≠ j and P 0,1,...,i−1,i1,...,k x l fx l if l ≠ i
For l 0, 1, . . . , k, but l ≠ i and l ≠ j,
7
x l − x j P 0,1,...,j−1,j1,...,k x l − x l − x i P 0,1,...,i−1,i1,...,k x l
P 0,1,....,k x l xi − xj
x l − x j fx l − x l − x i fx l x i − x j
fx l fx l
x i − x j x i − x j
For l i :
x i − x j P 0,1,...,j−1,j1,...,k x i − x i − x i P 0,1,...,i−1,i1,...,k x i
P 0,1,....,k x i xi − xj
P 0,1,...,j−1,j1,...,k x i fx i
For l j :
x j − x j P 0,1,...,j−1,j1,...,k x j − x j − x i P 0,1,...,i−1,i1,...,k x j
P 0,1,....,k x i xi − xj
P 0,1,...,i−1,i1,...,k x j fx j
So, P 0,1,....,k x the kth degree interpolating polynomial.
Example Consider x 0 , x 1 , . . . , x n . Then we can form
x − x 2 x − x 1 x − x 4 x − x 4
P 1,2 x fx 1 fx 2 and P 2,4 x fx 2 fx 4
x 1 − x 2 x 2 − x 1 x 1 − x 4 x 2 − x 4
using x 1 , x 2 and x 4 . Then we can combine P 1,2 x and P 2,4 x to form P 1,2,4 x:
x − x 4 P 1,2 x − x − x 1 P 2,4 x
P 1,2,4 x
x 1 − x 4
which is the Lagrange polynomial that agrees with fx at 3 points: x 1 , x 2 , x 4 .
Now given 0, 1 , 1, e −1 , 2, e −4 , and 3, e −9 , find P 0,1,2,3 x using P 0,1,2 x and
P 1,2,3 x.
x − 1x − 2 x − 0x − 2 x − 0x − 1
P 0,1,2 x e −1 e −4
0 − 10 − 2 1 − 01 − 2 2 − 02 − 1
−4
1 x − 1x − 2 − e −1 xx − 2 e xx − 1
2 2
x − 2x − 3 x − 1x − 3 x − 1x − 2
P 1,2,3 x e −1 e −4 e −9
1 − 21 − 3 2 − 12 − 3 3 − 13 − 2
−9
1 e −1 x − 2x − 3 − e −4 x − 1x − 3 e x − 1x − 2
2 2
x − 0P 1,2,3 x − x − 3P 0,1,2 x
P 0,1,2,3 x 1 xP 1,2,3 x − x − 3P 0,1,2 x
3 − 0 2
Algorithm Neville’s Iterated Interpolation: Steps of Computing P 0,1,2,...,k x̄ for a given x̄ : (neville.m)
Given x i , fx i for i 0, 1, . . . , k and , let P i fx i
8
xi P i x̄ P i,i1 x̄ P i,i1,i2 x̄ P i,i1,i2,i3 x̄ P i,i1,i2,i3,i4 x̄
x0 P0
x1 P1 P 0,1 x̄
x2 P2 P 1,2 x̄ P 0,1,2 x̄
x3 P3 P 2,3 x̄ P 1,2,3 x̄ P 0,1,2,3 x̄
x4 P4 P 3,4 x̄ P 2,3,4 x̄ P 1,2,3,4 x̄ P 0,1,2,3,4 x̄
The algorithm stops and fx̄ ≈ P 0,1,2,...,k x̄ whenever
P 0,1,2,...,k x̄ − P 0,1,2,...,k−1 x̄ .
An alternative way:
xi P i x̄ P i,i1 x̄ P i,i1,i2 x̄ P i,i1,i2,i3 x̄ P i,i1,i2,i3,i4 x̄
x0 P0
x1 P1 P 0,1 x̄
x2 P2 P 0,2 x̄ P 0,1,2 x̄
x3 P3 P 0,3 x̄ P 0,2,3 x̄ P 0,1,2,3 x̄
x4 P4 P 0,4 x̄ P 0,3,4 x̄ P 0,2,3,4 x̄ P 0,1,2,3,4 x̄
Example Suppose that x j j for j 0, 1, 2, 3 and it is known that
P 0,1 x x 1, P 1,2 x 3x − 1, and P 1,2,3 1. 5 4.
Find P 2,3 1. 5, P 0,1,2 x and P 0,1,2,3, 1. 5.
x − x 2 P 0,1 x − x − x 0 P 1,2 x x − 2x 1 − x3x − 1
P 0,1,2 x x0 − x2 x2 1
−2
xi P i x̄ P i,i1 x̄ P i,i1,i2 x̄ P i,i1,i2,i3 x̄
0 P0
1 P1 P 0,1 1. 5 2. 5
2 P2 P 1,2 1. 5 3. 5 P 0,1,2 1. 5 3. 25
3 P3 P 2,3 1. 5 P 1,2,3 1. 5 4 P 0,1,2,3 1. 5 5. 4375
x − x 1 P 2,3 x − x − x 3 P 1,2 x x − 1P 2,3 x − x − 33x − 1
P 1,2,3 x x3 − x1 4
3−1
8 1. 5 − 33. 5
P 2,3 1. 5 5. 5
1. 5 − 1
1. 5 − 2P 0,1 1. 5 − 1. 5 − 0P 1,2 1. 5 −0. 52. 5 − 1. 53. 5
P 0,1,2 1. 5 3. 25
0 − 2 −2
9
1. 5 − 3P 0,1,2 1. 5 − 1. 5 − 0P 1,2,3 1. 5 −1. 53. 25 − 1. 54
P 0,1,2,3 1. 5 5. 437 5
0 − 3 −2
Example Neville’s method is used to approximate f0. 4 as follows. Complete the table.
xi P i x̄ P i,i1 x̄ P i,i1,i2 x̄ P i,i1,i2,i3 x̄
0 1
0. 25 2 P 0,1 0. 4 2. 6
0. 5 P2 P 1,2 0. 4 P 0,1,2 0. 4
0. 75 8 P 2,3 0. 4 2. 4 P 1,2,3 0. 4 2. 96 P 0,1,2,3 0. 4 3. 016
0. 4 − 0. 75P 2 − 0. 4 − 0. 5P 3 2. 4−0. 25 − 0. 18
P 2,3 0. 4 2. 4, P 2 4
0. 5 − 0. 75 −0. 35
0. 4 − 0. 5P 1 − 0. 4 − 0. 25P 2 0. 4 − 0. 52 − 0. 4 − 0. 254
P 1,2 0. 4 3. 2
0. 25 − 0. 5 0. 25 − 0. 5
0. 4 − 0. 5P 0,1 0. 4 − 0. 4 − 0P 1,2 0. 4 0. 4 − 0. 52. 6 − 0. 4 − 03. 2
P 0,1,2 0. 4 3. 08
0 − 0. 5 0 − 0. 5
Check:
0. 4 − 0. 753. 08 − 0. 4 − 02. 96
P 0,1,2,3 0. 4 3. 016
0 − 0. 75
Example Let fx sinln x, x 0 2. 0, x 1 2. 4, x 2 2. 6.
(1) Estimate the approximation error R 2 x of an interpolating polynomial
P 2 x over 2. 0, 2. 6 .
(2) Approximate f2. 2 and f2. 5, and estimate their errors.
(1)
′′′
f c
R 2 x x − 2x − 2. 4x − 2. 6 , where c is in 2, 2. 6
3!
′ cosln x ′′ − sinln x 1x x − cosln x − sinln x − cosln x
f x x , f x 2
x x2
′′′ − cosln x 1x sinln x 1x x 2 2xsinln x cosln x
f x
x4
− cosln x sinln x 2sinln x cosln x 3 sinln x cosln x
3
x x3
10
y 0.32 y
0.015
0.30
0.28
0.010
0.26
0.24
0.005
0.22
0.20
0.18 0.000
2.0 2.1 2.2 2.3 2.4 2.5 2.6
2.0 2.1 2.2 2.3 2.4 2.5 2.6 x
′′′
f x y |x − 2x − 2. 4x − 2. 6|
′′′ ′′′ 3 sinln 2 cosln 2
f x ≤ f 2 0. 336
23
′′′
f c
R 2 x x − 2x − 2. 4x − 2. 6 ≤ 0. 336 0. 02 0. 001 12
3! 6
(2) xv[2;2.4;2.6];
yvsin(log(xv));
[yout,yall]neville(xv,yv,2.1,2)
yout 0.67510095866951
yall
0.63896127631363 0.67118192650420 0.67510095866951
0.76784387707588 0.69469611949605 0
0.81660904879577 0 0
[yout,yall]neville(xv,yv,2.5,2)
yout 0.79353280699093
yall
0.63896127631363 0.80006452726644 0.79353280699093
0.76784387707588 0.79222646293583 0
0.81660904879577 0 0
true error: |sinlog2. 1 − 0. 67510095866951| 6. 163 548 3 10 −4
true error: |sinlog2. 5 − 0. 79353280699093| 1. 838 044 02 10 −4
′′′ ′′′
f c f c
R 2 2. 1 2. 1 − 22. 1 − 2. 42. 1 − 2. 6 |2. 1 − 22. 1 − 2. 42. 1 − 2. 6|
3! 6
≤ 0. 336 0. 015 0. 00084
6
′′′ ′′′
f c f c
R 2 2. 5 2. 5 − 22. 5 − 2. 42. 5 − 2. 6 |2. 5 − 22. 5 − 2. 42. 5 − 2. 6|
3! 6
≤ 0. 336 0. 005 0. 000 28
6
11
Exercises:
1. Given x i , y i 0, −1, 12 , 1, 1, 2 where y i fx i for some fx, construct the polynomial
P 2 x that agrees with fx at x 0 , x 1 and x 2 in the following two ways.
(1) P 2 x a 0 a 1 x a 2 x 2 a standard form.
(2) P 2 x is a Lagrange interpolating polynomial.
2. Let x 0 −1, x 1 0, x 2 1, and fx e x .
(1) Find algebraically (keep e in P 2 x) the Lagrange interpolating polynomial P 2 x and its
approximation error R 2 x.
(2) Use P 2 x to approximate f 12 and f − 13 .
(3) Compute the true approximation errors f 12 − P 2 12 and f − 13 − P 2 − 13 .
(4) Estimate the approximation errors using R 2 12 and R 2 − 13 .
1 1 1 1
(5) Approximate e x dx by P 2 xdx and find the true approximation error e x dx − P 2 xdx .
−1 −1 −1 0
3. Let x 0 0, x 1 0. 6, x 2 0. 9, and fx 1 x .
(1) Find the Lagrange interpolating polynomial P 2 x and its approximation error R 2 x.
(2) Use P 2 x to approximate f0. 45 and |R 2 0. 45| to estimate the approximation error.
4. Use Neville’s method to approximate f0. 5, giving the following table. Determine P 2 f0. 7.
i xi Pi P i,i1 P i,i1,i2
0 0 0
1 0. 4 2. 8 3. 5
27
2 0. 7 7
5. Suppose we know that f0 1, f0. 25 1. 64872, f0. 5 2. 71828, f0. 75 4. 48169. Use given
data to approximate f0. 43 by a Lagrange interpolating polynomial using Neville’s method (MatLab
program neville.m).
6. A census of the population of the US is taken every 10 years. The population, in thousands, from 1940
to 2000 is given below.
year 1940 1950 1960 1970 1980 1990 2000
t 0 10 20 30 40 50 60
population 132165 151326 179323 203302 226542 249633 251432
Use Neville’s method (MatLab program neville.m) to estimate the populations in 1975 and 2005 and
predict the population in 2010.
7. Let fx 2 x . Approximate f0. 5 2 by P0. 5 where Px is a Lagrangian interpolating
polynomial. Suppose that Neville’s Method is used to generate P0. 5 iteratively as follows.
12
P 0 0. 5 P 0,1 0. 5 P 0,1,2 0. 5 P 0,1,2,3 0. 5 P 0,1,2,3,4 0. 5 P 0,1,2,3,4,5 0. 5 P 0,1,2,3,4,5,6 0. 5
1. 00000000 1. 35886731 1. 41038161 1. 41407897 1. 41421166 1. 41421356 1. 41421357
Let the stopping criterion be set as | P 01k 0. 5 − P 01k−1 0. 5 | .
a. Determine the degree (k) of the polynomial used to approximate 2 with 0. 0001.
b. If P 0,1,2,3,4,5,6 0. 5 is chosen from above sequence to approximate 2 , what is ?
13