Click to add title

advertisement
Numerical
Analysis
Lecture 26
Chapter 5
Interpolation
Finite Difference Operators
Newton’s Forward Difference
Interpolation Formula
Newton’s Backward Difference
Interpolation Formula
Lagrange’s Interpolation
Formula
Divided Differences
Interpolation in Two Dimensions
Cubic Spline Interpolation
DIVIDED
DIFFERENCES
The zero-th order
divided difference
y[ x0 ]  y( x0 )  y0
The first order divided
difference is defined as
y1  y0
y[ x0 , x1 ] 
x1  x0
Second order divided
difference
y[ x1 , x2 ]  y[ x0 , x1 ]
y[ x0 , x1 , x2 ] 
x2  x0
Generally
y[ x0 , x1 ,
1
, xn ] 
xn  x 0
 y[ x1 , x2 , , xn ] 
  y[ x , x , , x ]
0
1
n 1 

NEWTON’S
DIVIDED
DIFFERENCE
INTERPOLATION
FORMULA
Newton’s divided difference
interpolation formula
y  f ( x)  y0  ( x  x0 ) y[ x0 , x1 ]
( x  x0 )( x  x1 ) y[ x0 , x1 , x2 ]
 
( x  x0 )( x  x1 )
( x  xn 1 ) y[ x0 , x1 ,..., xn ]
Newton’s divided
differences can also be
expressed in terms of
forward, backward and
central differences.
In terms of forward differences
 y0
