Numerical Methods
Numerical Methods
Numerical Methods
Chapter: Interpolation
Table of Contents
Chapter: Interpolation
1. Learning Outcomes
2. Introduction
3. Methods of Interpolation
4. Lagrange and Newton Interpolation
5. Linear Interpolation
6. Lagrange’s Interpolation
7. Newton’s Dividend Difference Interpolation
8. Truncation Error Bounds
9. Quadratic Interpolation
10. Higher Order Interpolation
11. Finite Difference Operator
12. Relation between Newton's divided differences in terms of
forward, backward and central difference operators
13. Relations between Difference operators and differential
operators
14. Interpolating Polynomials using Finite Differences
14.1. Gregory-Newton Forward Difference Interpolation
14.2. Gregory-Newton Backward Difference Interpolation
15. Exercise
16. Summary
17. References
1. Learning Outcomes:
(ii) How with the help of polynomial we can approximate the value of a
function which is not known explicitly.
(iv) Reader will appreciate the error analysis explained in this chapter .
Suitability of degree of polynomial and bounds on the error is also
explained.
2. Introduction:
(x)
3. Methods of Interpolation:
given explicitly and only the values of f x and for its certain order
Now
such that
f x x for all x x0 , xn
The above theorem clearly says that there always exists a polynomial
x which is sufficiently close to f x .
are known.
P xi f xi i 0,1,2,...n (ii)
1 x0 x02 x0n
1 x1 x12 x1n
V x0 , x1 ,..., xn 0
1 xn xn2 xnn
P xi f xi i 0,1,2,..., n
Q x P x P x
Also at x0 , x,..., xn
Q xi P xi P xi
= f xi f xi i 0,1,..., n
=0
x0 , x,..., xn .
5. Linear Interpolation:
interpolating conditions
f x0 P x0
f x1 P x1
a1x0 a0 P x0 f x0 (i)
a1 x1 a0 P x1 f x1 (ii)
Eliminating (or obtaining) a0, a1 from (i), (ii) we obtain the required
linear interpolating polynomial.
P x x 1
f x0 x0 1 0 (iii)
f x1 x1 1
6. Lagrange’s Interpolation:
P x x 1
Expanding the determinant equation f x x0 1 0 we get
f x1 x1 1
P x x0 x1 f x0 x x1 f x1 x x0 0
P x
x x1 f x x x0 f x
x0 x1 0 x1 x0 1
P x 0 x f x0 1 x f x1 (iv)
where
x x1 x x0
x , x
0
x0 x1 1
x1 x0
satisfying
0 x 1 x 1
0 x0 1 , 0 x1 0
1 x0 0 , 1 x1 1
1 if i j
In general x
0 if i j
i j ij
P x x 1
f x0 x0 1 0 (i)
f x1 x1 1
P x x0 x1 x f x0 f x1 1 x1 f x0 x0 f x1 0
P x x0 x1 xf x0 xf x1 x1 f x0 x0 f x1 x0 f x0 x0 f x0 0
P x x0 x1 x f x1 f x0 x0 f x1 f x0
x1 x0 f x0 0
P x x0 x1 x0 x1 f x0 x x0 f x1 f x
P x
x0 x1 f x0 x x0 f x1 f x0
x0 x1 x1 x0
P x f x0 x x0
f x f x
1 0
x1 x0
P x f x0 x x0 f x0 , x1 (ii)
f x1 f x0
The ratio f x0 , x1 is called as first dividend difference of
x1 x0
f x relative to x0 and x1 Polynomial P x represented by (ii) is Newton’s
I.Q.1
polynomial using
Solution: We have
x0 2, f x0 4
x1 2.5, f x1 5.5
x x1 x 2.5
x 2 x 2.5
x0 x1 0.5
0
x x0 x 2
x 2 x 2
x1 x0
1
0.5
P1 x 0 x f x0 1 x f x1
2 x 2.5 4 2 x 2 5.5
2 x 5 4 2 x 4 5.5
8x 20 11x 22
3x 2 .
We have
f x1 f x0 5.5 4
f x0 , x1 3
x1 x0 0.5
P1 x f x0 x x0 f x0 , x1
4 x 2 3 4 3x 6 3x 2
= 6.6 2 = 4.6.
E1 f , x f x P x (i)
If x x0 or x x1 E1 f , x 0
If x x0 , x1 define a function
g t f t P t f x P x .
t x0 t x1 (ii)
x x0 x x1
at t x0 , x1 , x
clearly g t 0
get
g 1 0 x0 1 t
where
2t x0 x1
g t f t P t f x P x
x x0 x x1
g 0 1 2 or x0 x1
x0 1 2 x1
2 f x P x
0 f
x x0 x x1
1
f x x0 x x0 f x P x
2
1
f x P x x x0 x x1 f (iv)
2
Using (iv)
E1 f , x f x P x
1
E1 f , x x x0 x x1 f
2
1 1
f x P x x x0 x x1 f xmax x x0 x x1 f
2 2 0 x x1
1
max x x0 x x1 M (v)
2 x0 x x1
Let w x x x0 x x1 x x0 x x1
w x x x0 x x1 , w x 2
= 2 x x0 x1
x0 x1
Put w x 0 x
2
x0 x1
maximum value of x x0 x x1 occur at and maximum
2
x1 x0
2
value of w x is w(x) =
4
1
f x P x x1 x0 M
2
(vi)
8
Value addition
Equation (vi) can be used to construct a table of values for a
function f x for equally spaced points
xi a ih i 0,1,..., n , h b a n
This can help us in setting maximum absolute truncation error using
the linear interpolating polynomial P x is less than a given error
tolerance > 0
as x1 x0 h
from equation (vi)
h2
max f x .
8 a x b
I.Q.2
I.Q. 3
x x1 x x0
P x f x0 f x (i)
x0 x1 x1 x0 1
from (i)
E1 f ; x
x 0.1 x 0.2
sin
2
x x0 x x1 f
1
E1 f , x
2
where
0.1 0.2
As sin x is a increasing function in 0,
2
Institute of Lifelong Learning, University of Delhi pg. 13
Interpolation
Thus E1 f ; x
0.15 0.1 0.15 0.2
0.19867
2
Example 3: Determine the step size h that can be used in the tabulation
of f x sin x in the interval [1, 3] so that the linear interpolation will be
Solution: We have
f x sin x
f x cos x, f x sin x
and max sin x 1 1 3 & sin 1
1 x 3
2 2
According Problem
h2
max f x
8 1 x3
Here 5 105
h2
1 5 105
8
h 0.02
9. Quadratic Interpolation:
f x0 a0 a1x0 a2 x02
f x1 a0 a1x1 a2 x12
f x2 a2 a1x2 a2 x22 .
P2 x 1 x x2
f x0 1 x0 x02
0
f x1 1 x1 x12
f x2 1 x2 x22
P2 x D0 f x0 D1 f x1 D2 f x2 D3 0
where
1 x0 x02
D0 1 x1 x12 x0 x1 x1 x2 x2 x0
1 x2 x22
1 x x2
D1 1 x1 x12 x x1 x1 x2 x2 x
1 x2 x22
1 x x2
D2 1 x0 x02 x x0 x0 x2 x2 x
1 x2 x22
1 x x2
D3 1 x0 x02 x x0 x0 x1 x1 x
1 x1 x12
D1 D D
P2 x f x0 2 f x1 3 f x3
D0 D0 D0
x x1 x x2 f x x x0 x x2 f x
x0 x1 x0 x2 0 x1 x0 x1 x2 1
x x0 x x1 f x
x2 x0 x2 x1 2
= 0 x f x0 1 x f x1 2 x f x2
E2 f ; x f x P2 x
f x P2 x x x0 x x1 x x2 f
3!
where x0 , x2
Truncation error
1
E2 ( f ; x) f x P2 x x x0 x x1 x x2 f
3
and bound on the truncation error is
f x P2 x M 3 max x x0 x x1 x x2
1
6 x0 x x2
1 if i j
li x j ij
0 if i j
li x
x x0 x x1 ... x xi 1 x xi 1 ... x xn
xi x0 xi x1 ... xi xi 1 xi xi1 ... xi xn
i = 0, 1, …, n. (i)
w x
li x
x x0 w xi
where
w x x x0 x x1 ... x xn
w xi xi x0 xi x1 ... xi xi 1 xi xi 1 ... xi xn
n
P x li x f xi
i 0
En f ; x f x P x
Since En f ; x 0 at x = xi i = 0, 1, 2, …, n
g t f t P t f x P x
t x0 t x1 ... t xn (ii)
x x0 x x1 ... x xn
obtain g
n 1
0 where is some point such that
to t, we get
n 1! f x P x
g
n 1
t f
n 1
t (iii)
x x0 x x1 .... x xn
w x n1
f x P x f
n 1!
w x n1
En f ; x f .
n 1!
x x1 x x2 x 1 x 3 1 x2 4 x 3
l0 x
x0 x1 x0 x2 1 3 3
x x0 x x2 x x 3 1 3x x 2
l1 x
x1 x0 x1 x2 1 2 2
x x0 x x2 x x 1 1 x 2 x .
l2 x
x2 x0 x2 x1 3 2 6
P2 x l0 x f0 l1 x f1 l2 x f 2
3
1 2
x 4 x 3 3 x x 2 x 2 x
3
2
55
6
8x2 6 x 1 .
3 1 55 3
f 0,1 2, f 1,3 26,
1 0 3 1
26 2
f 0, 1, 3 8.
30
1 2 x 8 x x 1 8x 2 6 x 1.
1
We have, E2 f ; x M 3 max x x 1 x 3
6 0 x 3
1
2.1126 M 3 0.3521 M 3
6
at x = 2.2152.
given
x0 10 0.1745, x1 20 0.3491,
18 9
x2 30 0.5236 .
6
l0 x
x x1 x x2 x 0.3491 x 0.5236
x0 x1 x0 x2 0.1746 0.3491
l1 x
x x0 x x2 x 0.1745 x 0.5236
x1 x0 x1 x2 0.1746 0.1745
l2 x
x x0 x x1 x 0.1745 x 0.3491
x2 x0 x2 x1 0.3491 0.1745
f x f x0 x x0 f x0 , x1 x x0 x x1 f x0 , x1 , x2
x x0 x x1 x x2 f x0 , x1 , x2 , x3
x 2 5 5 x3
x3 x 1 .
h h
(4) Central difference operator f ( xi ) f xi f xi
2 2
1 h h
(5) The average operator f ( xi ) f xi f xi
2 2 2
1
(i) f ( xi ) f ( xi 1) f xi f ( xi 1) f ( xi )
2
(ii) (a) f ( xi ) f ( xi 1) f ( xi )
= Ef ( xi ) f ( xi )
( E 1) f ( xi )
E 1
(b) f ( xi ) f ( xi ) f ( xi 1)
f ( xi ) E 1 f ( xi 1)
(1 E 1 ) f ( xi )
1 E 1
1
n ( E 1)n
n (1 E 1 )n
E
1E 1 1 (1+)1 1 1
2 1 2
2 4
1
1 (1+)1/2 (1)1/2
E E
2 2
1 12
1
1 1
1 1
1
(E E 2 ) 1 1 2
1 1 2 1 2
2 2 2 4
1/ 2
1
2
(i) (1 ) 2
(ii) 1
4
1 1 1 2 2
(iii) E 1 2 1 2 (iv) 1
2 4 2 4
Proof:
(1) R.H.S. =
1
1 1
(1 E )[1 (1 E )] 2
( 1 E 1 )
1 1
(1 E 1 )( E 1 ) 2
(1 E 1 )( E 2 )
1 1
E E 2 2
= L.H.S.
1
2 2
(ii) R.H.S. = 1
4
1
1 1
1 2 1
1
1 ( E E ) 2 2 2
E2 E 2
4
1
1 2
1 1
1 ( E E 1 2) 2 ( E 2 E 2 )2
4
1
= EE 2
1/ 2
4 E E 1 2
4
1 1/ 2
E E 1 2
2
1/ 2
1 1
1
( E 2 E 2 ) 2
2
1 12
1
= ( E E 2 ) L.H .S .
2
1 1
(iii) R.H.S. = 1 2 1 2
2 4
1 12
1
1
1
(E E 2 )
1 12
1 1
1
(E E ) 2 2
2
= 1 (E E ) (E E 2 )
2 2 2
2 2 2
1
4
1 1
1 ( E E 1 2) ( E E 1 )
2 2
1
[2 E E 1 2 E E 1 ]
2
1
2 E E L.H .S .
2
1 1
(iv) R.H.S.= 2 1 2
2 4
1 1
1 1
1
(E E ) 1
1 2 2
(E E ) (E E )
2 2 2 2 2
(using relation (ii))
2 2
1 1
( E E 1 2) ( E E 1 )
2 2
1
[ E E 1 2 E E 1 ]
2
1
[2 2 E 1 ] = [1 E ] L.H .S.
1
2
Solution:
f(x) f 2f 3f 4f 5f 6f
0 0
0 0 0 4
0 3 6 10 20
2 3 4 10
0 0
0 0 0
0
Clearly the table shows
I.Q.4
I.Q.5
f ( x1 ) f ( x0 ) 1
f [ x0 , x1 ] f 0
h h
1 1
f f
f [ x1 , x2 ] f [ x0 , x1 ] h 1 h 0
f [ x0 , x1 , x2 ]
x2 x0 2h
1
2 f0 .
2!h 2
1
f [ x0 , x1 , x2 ,...., xn1 ] n 1
n1 f 0
(n 1)!h
f [ x1 , x2 ,..., xn ] f [ x0 , x1 ,...., xn1 ]
f [ x0 , x1 , x2 ,...., xn1 , xn ]
xn x0
1 1
1 n 1
n1 f1 1 n 1
n1 f 0
(n 1) h (n 1) h
nh
n1
[ f1 f 0 ]
(n 1)!h n1 n1.f 0 n f0
nh (n 1)!h n n n!h n
1
(b) f [ x0 , x1 ,..., xn ] n
n f n
n !h
1
(c) f [ x0 , x1 ,..., x2 n1 ] 2m
m fm when n 2m
(2m)!h
1
f [ x0 , x1 ,..., x2 m1 ] 2 m 1
m+1 f 1 when n 2m 1
(2n 1)!h m
2
f ( x) f ( x h) f ( x)
h2
f ( x) hf ( x) f ( x) .... f ( x) (Using Taylor's theorem)
2
h2
hf ( x) f ( x)
2
f ( x)
f ( x) error is of O(h).
h
Institute of Lifelong Learning, University of Delhi pg. 27
Interpolation
Similarly
2 f ( x) h2 f ( x)
Again f ( x) f ( x) f ( x h)
h2
f ( x) f ( x) hf ( x) f ( x) ....
2
h2
f ( x) f ( x) hf ( x) f ( x) ...
2
hf ( x) O(h2 )
f ( x)
f ( x) hf ( x) f ( x)
h
f ( x)
f ( x) h f ( x) f ( x)
2
h2
1
f [ x0 , x1 ,..., xn ] n
n f0 (1)
n !h
f 0 ( x x0 ( x x1 ) 2 f 0
P( x) Pn ( x) f 0 ( x x0 ) ....
h 2!h2
( x x0 )( x x1 ) ....( x xn1 ) n
f0 (3)
n !h n
( x x0 )
Now if we put u hu ( x x0 ) and since x0 , x1 ,..., xn are
h
equally spaced Points that is xi x0 ih
n
u u
i f 0 where u Ci
i 0 i i
x x0
f ( x) f x0 h
h
x x0
f ( x0 uh) u
h
E u f ( x0 )
(1 )u f ( x0 ) ( E 1 )
u (u 1) 2 u (u 1)...(u n 1) n
1 u .... .... f 0
2! n!
u (u 1) 2 u (u 1)...(u n 1) n
f ( x) f 0 uf 0 f 0 .... f 0 ... (6)
2! n!
we get.
u (u 1) 2 u (u 1)...(u n 1) n
f ( x) f 0 uf 0 f1 ... f0 (7)
2! n!
( x xn )
f ( x) f xn h f ( xn hu )
h
( x xn )
as we take = u x xn hu
h
f ( x) f ( xn uh)
E u f ( xn )
(1 )u f ( xn ) [ E (1 )1 ]
u (u 1) 2 u (u 1) (u n 1) n
1 uf ( xn ) f ( xn ) ... f ( xn ) ... (8)
2! n!
n 1
Neglecting the difference f ( xn ) and higher order difference we get the
interpolating polynomial as
P( x) P( xn hu) f ( x)
u (u 1) 2 u (u 1)....(u n 1) n
f n uf n f n .... fn.
2! n!
n
u
(1)i i f n (9)
i 0 i
u u
where Ci .
i
I.Q. 6
Example9. For the following data, calculate the differences and obtain
the forward and backward difference polynomials. Interpolate at x = 0.25
and x = 0.35
0.1 1.40
0.16
0.2 1.56 0.04
0.20 0.0
0.3 1.76 0.04 0.0
0.24 0.0
0.4 2.00 0.04
0.28
0.5 2.28
The forward difference polynomial is given by
2 x2 x 1.28 .
2 x2 x 1.28 .
x x0 0.25 0.2
u 0.5
h 0.1
1
f (0.25) f (0.2) (0.5)f (0.2) (0.5)(0.5) 2 f (0.2)
2
x xn 0.35 0.4
u 0.5
h 0.1
1
and f (0.35) f (0.4) (0.5)f (0.4) (0.5)(0.5)f (0.2)
2
= 1.875.
Exercise:
Q.2 In the following problems, find the maximum value of the step size
h that can be used to tabulate f x on a, b , using linear
1
(b) f x a, b 1,2, 1104
1 x2
(c) f x 2x a, b 0,1, 1105
Estimate P(1.5)
(i) x –2 –1 0 1 3 4
f (x) 9 16 17 18 44 81
(ii) x –1 2 4 5
1
Q.5 If f x , find the dividend difference f x1, x2 , x3 , x4
x2
(i)
(ii)
1
(iii) fi / fi fi 1
fi
Summary:
References: