(X) e Cosx X 0.: 5. Interpolation
(X) e Cosx X 0.: 5. Interpolation
INTERPOLATION
5.1. Introduction
In this chapter, we discuss the problem of approximating a given function by polynomials.
There are two main uses of these approximating polynomials. The first use is to reconstruct the function
x−3−x =0 when it is not given explicitly and only values of ii ) are given at a set of distinct points called
nodes or tabular points. The second use is to perform the required operations which were intended for
4 x2−ex=0 , like determination of roots, differentiation and integration etc. can be carried out using the
approximating polynomialiii ) . The approximating polynomial x −2x −4x+2=0 can be used to predict the value of
3 2
f (x)=0 at a non tabular point. The deviation of f 1(x)=f 2 (x), from y=f 1 (x ) , that is y=f 2 (x ) – f (x)=0. , is called the
error of approximation.
−x
Let f(x)=e cosx−x=0. be a continuous function defined on some interval [a,b], and be prescribed at f 1(x)=e cosx
−x
distinct tabular points f 2(x)=−x ,f(x)=f1(x)+f2(x),f 1(x) , . . . , −f 2(x) such that −f 2( x )= x . The distinct tabular
The problem of polynomial approximation is to find a polynomial m , of degree ≤ n, which fits the
given data exactly, that is,
(a , b ) = f (m)=0. , ( a , b ) , (5.1)
The polynomial [ a , b ] is called the interpolating polynomial. The conditions given in (5.1) are
called the interpolating conditions. The interpolation polynomial fitting a given data is unique. We may
express it in various forms but are otherwise the same polynomial. For example, m
can be written as
a 1= a =b 1=b
to find f (a1 ) , a polynomial of f (b1 ). degree such that f(m1) and f (a1 ) agree at the tabulated points. Let the
values of m∈(m1,b1). be equidistant, that is,
a 2= m1 , for b 2=b 1 .
Therefore , f ( m 1 ) , f ( a1 ) , etc.
m ∈( a1 , m1 ). , for a 2= a1
b =m .
Since 2 1 is a polynomial of [a2 ,b2 ]. degree, it may be written as
y
( b , f ( b) ) ( 5.2)
The
m 2 unknowns m3 ,m1 ,a , . . . , x can be found as follows
b 0=1 i.e
a +b 0+1
m1= 0 0 = =0.5
2 2
Similarly putf (m1)=f (0.5)=−1.375<0, , for f (a0 )f (m1 )<0 , , in ( 5.2) we obtain
by n ,
a n−1 ,b n−1 , m n , . . ., f(mn )f(an−1 ) we obtain ,
f ( x )= x 3 − x −4 = 0
f ( x )= x 3 −x−4 , ( 5.3)
f ( 1 )=− 4 ,
f ( 2 )= 2 . (5.4)
This is Newton’s forward difference interpolation formula and useful for interpolating near the beginning
of a set of tabular values.
5.2.2 Newton’s Backward Difference Interpolation Formula
to find [1,2], , a polynomial of f(1)=−5, degree such that f(2)=14 and [1,2]. agree at the tabulated points. Let the
values of [1,2] be equidistant, that is,
f (1.5)=2.375>0. , for [ 1 , 1. 5 ]
Instead of assuming
a n as in ( 5.2), if we choose it in the form
b n
m n ( 5.5)
m = |m−m |<|b −a |= |a |<|m|,
then the f ( m n ) unknowns 13 ,m , 13 14 14 , . . . , 14 can be found as follows
|m− m13|
Put |m| in ( 5.5) we obtain ,
|b 14 − a14|
|a14| i.e m (since the other terms in ( 5.5) vanish)
m 13 . i.e
|f(m9)|<|f(m13)|,
Similarly putn for
|m− m n|, in ( 5.5) we obtain
,
f ,
[ a,b] f(a)f(b)<0.
, . . .,
mn ∞n=1
{ } ξ ,|m −ξ|≤b−a2 ,, . . . , n≥1. in ( 5.5)
now substitute , n n
a +b
by n≥1 , ,
b n−an=
b−a
2n−1 ξ ,
(a ,b ).
n n ,. . .m=
2 n
n n
we obtain ,
n ≥1 ,
b n −an b− a
|m n −ξ|≤ = .
2 2n (5.6)
a =1
b =2 . (5.7)
This is Newton’s backward difference interpolation formula and useful for interpolating near the end of
the tabular values.
Example 5.1: Using Newton’s forward difference interpolation formula, find the form of the
Solution: We have the following forward difference table for the data.
The forward differences can be written in a tabular form as in Table 5.1.
⇒
−n
n 2−n <10−5 ⇒ log102
−5
log1010 =−5
0 1
1
1 2 -2
-1 12
2 1 10
9
3 10
Table 5.1. forward differences.
2
Since −nlog10 <−5 ,the cubic Newton’s forward difference interpolation polynomial becomes:
⇒
5
2
≃16 . 6
n log 10
[ log ( b −a )−log ε ]
n≥ .
log 2
f ( x )= x 3 + 4 x 2 −10=0
a =1
b =2 .
Example 5.2: Find the interpolating polynomial corresponding to the data (1,5),(2,9),(3,14),and
(4,21). Using Newton’s backward difference interpolation polynomial.
Solution: We have the following backward difference table for the data.
The backward differences can be written in a tabular form as in Table 5.2.
i)
x5−4x−2=0 ii ) cosx=3x−1 iii)
1 5
4
2 9 1
5 1
3 14 2
7
4 21
Table 5.2. backward differences.
3 2
Since x −2x −1=0 ,the cubic Newton’s backward difference interpolation polynomial becomes:
iv )
sin x=1+ x 3 , 5x3−20x2+3=0
( −2 ,−1 ) ,
i )
3 x−e x=0
Example 5.3: The table below gives the value of 1≤x≤2 ii ) 2 x+3 cos x−e x =0
0≤x≤1 0.10 0.15 0.20 0.25 0.30
f (x)=0, 0.1003 0.1511 0.2027 0.2553 0.3093
Find:
(xk−1, xk), f k −1 f k <0 , f(xk−1)=f k−1 , f ( x k )=f k .
Solution: We have the following forward difference table for the data.
The forward differences can be written in a tabular form as in Table 5.3.
, P(xk−1, fk−1) Q(x k , f k ) f(x)=0. P Q PQ
0.10 0.1003
0.0508
0.15 0.1511 0.0008
0.0516 0.0002
0.20 0.2027 0.0010 0.0002
0.0526 0.0004
0.25 0.2553 0.0014
0.0540
0.30 0.3093
we have PQ 0.12 , f
y −f
k−1 −f k
k
=
x − xk
x k −1− x k and
PQ
Hence formula (5.4) gives
x− y= 0 ,
x ,
=0.1205.
x k −1 −x k
x=x k −( )f
ii) To find f k −1 −f k k we use Newton’s back ward difference interpolation polynomial.
we have =x k −(
x k −x k−1
f k −f k−1
)f k
0.26 ,
x k + 1= x k−(
x k − x k −1
f k − f k −1
)f k
and
k =1 ,2 , 3 , .. .
Hence formula (5.7) gives
( x 0 , x 1 ) , f ( x 0 ) f ( x 2 )<0 ,
( x0 , x2) .
( x 2 , x1 ) .
( x0 , x1) ,
=0.2662
Example 5.4: Using Newton’s forward difference formula , find the sum
x 3 −3 x +1=0 .
Solution:
We have f ( x ).
Hence x
or f ( x)
It follows that ( 0 , 1) .
( 1 , 2 ).
x >2
Since f ( x )>0 , x>2. is a fourth degree polynomial in (0,1).
Further,
x 0 =0 , x 1=1 , f 0=f (x0 )=f (0)=1, f 1=f(x1 )=f (1)=−1. ,f(x2 )=f(0.5)=−0.375.
Hence formula (5.4) gives
f ( 0 ) f ( 0 . 5 )<0 ,
( 0 , 0 .5 ).
,f(x3 )=f(0.36364)=−0.04283.
f(0)f(0.36364)<0,
Activity 5.1:
1. Find (0,0.36364). as a polynomial in ,f(x4)=f(0.34870)=−0. 0370. for the following data by Newton’s forward difference
Formula
f(0)f(0.34870)<0, 3 4 5 6 7 8 9
(0,0.34870). 13 21 31 43 57 73 91
3. Given
x≈x6= 0.20 0.22 0.24 0.26 0.28 0.3
x6 1.6596 1.6698 1.6804 1.6912 1.7024 1.7139
⇒ ⇒ n
−5
log1010 =−5
−nlog120<−5 …
a=1 b=2 .
5 [log(b−a)−logε]
2
log 10
≃16 .6 n≥
log2
. f(x)=x3+4x2−10=0 …
be given at distinct unevenly spaced points or non-uniform points i ) ,x −4x−2=0 ,ii ) , . . . , cos x=3x−1 . This data may also
5
be given at evenly spaced points. For this data, we can fit a unique polynomial of degree ≤ n. Since the
interpolating Polynomial must use all the ordinates iii ) x −2x −1=0 iv )
3 2
it can be written as a linear
combination of these ordinates. That is,
we can write the polynomial as
5x3−20x2+3=0 = sinx=1+x3 , (−2,−1), + i ) 3 x−e x=0 + ... + 1≤x≤2 ii )
f f <0,
= 2x+3cosx−e =0 0≤x≤1 + f (x)=0, (xk−1 ,xk ), + ... + k−1 k f ( xk−1)=f k−1 ,
x
f ( x k )=f k . (5.15)
where ,P(xk−1 ,f k−1 ) =Q(xk ,f k ) and f (x)=0. ), P are polynomials of degree n. This polynomial fits the data
given in (5.1) exactly.
At Q = PQ , we get
[x k−1 , x k ]. PQ = y−f k
=
x−x k
f k−1−f k x k−1− x k PQ + x− y=0 , + ... + x , x=x k −(
x k−1−x k
f k−1−f k
)f k
(0,1). = 01i=
i≠ j
j { (5.16)
Since,
x 0 =0, = 0 at x 1=1 , ,f0=f(x0)=f(0)=1,,f1=f(x1)=f (1)=−1., . . . , x =x ff −x−f f =−1−10−1 =0.5,,f (x2)=f (0.5)=−0.375., . . . , f (0)f (0.5)<0,, we know that
2
01 10
1 0
x f −x f 0−0.36364(1)
(0,0.5). , ,, f (x3)=f(0. 36364)=−0. 04283., . . . , f(0)f(0.36364)<0, ,(0,0.36364). , . . . ,
x0 f 2−x2 f 0 0−0.5(1)
x 3= = =0.36364 x 4= 0 3 3 0 = =0.34870
f 2−f 0 −0.375−1 f 3−f 0 −0.04283−1
are factors of ,f (x4)=f (0.34870)=−0.0 370.The product of these factors is a polynomial of degree n.
Therefore, we can write
x0 f 5−x5 f 0 0−0.34741(1)
f(0)f(0.34870)<0,(0,0.34870). ,f(x5 )=f(0.34741)=−0.00030. f(0)f(0.34741)<0,(0,0.34741). x
x0 f 4−x4 f 0 0−0.3487(1)
x 5= = =0.34741 6 = =0.347306
f 4−f 0 −0.00370−1 f 5−f 0 −0.0003−1
Now, since
x≈x 6 = = 1, we get
x0 f 1−x 1 f 0
x6 = 1 = x=0 f(1)=−2.17798.f (0) f (1)<0,( 0 , 1) . x 2=
f 1−f 0
=
0−1(1)
−2.177985−1
=0.31467
(0.44673,1).
x 3 f 1 −x 1 f 3 0.44673(−2.17798)−91)−(1)0.20354
x 4= = =0.49402
Hence, f 1 −f 3 −2.17798−0.20354
Therefore,
, f (x 4 )=f (0 . 49402)=0. 07079 . (5.17)
x f −x f 0.4902(−2.1798)−(1)0. 70 9
Note that the denominator on the right hand side of f(0 . 49402)f (1 )< 0, is obtained by setting(0.49402,1).= f−f −2.1798−0.709 in
x5= 4 1 1 4= =0.509 5
14
the numerator. The polynomial given in (5.15) where ,f (x5)=f (0.509 5)=0.02360 . are defined by (5.17) , i.e,
f(0.50995)f(1)<0, (5.18)
is called the Lagrange interpolating polynomial and (0.50995,1). are called the Lagrange fundamental
polynomials.
x5f1−x1f5 0.509 5(−2.17 98)−(1)0.02360
x 6= = =0.51520
We can write the Lagrange fundamental polynomials f1−f5 −2.17 98−0.02360 in a simple notation.
=0.51692,|x −x |=
Denote , f (x6)=f(0. 51520)=0. 00776. f (0.51520)f(1)<0, (0.51520 ,1). f −f −2.17798−0.00776
x6 f 1−x1 f 6
0.51520(−2.17798)−(1)0.00776
x= = 7
1 6 7 6
we get
P ,
So that (5.18) becomes
P . (5.19)
f ' ( x 0 )≠0
f (x 0 )
=
x 1=x 0 −
f ' (x 0 ) f '(x 0 )≠0 + x k+1 = xk −
f ( xk )
'
f ( xk ) f ' ( x k )≠0 .
=
k=0,1,2 ,.. . x f(x)=0. Δx k + .
QUADRATIC INTERPOLATION
For n = 2, we have the data
x x k + Δx
f ( xk+Δx)=0. xk .
(Δx)2
f(xk)+Δxf '(xk)+ f ' (xk)+. =0.
2! Δx ,
f ( xk )
f (xk)+Δxf '(xk)≈0, Δx=−
f '( x k )
.
x k +1=x k +Δx=x k −
f ( xk )
f ' ( xk )
. f ' ( x k )≠0 x0
The Lagrange quadratic interpolation polynomial is given by
α=−0 . 5
xk+1=xk−o.5(3 x 3+4x 2+4xk +1) =−o.5(3x 3+4x 2 +2xk +1) ϕ ( x ) x =−0 .5
k k = k k + k + 0 .
=
x 1=ϕ( x0 ) =−o.5(3x +4x +2x +1)+ x 2 =ϕ( x1 ) 3 2 0
0 0
=−o.5 (3x 3+4x 2+2x1+1)
1 1 +
x 3 =ϕ( x 2 ) =−o.5 (3x 3+4x 2+2x2+1)
2 2
Example 5. 7: Determine the linear Lagrange interpolating polynomial that passes through the
points (2,4) and (5, 1).
Solution: In this case we have
=
i) 2
(4) + −5x+1=0 (1)
x
= ii )
p c≠ 0
|ε k +1|≤c|ε k|p . c
k f ( x)
Hence, the Lagrange quadratic polynomial is given by
x k =ε k +α , x k+1=εk+1+α, x 0 =ε 0 +α ,
= 8x2 – 6x + 1.
Example 5.9: Using Lagrange interpolation formula, find the form of the function y(x) from the
following table
f(α)=0 0 1 3 4
ε k+1=cε0 ε k , -12 0 12 24
f ''( α ) ¿
when ε 0 , it follow that |εk+1|=|c ||εk|is a factor. Letc =cε 0
¿
c=
Solution: Since f ' (α )
Then
x k+1=ϕ(x k ), .We now tabulate the value of α=ϕ(α), and xk+1−α=ϕ(xk )−ϕ(α)=
ϕ(α+xk−α)−ϕ(α) 0 3 4
=[ϕ(α)+(xk−α)ϕ'(α)+. .]−ϕ(α) 12 6 8
Applying Lagrange interpolation formula to the above table, we find
ε k + 1= ε k ϕ ' ( α )+ 0( ε 2k ) .
|ε k+1|=c|ε k| x k < t k < α
c=|ϕ ' ( α )|
f ( xk )
x k+1=x k− ,
Hence the required polynomial approximate to f ' (x k ) is given by
f ' ( x k )≠0 x k =ε k +α , x k +1=ε k +1 +α ,
f ( εk + α )
ε k + 1 +α =ε k + α−
f ' ( ε k +α )
Remark: For a given data, it is possible to construct the Lagrange interpolation polynomial.
However, it is very difficult and time consuming to collect and simplify the coefficients
of f(α)=0 f ' ' ( α ) Now, assume that we have determined the Lagrange interpolation
1
[ ε k f ' (α )+ ε 2k f '' ( α )+. . .] f '' (α) 2 f '' (α)
2 ε k+1=εk −[ε k + εk +...][1+ ' ε k +...]−1
polynomial of degree n based on the data values ε k+1=ε k −
f ' (α )+ε k f '' (α ) , 2f ' (α) f (α) at the (n + 1) distinct
'' ''
f (α) 2 f (α) f ' (α ) f ' (α )
ε k+1=εk −[ε k + ε +...][1− ' εk +...] εk+1=εk−[εk− ' ε2k+.. ]= ' ε2k+..
points. Suppose that to this given data, a new value 2f ' (α) k f (α) at the distinct point 2f ( α ) f (α ) is added at
the end of the table. If we require the Lagrange interpolating polynomial for this new data, then we
need to compute all the Lagrange fundamental polynomials again. The nth degree polynomial obtained
earlier is of no use. This is the disadvantage of the Lagrange interpolation. However, Lagrange
interpolation is a fundamental result and is used in proving many theoretical results of
interpolation.
5.3.2 Newton’s Divided Difference Interpolation
Divided Differences
Let the data values, x+1−2sinπx=0 , 0≤x≤0 .5 be given. We define the divided differences as follows.
First divided difference:
y=2sin x . x
x=2 sin x .
a 11 x 1 + a12 x 2 + a13 x 3 =b 1
a 21 x 1 +a 22 x 2 +a 23 x 3 =b2
Therefore, a 31 x 1 +a 32 x 2 +a 33 x 3 =b3
Note that
x1 x2 x 3 x1
We say that the divided differences are symmetrical about their arguments.
b1 −a12 x 2− a13 x 3
Second divided difference Consider any three consecutive data values a11
x 2
b2 −a 21 x 1− a23 x 3
a22 Then, we define the second divided difference as
x 3 b3 −a 31 x 1− a32 x 2
a33
Therefore,
x 2 x 3
The nth divided difference using all the data values in the table, is defined as
x 1 (5.20)
x2 x1
x2
Table 5.8. Divided
differences
x3 x2 x3 (d.d).
x1 x 1
x3 x2 x1
x2
5 x 1−x 2 + x 3 =4
Example
x3 x 1 +3 x 2 + x 3 =2
−x 1 + x 2 + 4 x 3 =3 5.10: Obtain
the divided difference table for the data
x1 -1 0 2 3
x1 -8 3 1 12
Solution: We have the following divided difference table for the data.
The divided differences can be written in a tabular form as in Table 5.9.
x2
5¿
4+x2−x3 ¿ ¿
¿ First d.d Second d.d Third d.d
-1 -8
3+8
=¿11
0+1
0 3 −1−11
=¿
2+ 1
-4 Table 5.9
Divided 1−3 4+ 4 differences
=−¿1 =¿2
2−0 3+1
(d.d).
2 1 11+1
=¿4
3−0
12−1
=¿11
3−2
Activity5.4 : Obtain the divided difference table for the data
3 12
x2 -4 -1 0 2 5
2−x 1−x 3
3
245 23 4 6 335
We mentioned earlier that the interpolating polynomial representing a given data values is unique, but the
polynomial can be represented in various forms.
We write the interpolating polynomial as
x3 x 3
3+ x 1−x 2
x1 x x ( )
−1 3 7 5
( ) ( )
1 2 3 1 0 1
(a) (18 34 ) (b) −3 1 2 (c)
−1 2 −1 3
(d ) 2 1 2
2 3 (5.21) The
2 0 1 4
4 9 5 6
1 −1 −1 3
1 2 1
2x+y+6z=6 3x+4y+7z=0
(a) 2x−5 y=1 (b)
3x+2y−z=−1
c) 3x+2y−2z=−2 d) y−2z=3
Setting 3 x−2 y=−4 −x+2y−9z=9
x+y+2z=4 x+3y−z=−5 we obtain
[ ]
x + y + z +w=−4 25 5 1
2 y + z +3 w=4
e) [ A ] = 64 8 1
2 x+ y−z+ 2 w=5
x − y+ w=4 144 12 1 since all the remaining terms vanish.
Setting [ ][ ] [ ] f ( x ) we obtain
25 5 1 a 1 106. 8
64 8 1 a 2 = 177. 2
144 12 1 a 279. 2
3
f (x) f ( x ) p ( x ) or p( x ) f ( x ) p( x ) .
Setting f ( x ) f ( x ) we obtain p( x ) f ( x ) n +1 x 0 ,
or
x 1
x 2
x n a=x0<x1<x2 <...<xn=b x 0
=
x1
pn ( xi ) f n( xi ) (5.22)
For an example of a second order polynomial, given i=0,1,2,...,n. pn ( x ) and f (x)=x −2x−1
2
x 2−2x−1 −2+(x−1)+(x−1)(x−2).( n + 1 ) ( x 0 , y 0 ) ,
Example 5.11: Find( x 1 , y 1 ), as a polynomial in (x2,y2), for the following data by Newton’s divided
difference formula
,( xn ,yn ) -4 -1 0 2 5
x 1245 33 5 9 1335
Solution: First we form the divided difference table for the data.
y yn ( x ) First d.d Second d.d Third d.d Fourth d.d
-4 1245
-404
-1 33 94
-28 -14
0 5 10 3
2 13
2 9 88
442
5 1335
nth y yn ( x ) x
x i− x i −1 =h
i=1 , 2 , 3 , . . . , n .
= 1245 + (x1=x0+h + 4)(- 404) + (x2=x0+2h + 4)( xi=x0+ih + 1)(94) + (i=1,2,3,. .,n. + 4)( yn (x) + 1) nth (-14)
+(
x=x1 + 3yn(x1)=y1=a0+ 1(x1−x0)=y0+a1(x1−x0) – 6y1=y0+a1(x1−x0) – 8 )(3) y1−y0 Δy0
a1= =
x1−x0 h
–2 9
7
-1 16 -3
1 1
0 17 0 0
1 1
1 18 4 0
13 1
3 44 8
37
4 81
Since, the fourth order differences are zeros, the data represents a third degree polynomial.
Newton’s divided difference formula gives the polynomial as
Δy 0 Δ2 y 0 Δ3 y 0 Δn y 0
a 1= a 2= a 3= a n=
h 2 ! h2 3 ! h3 n ! hn
Δy 0 Δ2 y 0 Δ3 y 0
y n ( x )= y 0 + ( x−x 0 )+ ( x−x 0 )( x −x1 )+ ( x−x 0 )( x−x 1 )( x−x 2 )+
h 2 ! h2 3 ! h3
property. Suppose that we add a new data value x at the distinct point
xi−xi−1=h , at
the end of the given table of values. This new data of values can be represented by a
(n + 1)th degree polynomial. Now, the (n + 1)th column of the divided difference table
contains the (n + 1)th divided difference. Therefore, we require to add the term
i=1 , 2 ,3 , .. . , n. x 1= x 0 + h
to the previously obtained nth degree interpolating polynomial given in (5.22).
Activity5.5:
1. Find x 2=x0 +2h as a polynomial in xi=x0+ih for the following data by Newton’s divided difference
formula
i =1 , 2 , 3 , . . , n . 1 3 4 5 7 10
yn ( x ) 3 31 69 131 351 1011
∇n y
. + nn(x−xn)(x−xn−1)(x−xn−2). (x−x1).
n! h
x=x n + ph p(p+1) p(p+1)( p+2)
yn(x)=yn+p∇yn+ ∇2 yn+ ∇3 yn+.. +
2! 3!
p(p+1)(p+2)...(p+n−1) n
n!
∇ yn . y( x) x
5.Use appropriate Lagrange interpolating polynomials of degrees one, two, and three to approximate
each of the following:
f(x) x if f ( x ) 16.94410, Δ 17.56492, Δ 2 18.50515, Δ 3 18.82091
p(p−1) p(p−1)(p−2)
y3(x)=y0+pΔy0+ Δ2y0+ Δ3y0.
n=3 2! 3! if where −0.07181250, p= h = x−01 =x −0.02475000, y (x)=1+x(1)+ x(x−1)2! (−2)+ x(x−1)(x−2)
x−x 0
(12).
3! 0.33493750, 3
2
6.Use the Lagrange and the Newton-divided difference formulas to calculate y3(x)=1+x−(x −x)+2(x)(x−1)(x−2). from
the following table :.
y3(x)=1+x−(x2−x)+2(x)(x2−3x+2). 0 1 2 4 5 6
y3(x)=2x3−7x2+6x+1. 1 14 15 5 6 19