, xn ] 
n
n !h
n
y[ x0 , x1 ,
In terms of backward differences
 yn
y[ x0 , x1 ,..., xn ] 
n
n !h
n
In terms of central differences





2 m 1

ym  (1/ 2) 
y[ x0 , x1 ,..., x2 m 1 ] 
2 m 1 
(2m  1)! h

2m
ym
y[ x0 , x1 ,..., x2 m ] 
2m
(2m)! h
Newton’s Divided
Difference
Formula with
Error Term
Following the basic definition
of divided differences, we
have for any x
y ( x)  y0  ( x  x0 ) y[ x, x0 ]


y[ x, x0 ]  y[ x0 , x1 ]  ( x  x1 ) y[ x, x0 , x1 ]

y[ x, x0 , x1 ]  y[ x0 , x1 , x2 ]  ( x  x2 ) y[ x, x0 , x1 , x2 ]



y[ x, x0 ,..., xn 1 ]  y[ x0 , x1 ,..., xn ]  ( x  xn ) y[ x, x0 ,..., xn ]
Multiplying the
second Equation by (x – x0),
third by (x – x0)(x – x1)
and so on,
and the last by
(x – x0)(x – x1) … (x – xn-1) and
adding the resulting
equations, we obtain
y( x)  y0  ( x  x0 ) y[ x0 , x1 ]  ( x  x0 )( x  x1 ) y[ x0 , x1, x2 ] 
( x  x0 )( x  x1 )
( x  xn1 ) y[ x0 , x1,..., xn ]   ( x)
Where
 ( x)  ( x  x0 )( x  x1 ) ( x  xn ) y[ x, x0 ,..., xn ]
Please note that for x = x0, x1, …, xn,
the error term  ( x) vanishes
Error Term in
Interpolation Formulae
We know, if y (x) is approximated
by a polynomial Pn (x) of degree n
then the error is given by
 ( x)  y( x)  Pn ( x),
where,
 ( x)  ( x  x0 )( x  x1 ) ( x  xn ) y[ x, x0 ,..., xn ]
Alternatively it is also expressed as
 ( x)  ( x) y[ x, x0 ,..., xn ]  K ( x)
Now, consider a function F (x), such
that
F ( x)  y( x)  Pn ( x)  K ( x)
Determine the constant K in such a way that
F(x) vanishes for x = x0, x1, …, xn and also
for an arbitrarily chosen point x , which is
different from the given (n + 1) points.
Let I denotes the closed interval
spanned by the values x0 ,..., xn , x.
Then F (x) vanishes (n + 2) times in
the interval I.
By Rolle’s theorem F ( x) vanishes at
least (n + 1) times in the interval I,
F ( x) at least n times, and so on.
Eventually, we can show that
F ( n1) ( x) vanishes at least once in the
interval I, say at x   Thus, we
obtain
0 y
( n1)
( )  Pn
( n1)
( )  K 
( n1)
( )
Since Pn(x) is a polynomial of degree
n, its (n + 1)th derivative is zero.
Also, from the definition of  ( x )
( n1)

( x)  (n  1)!.
Therefore, we get
y ( )
K
(n  1)!
( n 1)
Hence
y ( )
 ( x)  y( x)  Pn ( x) 
( x)
(n  1)!
( n 1)
for some    ( x)
in the interval I.
Further more, we observe that
( n 1)
y ( )
y[ x, x0 ,..., xn ] 
(n  1)!
Thus the error committed in
replacing y (x) by either Newton’s
divided difference formula or by an
identical Lagrange’s formula is
y ( )
 ( x)  ( x) y[ x, x0 ,..., xn ]  ( x)
(n  1)!
( n 1)
INTERPOLATION
IN TWO
DIMENSIONS
Let u be a polynomial function
in two variables, say x and y,
in particular quadratic in x and
cubic in y, which in general
can be written as
2
u  f ( x, y )  a0  a1 x  a2 y  a3 x
 a4 xy  a5 y  a6 y  a7 y x  a8 yx
2
3
2
 a9 y x  a10 y x  a11 y x
3
2
2
3 2
2
This relation involves many
terms. If we have to write a
relation involving three or more
variables, even low degree
polynomials give rise to long
expressions. If necessary, we
can certainly write, but such
complications can be avoided by
handling each variable
separately.
If we let x, a constant, say x = c, the
equation simplifies to the form
u
x c
 b0  b1 y  b2 y  b3 y
2
3
Now we adopt the following
procedure to interpolate at a point
(1, m) in a table of two variables, by
treating one variable a constant say
x = x1. The problem reduces to that of
a single variable interpolation.
Any one of the methods
discussed in preceding sections
can then be applied to get f (x1,
m). Then we repeat this
procedure for various values of x
say x = x2, x3, …, xn keeping y
constant. Thus, we get a new
table with y constant at the value
y = m and with x varying. We can
then interpolate at x = 1.
Example
Tabulate the values of the
function f (x) = x2+y2-y
for x = 0,1,2,3,4 and y = 0,1,2,3,4.
Using the table of the values,
compute f(2.5, 3.5) by numerical
double interpolation
Solution
The values of the function for the
given values of the given values of x
and y are given in the following table
X
0
1
2
3
4
……
0
0
1
4
9
16
y….
1
0
1
4
9
16
2
2
3
3
6
7
4
12
13
6
11
18
10
15
22
16
21
28
Cont!
Using quadratic interpolation in both
x and y directions we need to
consider three points in x and y
directions. To start with we have to
treat one variable as constant, say x.
Keeping x = 2.5, y = 3.5 as near the
center of the set, we choose the table
of values corresponding to x = 1,2, 3
and y = 2, 3, 4.
Cont !
The region of fit for the construction
of our interpolation polynomial is
shown in different color in the table
X
0
1
2
3
4
……
0
0
1
4
9
16
y….
1
0
1
4
9
16
2
2
3
3
6
7
4
12
13
6
11
18
10
15
22
16
21
28
Cont !
Thus using Newton’s forward
difference formula, we have
Y
At x =
1
f
2
3
3
7
4
4
13
6
f
2 f
2
Cont !
Similarly
Y
At x =
2
f
2
6
3
10
4
4
16
6
f
2 f
2
Cont !
Similarly
Y
At x =
3
f
2
11
3
15
4
4
21
6
with
p
f
y  y0 3.5  2

 1.5
h
1
2 f
2
Cont !
with
y  y0 3.5  2
p

 1.5
h
1
p ( p  1) 2
f (1,3.5)  f 0  pf 0 
 f0
2!
(1.5)(0.5)
 3  (1.5)(4) 
(2)  9.75
2
Cont !
(1.5)(0.5)
f (2,3.5)  6  (1.5)(4) 
(2)  12.75
2
(1.5)(0.5)
f (3,3.5)  11  (1.5)(4) 
(2)  17.75
2
Cont !
Therefore we arrive at the
following result
At y=3.5
f
X
f
1
9.75
2
12.75
3
3
17.75
5
2 f
2
Cont !
Now defining
2.5  1
p
 1.5
1
(1.5)(0.5)
f (2.5,3.5)  9.75  (1.5)(3) 
(2)  15
2
Cont !
From the functional relation,
we also find that
f (2.5,3.5)  (2.5)  (3.5)  3.5  15
2
2
And hence no error in
interpolation !!!
Numerical
Analysis
Lecture 26
Download