L5 Numerical
L5 Numerical
College of Engineering
Bio. Eng. Dept.
Subject: Numerical Analysis
Third Stage
Chapter Two
Interpolation and Curve Fitting
Introduction 3
The word interpolation refers to approximating , predicting, or estimating some unknown
information from a given set of known information. The technique of interpolation is widely
used as a valuable tool in science and engineering. The problem is a classical one and dates
back to the time of Newton and Kepler, who needed to solve such a problem in analyzing data
on the position of stars and planets.
•Spline Interpolation: Pass different curves (mostly 3rd order) through different subsets of the data
points.
1.Lagrange’s interpolation formula 5
Let 𝑦 = 𝑓( 𝑥) be a function such that 𝑓( 𝑥) takes the values 𝑦0 , 𝑦1 , 𝑦2 , … … . , 𝑦𝑛 corresponding to
𝑥 = 𝑥0 , 𝑥1 , 𝑥2 … , 𝑥𝑛 That is 𝑦𝑖 = 𝑓(𝑥𝑖 ), 𝑖 = 0,1,2, … , 𝑛 .
Now, there are (𝑛 + 1) paired values (𝑥𝑖 , 𝑦𝑖 ), 𝑖 = 0, 1, 2, … , 𝑛 and hence 𝑓 ( 𝑥) can be represented
by a polynomial function of degree n in 𝑥.
Then the Lagrange’s formula is
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) … (𝑥 − 𝑥𝑛 ) (𝑥 − 𝑥0 )(𝑥 − 𝑥2 ) … (𝑥 − 𝑥𝑛 )
𝑦 = 𝑓(𝑥) = 𝑦0 + 𝑦
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 ) … (𝑥0 − 𝑥𝑛 ) (𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 ) … (𝑥1 − 𝑥𝑛 ) 1
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) … (𝑥 − 𝑥𝑛−1 )
+. . + 𝑦 … … . (1)
(𝑥𝑛 − 𝑥0 )(𝑥𝑛 − 𝑥1 ) … (𝑥𝑛 − 𝑥𝑛−1 ) 𝑛
Solution: Here the intervals are unequal. By Lagrange’s interpolation formula we have
𝑥0 = 5, 𝑥1 = 6, 𝑥2 = 9, 𝑥3 = 11
𝑦0 = 12, 𝑦1 = 13, 𝑦2 = 14, 𝑦3 = 16
1 13 5(14) 4 × 16
= (12) − + +
6 3 3×2 12
= 14.6663
2.Newton’s Gregory forward interpolation formula 7
Let 𝑦 = 𝑓 ( 𝑥) denote a polynomial of degree n which takes (𝑛 + 1) values. Let them be
𝑦0 , 𝑦1 , 𝑦2 , … 𝑦𝑛 corresponding to the values 𝑥 , 𝑥 , … 𝑥𝑛 respectively.
Solution:
𝑥 𝐹(𝑥) Δ𝑓𝑖 Δ2 𝑓𝑖 Δ3 𝑓𝑖
2 9.68 1.28 0.08 0
4 10.96 1.36 0.08 0
6 12.32 1.44 0.08
8 13.76 1.52
10 15.28
For 𝑥 = 2.4; 𝑥0 = 2; ℎ = 2
2.4 − 2 0.08
we get 𝑓 2.4 = 9.68 + ∗ 1.28 + 0.2(0.2 − 1) ∗ = 9.9296
2 2
Example: In the following table of 𝑒 (𝑥) use the Newton-Gregory formula of backward 12
interpolation to calculate 𝑒 (2.0) ?
𝑥 0.1 0.6 1.1 1.6 2.1
𝑒 (𝑥) 1.1052 1.8221 3.0042 4.9530 8.1662
Solution:
𝑥 𝑒 (𝑥) 𝛻𝑓𝑖 𝛻 2 𝑓𝑖 𝛻 3 𝑓𝑖 𝛻 4 𝑓𝑖
0.1 1.1052
1.2644 0.4977
𝑒 2.00 = 8.1662 − 0.2 × 3.2132 − 0.2 × 0.8 × − 0.2 × 0.8 × 1.8 × +⋯
2 6
= 7.3920
13
Homework:
Construct the differences table and then find
1. 𝑓(𝑥) when 𝑥 = 112
2. 𝑓(𝑥) when 𝑥 = 112
𝑥 100 110 120 130 140
𝐹(𝑥) 3 7 13 21 31