Tutorial 6 – Interpolation
1
General Form of Polynomial Interpolation (1)
2
General Form of Polynomial Interpolation (2)
3
T6 – Q1
(b) Utilize Eq. (18.18) to estimate the error for each prediction.
4
T6-Q1
First, order the points so that they are as close to and as centered
about the unknown as possible
x0 = 2.5 f ( x0 ) = 14
x1 = 3.2 f ( x1 ) = 15
x2 = 2 f ( x2 ) = 8
x3 = 4 f ( x3 ) = 8
x4 = 1 . 6 f ( x4 ) = 2
Next, the divided differences can be computed and displayed in the
format of Fig. 18.5,
5
1st divided difference 2nd divided difference
15 − 14
f [ x0 , x1 ] = = 1.428571
3.2 − 2.5 5.83333 − 1.428571
f [ x0 , x1 , x2 ] = = −8.809524
2 − 2.5
8 − 15
f [ x1 , x2 ] = = 5.833333
2 − 3.2
0 − 5.833333
f [ x1 , x2 , x3 ] = = −7.291667
4 − 3.2
8−8
f [ x2 , x3 ] = =0
4−2
2−8
f [ x3 , x4 ] = = 2.5
1.6 − 4
x 1 2 3 5 7 8
f(x) 3 6 19 99 291 444
8
T6-Q2
First, order the points so that they are as close to and as centered
about the unknown as possible
x0 = 3 f ( x0 ) = 19
x1 = 5 f ( x1 ) = 99
x2 = 2 f ( x2 ) = 6
x3 = 7 f ( x3 ) = 291
x4 = 1 f ( x4 ) = 3
9
T6 – Q2
The first through fourth‐order interpolations can then be
implemented as
f1 (4) = 19 + 40(4 − 3) = 59
f 2 (4) = 59 + 9(4 − 3)(4 − 5) = 50
f 3 (4) = 50 + 1(4 − 3)(4 − 5)(4 − 2) = 48
f 4 (4) = 48 + 0(4 − 3)(4 − 5)(4 − 2)(4 − 7) = 48
Clearly the data was generated with a cubic polynomial since the
difference between the 4th and the 3rd‐order versions is zero.
10
T6‐Q3: Lagrange Interpolating Polynomial
(Q3) Repeat T6‐Q2 using Lagrange Polynomial
Given the data
x 1 2 3 5 7 8
f(x) 3 6 19 99 291 444
11
T6-Q3: Lagrange Interpolating Polynomial
The data points are chosen and ordered in the same way as that used
in the Newton’s polynomial, i.e. based on proximity to the target x=4.
i xi f(xi)
0 3 19
1 5 99
2 2 6
3 7 291
4 1 3
12
T6‐Q3: Lagrange Interpolating Polynomial
n
fn ( x) = ∑ L (x) f (x )
i=0
i i
n
x − xj
where: Li ( x ) = ∏ j=0 xi − x j
Π denotes the “product of”.
j≠i
The results for the Lagrange Polynomial of the 1st to 4 order are as
follow: f ( x) =
( x − x )( x − x ) 1 2
f ( x0 )
( x0 − x1 )( x0 − x2 )
2
(4 − 5) ( 4 − 3) ( x − x0 )( x − x2 )
f1 (4) = 19 + 99 = 59 +
( x1 − x0 )( x1 − x2 )
f ( x1 )
(3 − 5) (5 − 3) +
( x − x0 )( x − x1 )
f ( x2 )
( x2 − x0 )( x2 − x1 )
14
T6-Q3: Lagrange Interpolating Polynomial
15
T6 – Q4
x 2 3 4 5 6 7
f(x) 0.5 0.3333 0.25 0.2 0.167 0.1429
16
T6 – Q4
Bisection can then be used to determine the root. Using initial guesses
of xl = 4 and xu = 5, the first five iterations are
18