You are on page 1of 30

1

MATH 411: NUMERICAL ANALYSIS

Chapter-3: Interpolation and Polynomial


Approximation

Dr. Nahid Sultana


Email: nszakir@iau.edu.sa
Chapter Summary
2

3.1 Interpolation and the Lagrange Polynomial

3.3 Divided Differences

3.4 Hermite Interpolation


3.1 Interpolation and the Lagrange Polynomial
3

Lagrange Interpolating Polynomial:


 Let 𝑓(𝑥) be continuous and differentiable (𝑛 + 1) times in (𝑎, 𝑏).
 Given 𝑛 + 1 points (𝒙𝟎, 𝒚𝟎), (𝒙𝟏, 𝒚𝟏), … , (𝒙𝒏, 𝒚𝒏).
 Problem to be solved: Find a polynomial of degree n such that 𝑷(𝒙𝒊 ) = 𝒇(𝒙𝒊 ) = 𝒚𝒊
3.1 Linear Lagrange Interpolating Polynomial
4

 First consider the simple case, the equation of straight line (a Linear Polynomial) passing through two
points 𝑥0, 𝑦0 , 𝑥1, 𝑦1 .
𝒙−𝒙𝟏 𝒙−𝒙𝟎
 Such a polynomial, can be written as: 𝑷 𝒙 = 𝒚 + 𝒚
𝒙𝟎 −𝒙𝟏 𝟎 𝒙𝟏 −𝒙𝟎 𝟏

𝑥−𝑥1 𝑥−𝑥0
= 𝑓(𝑥0 ) + 𝑓(𝑥1 )
𝑥0 −𝑥1 𝑥1 −𝑥0

= 𝑳𝟎 𝒙 𝒇(𝒙𝟎 ) + 𝑳𝟏 𝒙 𝒇(𝒙𝟏 )

 This is the Lagrange polynomial of degree one passing through two points 𝑥0, 𝑦0 , 𝑥1, 𝑦1 .
𝒙−𝒙𝟏 𝒙−𝒙𝟎
 Here 𝑳𝟎 𝒙 = and 𝑳𝟏 𝒙 =
𝒙𝟎 −𝒙𝟏 𝒙𝟏 −𝒙𝟎

 i.e. 𝐿0 𝑥0 =1, 𝐿0 𝑥1 =0, 𝐿1 𝑥0 =0, and 𝐿1 𝑥1 =1. Also σ1𝑖=0 𝐿𝑖 x = 1


3.1 Interpolation and the Lagrange Polynomial
5

Determine the linear Lagrange interpolation polynomial that passes through the points
(2,4) and (5,1)
3.1 Interpolation and the Lagrange Polynomial
6
3.1 Linear Lagrange Interpolating Polynomial
7
3.1 Error Bound for the Lagrange Interpolating
8
Polynomial
Theorem:
3.1 Interpolation and the Lagrange Polynomial
9

Example: (part 1) Use the numbers 𝑥0 = 2, 𝑥1 = 2.75, and 𝑥2 = 4 to find the second
1
Lagrange interpolating polynomial for 𝑓 𝑥 = .
𝑥
3.1 Interpolation and the Lagrange Polynomial
10

Example: (part 2) Determine the error form for this polynomial and find the upper bound
of the error when this polynomial is used to approximate for 𝑥 ∈ 2, 4 .
3.1 Interpolation and the Lagrange Polynomial
11

Let 𝑃3 (𝑥) be the interpolating Lagrange polynomial for the data (0, 0), (0.5, y), (1, 3) and
(2, 2). The coefficient of 𝑥 3 in 𝑃3 𝑥 is 6. Find the value of y.
3.3 Divided Differences
12

Newton’s Divided Difference Polynomial (NDDP):

 If 𝑃𝑛(𝑥) is the 𝑛th degree Lagrange interpolating polynomial that agrees


with 𝑓(𝑥) at the points {𝑥0, 𝑥1, … , 𝑥𝑛}, express 𝑃𝑛(𝑥) in the form:

𝑃𝑛 𝑥 = 𝑏0 + 𝑏1(𝑥 − 𝑥0) + 𝑏2(𝑥 − 𝑥0)(𝑥 − 𝑥1) + ⋯ +


𝑏𝑛 (𝑥 − 𝑥0)(𝑥 − 𝑥1)(𝑥 − 𝑥2) … (𝑥 − 𝑥𝑛−1 )

 Problem: How to find constants b0,…, b𝑛?


3.3 Linear polynomial:
13

 First consider the simple case, a Linear Polynomial, passing through two points 𝑥0, 𝑦0 , 𝑥1, 𝑦1 .

𝑃1 𝑥 = 𝑏0 + 𝑏1(𝑥 − 𝑥0)

