interpolation in numerical methods
TRANSCRIPT
-
8/13/2019 Interpolation in numerical methods
1/51
NUMERICAL METHODS
INTERPOLATION
-
8/13/2019 Interpolation in numerical methods
2/51
INTRODUCTION TO INTERPOLATION
IntroductionPolynomial Forms
Linear and Quadratic interpolationInterpolation problemExistence and uniquenessLagrange interpolation polynomialNewtons Divided Difference method Properties of Divided Differences
-
8/13/2019 Interpolation in numerical methods
3/51
INTERPOL TION
DEFINITION
3
LET BE A CONTINEOUS FUNCTION DEFINED INTHE INTERVAL CONTAINING THE POINTS
THE INTERPOLATION IS USED TO FINDTHE VALUE OF THE FUNCTION AT ANY PONIT INTHE INTERVAL OR
INTERPOLATION MEANS TO FIND (APPROXIMATE)VALUES OF A FUNCTION FOR AN x BETWEENDIFFERENT x VALUES AT WHICH THE
VALUES OFf(x)
ARE GIVEN
-
8/13/2019 Interpolation in numerical methods
4/51
INTERPOL TION
EX MPLE
4
x 0 1 2
f(x) 1 0 -1
FIND:
THE PROCESS OF CONSTRUCTION OFTO FIT A TABLE OF DATA POINTS IS
CALLED CURVE FITTING
-
8/13/2019 Interpolation in numerical methods
5/51
POLYNOMIAL FORMS
POWER FORM
SHIFT POWER FORM
NEWTON FORM
5
n
i
n
i j j
jinn x xb x f x P 0 0
)()()(
-
8/13/2019 Interpolation in numerical methods
6/51
Examples of Polynomial InterpolationLinear Interpolation
Given any two points,there is one polynomial oforder 1 that passesthrough the two points.
Quadratic Interpolation
Given any three points thereis one polynomial of order 2 that passes through thethree points.
-
8/13/2019 Interpolation in numerical methods
7/51
LINEAR INTERPOLATIONGiven any two points,
The line that interpolates the two points is
Example :find a polynomial that interpolates (1,2) and (2,4)
)(,,)(, 1100 x f x x f x
x x x f 211224
2)(1
475
-
8/13/2019 Interpolation in numerical methods
8/51
ExampleAn experiment is used to determinethe viscosity of water as afunction of temperature. Thefollowing table is generated
Problem: Estimate the viscositywhen the temperature is 8 degrees.
Temperature(degree)
Viscosity
0 1.792
5 1.519
10 1.308
15 1.140
-
8/13/2019 Interpolation in numerical methods
9/51
ExampleFind a polynomial that fit the data points
exactly.
tscoefficien
polynomial:
eTemperatur :
viscosity:
k a
T
V
Linear Interpolation V(T)= 1.73 0.0422 TV(8)= 1.3924
-
8/13/2019 Interpolation in numerical methods
10/51
Example
10
THE TABLE BELOW GIVES SQUARE ROOT FOR NTEGERS
x 1 2 3 4 5f(x) 1 1.4142 1.7321 2 2.2361
DETERMINE, THE SQUARE ROOT OF 2.5
-
8/13/2019 Interpolation in numerical methods
11/51
The interpolation ProblemGiven a set of n+1 points,
find an n th order polynomialthat passes through all points
)(,....,,)(,,)(, 1100 nn x f x x f x x f x
)( x f n
ni for x f x f iin ,...,2,1,0)()(
-
8/13/2019 Interpolation in numerical methods
12/51
Existence and UniquenessGiven a set of n+1 points
Assumption are distinct real nos
Theorem:
There is a unique polynomial f n (x) oforder n
such that
ni for x f x f iin ,...,1,0)()(
n x x x ,...,, 10
)(,....,,)(,,)(, 1100 nn x f x x f x x f x
-
8/13/2019 Interpolation in numerical methods
13/51
Quadratic InterpolationGiven any three points ,The polynomial that interpolates the three points is
)(,)(,,)(, 221100 x f xand x f x x f x
202
01
01
12
12
2
101
011
00
1020102
)()()()(
)()(
)(
)(
x xat x x
x x x f x f
x x x f x f
b
x xat x x
x f x f b
x xat x f b
where
x x x xb x xbb x f
477
-
8/13/2019 Interpolation in numerical methods
14/51
LAGRANGE INTERPOLATION
Lagrange Interpolation Formula
n
i j j ji
ji
n
iiin
x x
x x x
x x f x f
,0
0
)(
)()(
486
Let, denote distinct real nos and let bearbitrary real nos. The pts can be imagined to bedata values connected by a curve. Any fn satisfying the conditions:
is called an interpolation fn. An interpolation fn is, therefore, a curvethat passes through the data pts.
-
8/13/2019 Interpolation in numerical methods
15/51
Lagrange Interpolation
ji
ji x
x
ji
i
1
0)(
s polynomialordern tharecardinalsThe
cardinalsthecalledare)(
-
8/13/2019 Interpolation in numerical methods
16/51
EXAMPLE
x 1/3 1/4 1y 2 -1 7
)4/1)(3/1(27
)1)(3/1(161)1)(4/1(182)(
4/114/1
3/113/1
)(
14/11
3/14/13/1
)(
13/11
4/13/14/1
)(
)()()()()()()(
2
12
1
02
02
21
2
01
01
20
2
10
10
2211002
x x
x x x x x P
x x x x x x
x x x x
x
x x x x x x
x x x x
x
x x x x x x
x x x x
x
x x f x x f x x f x P
-
8/13/2019 Interpolation in numerical methods
17/51
EXAMPLE
17
, Where,
EXAMPLE
THE TABLE BELOW GIVES SQUARE ROOT FOR NTEGERS
x 1 2 3 4 5f(x) 1 1.4142 1.7321 2 2.2361
DETERMINE, THE SQUARE ROOT OF 2.5
-
8/13/2019 Interpolation in numerical methods
18/51
NEWTONs INTERPOLATION POLYNOMIAL
Given any n+1 points ,The polynomial that interpolates all points is
)(,,...,)(,,)(, 1100 nn x f x x f x x f x
.
)()()()(
)()()(
......)(
202
01
01
12
12
2
101
011
00
10102010
on soand x xat x x x x
x f x f x x
x f x f
a
x xat x x
x f x f a
x xat x f a
x x x xa x x x xa x xaa x f nnn
-
8/13/2019 Interpolation in numerical methods
19/51
Divided Differences
0
1102110
02
1021210
01
0110
],...,,[],...,,[],...,,[
............
DDorderSecond],[],[],,[
DDorderfirst][][
],[
DDorderzeroth)(][
x x x x x f x x x f
x x x f
x x x x f x x f x x x f
x x x f x f
x x f
x f x f
k
k k k
k k
-
8/13/2019 Interpolation in numerical methods
20/51
NEWTONs INTERPOLATION POLYNOMIAL
Now
],...,,[
....
],,[
)()()()(
],[)()(
][)(
.. ....)(
10
2102
01
01
12
12
2
1001
01
1
00
10102010
nn
nnn
x x x f b
x x x f x x
x x x f x f
x x x f x f
b
x x f x x x f x f
b
x f x f b
x x x xb x x x xb x xbb x f
-
8/13/2019 Interpolation in numerical methods
21/51
NEWTONs INTERPOLATION POLYNOMIAL
polynomial al erpolation
differencedivided s Newtonasknown
x x x x x f x f
n
i
i
j jin
int
'
],...,,[)( 0
1
010
-
8/13/2019 Interpolation in numerical methods
22/51
EX MPLE
22
CONSTRUCT A POLYNOMIAL OF DEGREE TWO WHICHINTERPOLATES THE FOLLOWING SET OF POINTS.
x 1 2 3
f(x) 0 2 6
ALSO, FIND THE VALUE OF F(2.5)
f(2.5)=3.75
-
8/13/2019 Interpolation in numerical methods
23/51
Divided Difference Tablex F[ ] F[ , ] F[ , , ] F[ , , ,]
x 0 F[x0] F[x 0 ,x 1] F[x 0 ,x 1, x 2 ] F[x 0 ,x 1 ,x 2 ,x 3 ]
x 1 F[x 1 ] F[x 1 ,x 2] F[x 1 ,x 2 ,x 3 ]
x 2 F[x 2 ] F[x 2 ,x 3]
x 3 F[x 3 ]
-
8/13/2019 Interpolation in numerical methods
24/51
Divided Difference Tablef(x i )
0 -5
1 -3-1 -15
i xx F[ ] F[ , ] F[ , , ]
0 -5 2 -4
1 -3 6
-1 -15
Entries of the divided differencetable are obtained from the datatable using simple operations
-
8/13/2019 Interpolation in numerical methods
25/51
Divided Difference Tablef(x i )
0 -51 -3
-1 -15
i xx F[ ] F[ , ] F[ , , ]
0 -5 2 -4
1 -3 6
-1 -15
The first two column of the
table are the data columns
Third column : first order differences
Fourth column: Second order differences
-
8/13/2019 Interpolation in numerical methods
26/51
Divided Difference Table
0 -5
1 -3-1 -15
i yi xx F[ ] F[ , ] F[ , , ]0 -5 2 -4
1 -3 6
-1 -15
201
)5(3
01
0110
][][],[
x x x f x f
x x f
-
8/13/2019 Interpolation in numerical methods
27/51
Divided Difference Table
0 -5
1 -3-1 -15
i yi xx F[ ] F[ , ] F[ , , ]0 -5 2 -4
1 -3 6
-1 -15
611
)3(15
12
1221
][][],[
x x x f x f
x x f
-
8/13/2019 Interpolation in numerical methods
28/51
Divided Difference Table
0 -5
1 -3-1 -15
i yi xx F[ ] F[ , ] F[ , , ]0 -5 2 -4
1 -3 6
-1 -15
4)0(1
)2(6
02
1021210
],[],[],,[
x x x x f x x f
x x x f
-
8/13/2019 Interpolation in numerical methods
29/51
Divided Difference Table
0 -5
1 -3-1 -15
i yi xx F[ ] F[ , ] F[ , , ]0 -5 2 -4
1 -3 6
-1 -15
)1)(0(4)0(25)(2 x x x x f
f 2 (x)= f[x 0 ]+ f[x 0 ,x 1 ] (x-x 0 )+ f[x 0 ,x 1 ,x 2 ] (x-x 0 )(x-x 1 )
-
8/13/2019 Interpolation in numerical methods
30/51
Two Examples
x y
1 0
2 3
3 8
Obtain the interpolating polynomials for the two examples
x y
2 3
1 0
3 8
What do you observe?
-
8/13/2019 Interpolation in numerical methods
31/51
Two Examples
1
)2)(1(1)1(30)(2
2
x
x x x x P
x Y
1 0 3 1
2 3 53 8
x Y
2 3 3 1
1 0 43 8
1
)1)(2(1)2(33)(2
2
x
x x x x P
Ordering the points should not affect the interpolating polynomial
-
8/13/2019 Interpolation in numerical methods
32/51
Properties of divided Difference
],,[],,[],,[ 012021210 x x x f x x x f x x x f
Ordering the points should not affect the divided difference
-
8/13/2019 Interpolation in numerical methods
33/51
ExampleFind a polynomial tointerpolate the data.
x f(x)
2 3
4 5
5 1
6 6
7 9
-
8/13/2019 Interpolation in numerical methods
34/51
Example
x f(x) f[ , ] f[ , , ] f[ , , , ] f[ , , , , ]2 3 1 -1.6667 1.5417 -0.6750
4 5 -4 4.5 -1.83335 1 5 -16 6 37 9
)6)(5)(4)(2(6750.0
)5)(4)(2(5417.1)4)(2(6667.1)2(134 x x x x
x x x x x x f
-
8/13/2019 Interpolation in numerical methods
35/51
Examplefind a polynomial to interpolate
both Newtons
interpolation methodand Lagrangeinterpolation method
must give the sameanswer
x y
0 1
1 3
2 2
3 5
4 4
-
8/13/2019 Interpolation in numerical methods
36/51
Example 0 1 2 -3/2 1/6 -9/24
1 3 -1 2 -4/3
2 2 3 -2
3 5 -1
4 4
-
8/13/2019 Interpolation in numerical methods
37/51
Interpolating Polynomial
)3)(2)(1(249
)2)(1(61
)1(23
)(21)(4
x x x x
x x x x x x x f
-
8/13/2019 Interpolation in numerical methods
38/51
Interpolating Polynomial UsingLagrange Interpolation method
343
242
141
040
434
232
131
030
424
323
121
020
414
313
212
010
404
303
202
101
4523)()(
4
3
2
1
0
43210
4
04
x x x x
x x x x
x x x x
x x x x
x x x x
x f x f i
ii
491
-
8/13/2019 Interpolation in numerical methods
39/51
Inverse Interpolation
g g g
g
y x f x
y
)(such thatFind
andtableGiven the
:Problem 0 x . .
1 x n x
0 y 1 y n yi x
i y
One approach :
Use polynomial interpolation to obtain f n(x) to interpolate thedata then use Newtons method to find a solution to
g g n y x f )(
-
8/13/2019 Interpolation in numerical methods
40/51
Inverse Interpolation Alternative Approach
0 x .
.
1 x n x
0 y 1 y n y
i x
i y
Inverse interpolation:
1. Exchange the roles
of x and y
2. Perform polynomial
Interpolation on the
new table.
3. Evaluate
)( g n y f
. .
i y 0 y 1 y n y
i x 0 x 1 x n x
-
8/13/2019 Interpolation in numerical methods
41/51
-
8/13/2019 Interpolation in numerical methods
42/51
-
8/13/2019 Interpolation in numerical methods
43/51
Inverse InterpolationExample
5.2)(such thatFind table.Given the
:Problem
g g x f x
x 1 2 3y 3.2 2.0 1.6
3.2 1 -.8333 1.04162.0 2 -2.5
1.6 3
2187.1)5.0)(7.0(0416.1)7.0(8333.01)5.2(
)2)(2.3(0416.1)2.3(8333.01)(
2
2
f
y y y y f
-
8/13/2019 Interpolation in numerical methods
44/51
-5 -4 -3 -2 -1 0 1 2 3 4 5-0.5
0
0.5
1
1.5
2
true function
10 th order interpolating polynomial
10 th order Polynomial Interpolation
-
8/13/2019 Interpolation in numerical methods
45/51
-
8/13/2019 Interpolation in numerical methods
46/51
Errors in polynomial Interpolation Theorem
1
)1(1)(n
)1(4P(x)-f(x)
Then points).endthe(including b][a,in
pointsspacedequally1natf esinterpolatthatndegreeof polynomialany beP(x)Let
b],[a,oncontinuousis(x)f
such thatfunctiona bef(x)Let
n
n
nab
n M
M f
-
8/13/2019 Interpolation in numerical methods
47/51
Example 1
910
1
)1(
1034.19
6875.1)10(4
1P(x)-f(x)
)1(4P(x)-f(x)
9,1
01
[0,1.6875]intervalin the points)spacedequally01(using
f(x)einterpolatto polynomialorderth9usewant toWe sin(x)f(x)
n
n
nab
n M
n M
n for f
-
8/13/2019 Interpolation in numerical methods
48/51
Interpolation Error
n
iinn
n
n
x x x x x x f x f f (x)
x x x
f
010
10
],,...,,[)(nodeanot
any xforthen,...,,nodesat thef(x)functionthe
esinterpolatn thatdegreeof polynomialtheis(x)If
Not useful. Why?
-
8/13/2019 Interpolation in numerical methods
49/51
Approximation of the Interpolation Error
n
iinnn
nn
n
n
x x x x x x f x f f (x)
be x f x Let
x x x f
0110
11
10
],,...,,[)(
byedapproximatiserrorioninterpolatThe
pointadditionalan))(,(
,...,,nodesat thef(x)functiontheesinterpolatn thatdegreeof polynomialtheis(x)If
-
8/13/2019 Interpolation in numerical methods
50/51
Divided Difference Theorem
)(10
10)(
!
1],...,,[
b][a,someforthen b][a,in pointsdistinct1nanyare,...,,if and b][a,oncontinuousis
nn
nn
f n
x x x f
x x x f If
10],...,,[then
norderof polynomialas)(
10 ni x x x f
i x f If
i
1 4 1 0 02 5 1 03 6 14 7
x x f 3)(
-
8/13/2019 Interpolation in numerical methods
51/51
SummaryThe interpolating polynomial is uniqueDifferent methods can be used to obtain it
Newtons Divided difference
Lagrange interpolationothers
Polynomial interpolation can be sensitiveto data.BE CAREFUL when high orderpolynomials are used