Documente Academic
Documente Profesional
Documente Cultură
Chapter 18
Interpolation
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
. info@eng-hs.com 260 4444 9
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
For n+1 data points, there is one and only one polynomial of
order n that passes through all the points. For example,
there is only one straight line (that is, a first-order
polynomial) that connects two points (figure (a)). Similarly,
only one parabola connects a set of three points (figure (b)).
Polynomial Interpolation consists of determining the unique
nth order polynomial that fits n+1 data points. This
polynomial
then
provides
formula
to
compute
intermediate values.
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
f ( x 1 )f ( x0 )
x 1x 0
f ( x 1 )f ( x 0 )
The notation
x1x 0
f 1(x)
( xx 0)
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
the
natural
logarithm
of
using
linear
interpolation.
First, perform the computation by interpolating between ln 1
=
and
from
x0 = 1 to x1 = 6 to give
f 1 ( 2 )=0+
1.7917590
( 21 )=0.3583519
61
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
from
x0 = 1 to x1 = 4 yields
f 1 ( 2 )=0+
1.3862940
( 21 )=0.4620981
41
to
with
the
true
function.
error
in
Example
18.1
resulted
from
our
three
accomplished
data
points
are
available,
with
this
can
be
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
(18.3)
where
a0 =b0b1 x 0 +b 2 x 0 x 1
a1=b1b 2 x 0 +b2 x1
a2=b2
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
f ( x 1 ) f ( x 0 )
x 1x 0
Finally,
f ( x 2 )f ( x 1) f ( x 1 )f ( x 0 )
x2 x1
x 1x 0
b2=
x 2x 0
interpolation
from
x0
to
x1.
EXAMPLE 18.2 Quadratic Interpolation
Fit a second-order polynomial to the three points used in
Example 18.1:
x 0=1 f ( x 0 )=0
x 1=4 f ( x 1) =1.386294
x 2=6 f ( x 2 )=1.791759
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
1.386294
=0.4620981
41
1.7917591.386294
0.4620981
64
b2=
=0.0518731
61
f 2 ( x )=0+ 0. 4620981 ( x1 )0.0518731 ( x1 ) ( x4 )
f 2 ( 2 )=0.5658444
the
interpolation
compared
with
the
result
General
form
18.1.3
of Newtons Interpolating Polynomials
polynomial
to
n+1
data
points.
The
n th-order
polynomial is
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
bn.
.
.
.
bn =f [ x n , x n1 , , x 1 , x 0 ]
f ( xi ) f (x j )
x ix j
the
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
f [ x i , x j , x k ]=
f [ x i , x j ]f [ x j , x k ]
xi x k
f [ x n , x n1 , , x 1 ] f [ xn 1 , x n2 , , x0 ]
x nx 0
.
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
EXAMPLE
18.3
Newtons
Divided-Difference
Interpolating Polynomials
Problem Statement:
In Example 18.2, data points at x 0 = 1, x1 = 4, and x2 = 6
were used to estimate ln 2 with a parabola. Now, adding a
fourth
point
[x3
5;
1.3862940
=0.4620981
41
f [ x 2 , x 1 ]=
1.7917591.386294
=0.2027326
64
f [ x 3 , x 2 ]=
1.6094381.791759
=0.1823216
56
0.20273260.4620981
=0.05187311
61
f [ x 3 , x 2 , x 1 ]=
0.18232160.2027326
=0.02041100
54
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
Continue:
The third divided difference is
f [ x 3 , x 2 , x 1 , x 0 ]=
0.2027326(0.05187311)
=0.007865529
51
f [ x1 , x0]
f [ x2 , x1 , x0 ]
, and
f [ x3 , x2 , x1 , x0 ]
represent
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++,
Java,
Data,
Algorithms,
9 4444 260
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
f n ( x ) = Li ( x ) f ( x i )
i=0
(18.20)
where
n
Li ( x ) =
j=0
j i
where
xx j
x ix j
xx 1
xx 0
f ( x0 )+
f ( x1 )
x0 x1
x 1x 0
Eq.
( xx 1 )( x x2 )
( x x0 ) ( xx 2 )
( xx 0 ) ( xx 1 )
f ( x0 )+
f ( x1 ) +
f ( x2 )
( x 0x 1 )( x 0 x2 )
( x1 x0 ) ( x 1x 2 )
( x 2x 0 ) ( x 2x 1)
(18.20)
can
be
derived
directly
from
Newtons
polynomial.
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
+ ( x x0 ) (xx 1)
( x2 x0 ) ( x2 x1 )
f ( x2 )
EXAMPLE
18.6
Lagrange
Interpolating Polynomials
Problem Statement:
Use a Lagrange interpolating polynomial of the first and
second order to evaluate ln 2 on the basis of the data given:
X0 = 1
f(x0) = 0
X1 = 4
f(x1) = 1.386294
X2 = 6
f(x2) = 1.791760
Solution:
The first-order polynomial can be used to obtain the
estimate at x = 2,
f 1 ( 2 )=
In
24
21
0+
14
41
similar
1.386294 = 0.4620981
fashion,
the
second-order
polynomial
is
developed as
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
f 2 ( 2 )=
1.386294
+(21)(24)
1.791760=0.5658444
( 61 ) (64)
:
:
:
Problem 18.1
Estimate
the
common
logarithm
of
10
using
linear
interpolation.
(a)
= 1.0791812.
(b) Interpolate between log 9 = 0.9542425 and log 11
= 1.0413927.
For each of the interpolations, compute the percent relative
error based on the true value.
Solution
(a)
f 1 (10) 0.90309
1.0791812 0.90309
(10 8) 0.991136
12 8
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
1 0.991136
100 % 0.886 %
1
(b)
f 1 (10) 0.9542425
1.0413927 0.9542425
(10 9) 0.997818
11 9
1 0.997818
100 % 0.218 %
1
Problem 18.2
Solution
First, order the points
x0 = 9 f(x0) = 0.9542425
x1 = 11
f(x1) = 1.0413927
x2 = 8 f(x2) = 0.9030900
b0 = 0.9542425
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
b1
1.0413927 0.9542425
0.0435751
11 9
0.9030900 1.0413927
0.0435751
0.0461009 0.0435751
8 11
b2
0.0025258
89
89
Problem 18.3
Fit a third-order Newtons interpolating polynomial to
estimate log 10 using the data from Problem 18.1
Solution:
First, order the points
x0 = 9 f(x0) = 0.9542425
x1 = 11
f(x1) = 1.0413927
x2 = 8 f(x2) = 0.9030900
x3 = 12
f(x3) = 1.0791812
The first divided differences can be computed as
f [ x1 , x 0 ]
1.0413927 0.9542425
0.0435751
11 9
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
f [ x 2 , x1 ]
0.9030900 1.0413927
0.0461009
8 11
f [ x3 , x 2 ]
1.0791812 0.9030900
0.0440228
12 8
0.0461009 0.0435751
0.0025258
89
f [ x3 , x 2 , x1 ]
0.0440228 0.0461009
0.0020781
12 11
0.0020781 (0.0025258 )
0.00014924
12 9
Continue:
Substituting the appropriate values into Eq. (18.7) gives
f 3 ( x) 0.9542425 0.0435751 ( x 9) 0.0025258 ( x 9)( x 11)
0.00014924 ( x 9)( x 11)( x 8)
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
Numerical, Economy
eng-hs.com, eng-hs.net
July 2013
9 4444 260
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms,
. info@eng-hs.com 260 4444 9
Numerical, Economy
eng-hs.com, eng-hs.net