NA Lecture 22b
NA Lecture 22b
Analysis
Lecture 22
Chapter 5
Interpolation
Finite
Finite Difference
Difference Operators
Operators
Newton’s
Newton’s Forward
Forward Difference
Difference
Interpolation
Interpolation Formula
Formula
Newton’s
Newton’s Backward
Backward Difference
Difference
Interpolation
Interpolation Formula
Formula
Lagrange’s
Lagrange’s Interpolation
Interpolation
Formula
Formula
Divided
Divided Differences
Differences
Interpolation
Interpolation in
in Two
Two Dimensions
Dimensions
Cubic
Cubic Spline
Spline Interpolation
Interpolation
r r 1 r 1
yi yi 1 yi
k k1 k1
yi yi yi 1 ,
i n, (n 1),..., k
n 1 n 1
yi
n
yi (1 2) yi (1 2)
Thus
y x yx h yx f ( x h) f ( x)
2
y x y x h yx
Similarly
y x y x yx h f ( x) f ( x h)
h h
yx y x ( h / 2) y x ( h / 2) f x f x
2 2
Shift operator, E
E f ( x ) f ( x h)
n
E f ( x) f ( x nh)
n
E y x y x nh
The inverse operator E -1
is defined as
1
E f ( x ) f ( x h)
Similarly,
n
E f ( x) f ( x nh)
Average Operator,
1 h h
f ( x) f x f x
2 2 2
1
y x ( h / 2) y x ( h / 2)
2
Differential Operator, D
d
Df ( x) f ( x) f ( x)
dx
2
2 d n
D f ( x) 2 f ( x) f ( x)
dx
Important Results
E1
E 1 1
1 E
E
E 1/ 2
E 1/ 2 hD log E
1 1/ 2 1/ 2
(E E )
2
Newton’s
Forward
Difference
Interpolation
Formula
Let y = f (x) be a function which
takes values f (x0), f (x0+ h), f (x0+2h),
…, corresponding to various equi-
spaced values of x with spacing h,
say x0, x0 + h, x0 + 2h, … .
Suppose, we wish to evaluate the
function f (x) for a value x0 + ph,
where p is any real number, then for
any real number p, we have the
operator E such that
p
E f ( x) f ( x ph).
p p
f ( x0 ph) E f ( x0 ) (1 ) f ( x0 )
p ( p 1) 2 p ( p 1)( p 2) 3
1 p f ( x0 )
2! 3!
f ( x0 ph) f ( x0 ) pf ( x0 )
p ( p 1) 2 p ( p 1)( p 2) 3
f ( x0 ) f ( x0 )
2! 3!
p ( p 1) ( p n 1) n
f ( x0 ) Error
n!
-3
In this example,
1979 1982
p 1.5
2
and
2
yn 5, yn 1,
3 4
yn 2, yn 5
Newton’s interpolation formula gives
( 1.5)( 0.5)
y1979 57 ( 1.5)5 (1)
2
( 1.5)( 0.5)(0.5)
(2)
6
( 1.5)( 0.5)(0.5)(1.5)
(5)
24
57 7.5 0.375 0.125 0.1172
Therefore,
y0
a0
( x0 x1 )( x0 x2 ) ( x0 xn )
Similarly, we obtain
y1
a1
( x1 x0 )( x1 x2 ) ( x1 xn )
yi
ai
( xi x0 )( xi x1 ) ( xi xi 1 )( xi xi 1 ) ( xi xn )
and
yn
an
( xn x0 )( xn x1 ) ( xn xn 1 )
Substituting the values of
a0, a1, …, an we get
( x x1 )( x x2 ) ( x xn ) ( x x0 )( x x2 ) ( x xn )
y f ( x) y0 y1
( x0 x1 )( x0 x2 ) ( x0 xn ) ( x1 x0 )( x1 x2 ) ( x1 xn )
( x x0 )( x x1 ) ( x xi 1 )( x xi 1 ) ( x xn )
yi
( xi x0 )( xi x1 ) ( xi xi 1 )( xi xi 1 ) ( xi xn )
( x x0 )( x x1 )( x x2 ) ( x xn 1 )
yn
( xn x0 )( xn x1 )( xn x2 ) ( xn xn 1 )
That is ( x) is a product of
(n + 1) factors. Clearly, its
derivative ( x) contains a sum
of (n + 1) terms in each of
which one of the factors of
will ( x) be absent.
We also define,
Pk ( x) ( x xi )
i k
which is same as ( x) except
that the factor (x–xk) is
absent. Then
( x) P0 ( x) P1 ( x) Pn ( x)
But, when x = xk, all terms in the
above sum vanishes except Pk(xk)
Hence,
( xk ) Pk ( xk ) ( xk x0 ) ( xk xk 1 )( xk xk 1 ) ( xk xn )
Pk ( x) Pk ( x)
Lk ( x)
Pk ( xk ) ( xk )
( x)
( x xk ) ( xk )
Finally, the Lagrange’s
interpolation polynomial of
degree n can be written as
n
( x)
y ( x) f ( x) f ( xk )
k 0 ( x xk ) ( xk )
n n
Lk ( x) f ( xk ) Lk ( x) yk
k 0 k 0
Example
Find Lagrange’s
interpolation polynomial
fitting the points
y(1) = -3, y(3) = 0,
y(4) = 30, y(6) = 132.
Hence find y(5).
Solution
The given data can be
arranged as
Using Lagrange’s
interpolation formula, we
have
( x 3)( x 4) x 6)
y ( x) f ( x) ( 3)
(1 3)(1 4)(1 6)
( x 1)( x 4) x 6)
(0)
(3 1)(3 4)(3 6)
( x 1)( x 3)( x 6)
(30)
(4 1)(4 3)(4 6)
( x 1)( x 3)( x 4)
(132)
(6 1)(6 3)(6 4)
On simplification, we get
1
y ( x) 5 x 135 x 460 x 300
3 2
10
1 3 2
( x 27 x 92 x 60)
2
which is required Lagrange’s
interpolation polynomial.
Now, y(5) = 75.
Example
Given the following data,
evaluate f (3) using
Lagrange’s interpolating
polynomial.
Solution
Using Lagrange’s formula,
( x x1 )( x x2 )
f ( x) f ( x0 )
( x0 x1 )( x0 x2 )
( x x0 )( x x2 )
f ( x1 )
( x1 x0 )( x1 x2 )
( x x0 )( x x1 )
f ( x2 )
( x2 x0 )( x2 x1 )
Therefore
(3 2)(3 5)
f (3) (1)
(1 2)(1 5)
(3 1)(3 5)
(4)
(2 1)(2 5)
(3 1)(3 2)
(10)
(5 1)(5 2)
6.49999 6.5