Where
b0  f ( x0 )
f ( x1 )  f ( x0 )
b1 
x1  x0
3.3 Quadratic polynomial
14

 Second degree Polynomial, passing through three points 𝑥0, 𝑦0 , 𝑥1, 𝑦1 and 𝑥2, 𝑦2 .

𝑃2 𝑥 = 𝑏0 + 𝑏1(𝑥 − 𝑥0) + 𝑏2(𝑥 − 𝑥0)(𝑥 − 𝑥1)


where

b0  f ( x0 )

f ( x1 )  f ( x0 )
b1 
x1  x0
f ( x 2 )  f ( x1 ) f ( x1 )  f ( x0 )

x 2  x1 x1  x0
b2 
x 2  x0
3.3 Quadratic polynomial (cont…)
General form
15

 Second degree Polynomial, passing through three points 𝑥0, 𝑦0 , 𝑥1, 𝑦1 and 𝑥2, 𝑦2 .

𝑃2 𝑥 = 𝑏0 + 𝑏1(𝑥 − 𝑥0) + 𝑏2(𝑥 − 𝑥0)(𝑥 − 𝑥1)

where b0  f ( x0 )  f [ x0 ]

f ( x1 )  f ( x0 )
b1   f [ x1 , x0 ]
x1  x0
f ( x2 )  f ( x1 ) f ( x1 )  f ( x0 )

x2  x1 x1  x0 f [ x2 , x1 ]  f [ x1  x0 ]
b2    f [ x2 , x1 , x0 ]
x2  x0 x2  x0
Rewriting
P2 ( x)  f [ x0 ]  f [ x1 , x0 ]( x  x0 )  f [ x2 , x1 , x0 ]( x  x0 )( x  x1 )
3.3 Quadratic polynomial (cont…)
General form
16

The 𝑛th degree polynomial that passes through the points {𝑥0, 𝑥1, … , 𝑥𝑛}:

𝑃𝑛 𝑥 = 𝑏0 + 𝑏1(𝑥 − 𝑥0) + 𝑏2(𝑥 − 𝑥0)(𝑥 − 𝑥1) + ⋯ +


𝑏𝑛 (𝑥 − 𝑥0)(𝑥 − 𝑥1)(𝑥 − 𝑥2) … (𝑥 − 𝑥𝑛 − 1)
where
b0  f [ x0 ]
b1  f [ x0 , x1 ]
b2  f [ x0 , x1 , x2 ]

bn1  f [ x0 , x1 ,...., xn1 ]
bn  f [ x0 , x1 ,..., xn1 , xn ]
3.3 Divided Differences
17
3.3 Divided Differences (cont…)
18
Complete the divided difference table

𝑋𝑖 𝑓(𝑥𝑖 )

𝑋0 = 1 0.7651977

𝑋1 = 1.3 0.6200860

𝑋2 = 1.6 0.4554022

𝑋3 = 1.9 0.2818186

𝑋4 = 2.2 0.1103623

19
3.3 Newton forward-difference formula
20

 The nodes are arranged consecutively with equal spacing.


 𝑥𝑖+1 − 𝑥𝑖 = ℎ, for each 𝑖 = 0,1, … , 𝑛 − 1
 let 𝑥 = 𝑥0 + 𝑠ℎ.
 Then the difference 𝑥 − 𝑥𝑖 = (𝑠 − 𝑖)ℎ.
 Then
3.3 Newton backward-difference formula
21

 If the interpolating nodes are reordered from last to first as


𝑥𝑛, 𝑥𝑛−1 , … . , 𝑥0,
 Also let 𝑥 = 𝑥𝑛 + 𝑠ℎ
 Then we can write the interpolatory formula as
3.3 Newton centered-difference formula
22

 For the centered-difference formulas, we choose x0 near the point being approximated.
 and label the nodes directly below 𝑥0 as 𝑥1, 𝑥2, …and those directly above as 𝑥−1, 𝑥−2 , ….
 Stirling’s formula:

if n = 2m+1 is odd. If n = 2m is even, we use the same formula but delete the last line.
3.3 Newton centered-difference formula
23
24
3.4 Hermite Interpolation
25
3.4 Hermite Interpolation
26
3.4 Hermite Polynomials Using
27
Divided Differences

 Construct the divided difference table that uses z0, z1, . . ., z2n+1.
 But z2i = z2i+1 = xi , f [z2i, z2i+1] is undefined.
 In place of the undefined first divided differences:

we can use the entries


3.4 Hermite Polynomials Using
28
Divided Differences
Find Hermite polynomial using DD table

𝑋𝑖 𝑓(𝑥𝑖 ) 𝑓’(𝑥𝑖 ) 𝑍𝑖 𝐹[𝑧𝑖 ]

𝑋0 = 8.3 17.56492 3.116256

𝑋1 = 8.6 18.50515 3.151762

29
30

You might also like