You are on page 1of 20

MATH-352 Numerical Methods – 2+1 CHs

By

Prof Dr Safia Akram

(INTER POLATION WITH UNEQUAL INTERVALS)


OR
(INTER POLATION WITH NON-EQUALLY SPACE DATA)

Lec # 9

1
INTERPOLATION WITH UNEQUAL INTERVALS
OR
INTERPOLATION WITH NON-EQUALLY SPACED DATA
For various numerical and experimental reasons, it is often inconvenient or
impossible to obtain data at equally spaced intervals. The interpolation theory
discussed so for is based on equally spaced intervals. we shall now study the
approximation of functions by interpolating polynomials when data is not equally
spaced.
DIVIDED DIFFERENCE
Let 𝑓 𝑥0 , 𝑓 𝑥1 , 𝑓 𝑥2 , … , 𝑓 𝑥𝑛 be the entry values of the function 𝑦 = 𝑓(𝑥) at
the arguments 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑛 which are not equally spaced (i-e intervals of
differencing is not constant).
Divided difference can now be defined as the difference between two successive
values of the entry divided by the difference b/w the corresponding values of the
arguments.
Therefore, the first divided difference of 𝑓(𝑥) for the arguments 𝑥0 and 𝑥1 is
𝑓 𝑥1 −𝑓 𝑥0
defined as and is denoted by 𝑓 𝑥0 , 𝑥1 or 𝑥0 , 𝑥1 .
𝑥1 −𝑥0

2
first order divided difference for the arguments:
𝑓 𝑥1 − 𝑓 𝑥0
𝑓 𝑥0 , 𝑥1 = 𝑥0 , 𝑥1 = = 𝑥1 , 𝑥0
𝑥1 − 𝑥0
Similarly,
𝑓 𝑥2 − 𝑓 𝑥1
𝑓 𝑥1 , 𝑥2 = 𝑥1 , 𝑥2 = = 𝑥2 , 𝑥1
𝑥2 − 𝑥1

𝑓 𝑥3 − 𝑓 𝑥2
𝑓 𝑥3 , 𝑥2 = 𝑥2 , 𝑥3 = = 𝑥3 , 𝑥2
𝑥3 − 𝑥2
Second order dividend difference for the arguments 𝑥0 to 𝑥3

𝑥2 , 𝑥1 − 𝑥1 , 𝑥0
𝑓 𝑥0 , 𝑥1 , 𝑥2 = 𝑥0 , 𝑥1 , 𝑥2 = = 𝑥2 , 𝑥1 , 𝑥0
𝑥2 − 𝑥0

𝑥3 , 𝑥2 − 𝑥2 , 𝑥1
𝑓 𝑥1 , 𝑥2 , 𝑥3 = 𝑥3 , 𝑥2 , 𝑥1 = = 𝑥1 , 𝑥2 , 𝑥3
𝑥3 − 𝑥1
The third order divided difference of 𝑓(𝑥) for four arguments 𝑥0 , 𝑥1 , 𝑥2 and 𝑥3 is
defined as
𝑥3 , 𝑥2 , 𝑥1 − 𝑥2 , 𝑥1 , 𝑥0
𝑓 𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 = 𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 = = 𝑥3 , 𝑥2 , 𝑥1 , 𝑥0
𝑥3 − 𝑥0
3
Similarly, we can define higher order divided differences.
Thus, to define a first divided difference we need the functional values
corresponding to two arguments, to define a second divided difference we need two
first divided differences of two arguments, one of which is common, and so on. The
divided difference table is as follows:

𝑥 Entry 1st Divided Difference 2nd Divided Difference 3rd Divided


𝑓(𝑥) Difference

𝑥0 𝑓0 = 𝑦0 𝑓 𝑥 − 𝑓 𝑥
1 0
= 𝑥1 , 𝑥0
𝑥1 − 𝑥0 𝑥2 , 𝑥1 − 𝑥1 , 𝑥0
𝑥1 𝑓1 = 𝑦1 = 𝑥2 , 𝑥1 , 𝑥0
𝑓 𝑥2 − 𝑓 𝑥1 𝑥2 − 𝑥0
= 𝑥2 , 𝑥1 𝒙𝟑 , 𝒙𝟐 , 𝒙𝟏 − 𝒙𝟐 , 𝒙𝟏 , 𝒙𝟎
𝑥2 − 𝑥1 𝒙𝟑 − 𝒙𝟎
𝑥2 𝑓2 = 𝑦2 𝑥3 , 𝑥2 − 𝑥2 , 𝑥1
= 𝑥3 , 𝑥2 , 𝑥1 = 𝒙𝟑 , 𝒙𝟐 , 𝒙𝟏 , 𝒙𝟎
𝑓 𝑥3 − 𝑓 𝑥2 𝑥3 − 𝑥1
= 𝑥3 , 𝑥2
𝑥3 − 𝑥2
𝑥3 𝑓3 = 𝑦3
4
EXAMPLE #1: Construct a divided difference table for the following
data. 𝑥 4 5 7 10 11 13

𝑓(𝑥) 48 100 294 900 1210 2028

Solution: The divided difference table is as follows:


1st Divided 2nd Divided 3rd Divided 4th Divided
𝑥 𝑓(𝑥)
Difference Difference Difference Difference

4 48 100 − 48
= 52
5−4 97 − 52
= 15 21 − 15
5 100 294 − 100 7−4
= 97 =1
7−5 202 − 97 10 − 4
= 21 0
7 294 900 − 294 10 − 5 27 − 21
= 202 =1
10 − 7 310 − 202 11 − 5
= 27 0
10 900 1210 − 900 11 − 7 33 − 27
= 310 =1
11 − 10 409 − 310 13 − 7
11 1210 = 33
2028 − 1210 13 − 10
= 409
13 − 11
13 2028
5
Relation b/w Divided Differences and Forward Differences
Let the arguments 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑛 be equally spaced
i-e 𝑥𝑖+1 = 𝑥𝑖 + ℎ (say) for 𝑖 = 0, 1, 2, ⋯ , 𝑛 − 1

𝑓 𝑥1 − 𝑓 𝑥0 𝑓 𝑥0 + ℎ − 𝑓 𝑥0
𝑥1 , 𝑥0 = 𝑓 𝑥1 , 𝑥0 = =
𝑥1 − 𝑥0 𝑥1 − 𝑥0
𝑥0
𝑥1 = 𝑥0 + ℎ
Δ𝑓 𝑥0
𝑓 𝑥1 , 𝑥0 = 𝑥2 = 𝑥1 + ℎ
ℎ 𝑥2 = 𝑥0 + 2ℎ
𝑥3 = 𝑥2 + ℎ
𝑥2 , 𝑥1 − 𝑥1 , 𝑥0
𝑥2 , 𝑥1 , 𝑥0 = = 𝑓(𝑥2 , 𝑥1 , 𝑥0 ) Eq. (1)
𝑥2 − 𝑥0
Now
𝑓 𝑥2 − 𝑓 𝑥1 𝑓 𝑥1 + ℎ − 𝑓 𝑥1 Δ𝑓 𝑥1
⇒ 𝑥2 , 𝑥1 = = =
𝑥2 − 𝑥1 ℎ ℎ

So, Equation (1) becomes


6
Δ𝑓 𝑥1 Δ𝑓 𝑥0
− Δ𝑓 𝑥1 − Δ𝑓 𝑥0
𝑥2 , 𝑥1 , 𝑥0 = 𝑓 𝑥2 , 𝑥1 , 𝑥0 = ℎ ℎ =
2ℎ 2ℎ2

Δ 𝑓 𝑥1 − 𝑓 𝑥0 Δ 𝑓 𝑥0 + ℎ − 𝑓 𝑥0 Δ Δ𝑓 𝑥0 Δ2 𝑓 𝑥0
= = = =
2ℎ2 2ℎ2 2ℎ2 2ℎ2

Similarly
𝑥3 , 𝑥2 , 𝑥1 − 𝑥2 , 𝑥1 , 𝑥0
𝑥3 , 𝑥2 , 𝑥1 , 𝑥0 = 𝑓 𝑥3 , 𝑥2 , 𝑥1 , 𝑥0 = Eq. (2)
𝑥3 − 𝑥0

𝑥3 , 𝑥2 − 𝑥2 , 𝑥1
Now 𝑥3 , 𝑥2 , 𝑥1 =
𝑥3 − 𝑥1

and
𝑓 𝑥3 − 𝑓 𝑥2 𝑓 𝑥2 + ℎ − 𝑓 𝑥2 Δ𝑓 𝑥2
𝑥3 , 𝑥2 = = =
𝑥3 − 𝑥2 ℎ ℎ

𝑓 𝑥2 − 𝑓 𝑥1 𝑓 𝑥1 + ℎ − 𝑓 𝑥1 Δ𝑓 𝑥1
𝑥2 , 𝑥1 = = =
𝑥2 − 𝑥1 ℎ ℎ
7
Δ𝑓 𝑥2 Δ𝑓 𝑥1
− Δ 𝑓 𝑥2 − 𝑓 𝑥1 Δ 𝑓 𝑥1 + ℎ − 𝑓 𝑥1
𝑥3 , 𝑥2 , 𝑥1 = ℎ ℎ = =
2ℎ 2ℎ2 2ℎ2

Δ Δ𝑓 𝑥1 Δ2 𝑓 𝑥1 𝑥3 = 𝑥2 + ℎ
𝑥3 , 𝑥2 , 𝑥1 = =
2ℎ2 2ℎ2 𝑥3 = 𝑥1 +ℎ + ℎ
𝑥3 − 𝑥1 = 2ℎ
Now substituting values in Eq.(2)

Δ2 𝑓 𝑥1 Δ2 𝑓 𝑥0
2 − 2 Δ2 𝑓 𝑥 −𝑓 𝑥
= 2ℎ 2ℎ 1 0
𝑥3 , 𝑥2 , 𝑥1 , 𝑥0 = 𝑓 𝑥3 , 𝑥2 , 𝑥1 , 𝑥0 =
3ℎ 6ℎ3

Δ2 𝑓 𝑥0 + ℎ − 𝑓 𝑥0 Δ2 Δ𝑓 𝑥0
𝑥3 , 𝑥2 , 𝑥1 , 𝑥0 = 𝑓 𝑥3 , 𝑥2 , 𝑥1 , 𝑥0 = =
6ℎ3 6ℎ3

Δ3 𝑓 𝑥0
𝑓 𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 =
3! ℎ3
.....
1 𝑛 𝑓(𝑥 )
𝑓(𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 , … , 𝑥𝑛 ) = 𝛥 0
𝑛! ℎ𝑛
8
NEWTON'S DIVIDED DIFFERENCE FORMULA
Let 𝑓 𝑥0 , 𝑓 𝑥1 , 𝑓 𝑥2 … , 𝑓 𝑥𝑛 be the values of 𝑓(𝑥) corresponding to the non-
equally spaced arguments 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑛 .
So,
𝑓(𝑥) = 𝑓 𝑥0 + 𝑥 − 𝑥0 𝑓 𝑥0 , 𝑥1 + 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑓 𝑥0 , 𝑥1 , 𝑥2
+ 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 𝑓 𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 + ⋯
+ 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 … 𝑥 − 𝑥𝑛−1 𝑓 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑛
Or
𝑓(𝑥) = 𝑓 𝑥0 + 𝑥 − 𝑥0 𝑥1 , 𝑥0 + 𝑥 − 𝑥0 𝑥 − 𝑥1 [𝑥2 , 𝑥1 , 𝑥0 ]
+ 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 [𝑥3 , 𝑥2 , 𝑥1 , 𝑥0 ] + ⋯ Eq. (A)

+ 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 … 𝑥 − 𝑥𝑛−1 𝑓 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑛
The Formula (𝐴) is the Newton's interpolation formula for unequal intervals, which
in general is also called Newton's divided difference interpolation formula for
unequal intervals.

PROOF: Proof formula (A) Yourself.


9
DEDUCTION:
From the above, we can obtain Gregory-Newton forward interpolation
formula with equal intervals.
(Try yourself )
REMARK: The value of a divided difference is independent of order of
arguments
𝑓 𝑥1 − 𝑓 𝑥0 𝑓 𝑥1 𝑓 𝑥0
𝑓 𝑥0 , 𝑥1 = = +
𝑥1 − 𝑥0 𝑥1 − 𝑥0 𝑥0 − 𝑥1

𝑓 𝑥1 𝑓 𝑥0 𝑓 𝑥1 𝑓 𝑥0
= − =− +
𝑥1 − 𝑥0 𝑥1 − 𝑥0 𝑥0 − 𝑥1 𝑥0 − 𝑥1

𝑓 𝑥0 − 𝑓 𝑥1
𝑓 𝑥0 , 𝑥1 = = 𝑓 𝑥1 , 𝑥0
𝑥0 − 𝑥1

Similarly, we prove above Remark for higher order differences.


10
EXAMPLE # 1:
Given 𝑙𝑜𝑔10 654 = 2.8156, 𝑙𝑜𝑔10 658 = 2.8182, 𝑙𝑜𝑔10 659 = 2.8189
𝑙𝑜𝑔10 661 = 2.8202. Find by using Newton's divided difference formula,
the value of 𝑙𝑜𝑔10 656.
SOLUTION: Now Newton's divided difference formula is
𝑓 𝑥 = 𝑓 𝑥0 + 𝑥 − 𝑥0 𝑥1 , 𝑥0 + 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥2 , 𝑥1 , 𝑥0
+ 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥3 , 𝑥2 , 𝑥1 , 𝑥0
𝑥 𝑥0 = 654 𝑥1 = 658 𝑥2 = 659 𝑥3 = 2.8202
𝑙𝑜𝑔10 𝑥 = 𝑓(𝑥) 2.8156 = 𝑓 𝑥0 2.8182 = 𝑓 𝑥1 2.8189 = 𝑓 𝑥2 2.8202 = 𝑓 𝑥3

𝑓1 − 𝑓0 𝑓 𝑥1 − 𝑓 𝑥0
𝑥1 , 𝑥0 = 𝑓 𝑥1 , 𝑥0 = =
𝑥1 − 𝑥0 𝑥1 − 𝑥0

2.8182 − 2.8156 2.6 × 10−3


= = = 6.5 × 10−4
658 − 654 4

𝑥2 , 𝑥1 − 𝑥1 , 𝑥0
𝑥2 , 𝑥1 , 𝑥0 =
𝑥2 − 𝑥0
11
𝑓 𝑥2 − 𝑓 𝑥1 2.8189 − 2.8182
𝑥2 , 𝑥1 = = = 7 × 10−4
𝑥2 − 𝑥1 659 − 658

𝑥2 , 𝑥1 − 𝑥1 , 𝑥0 7 × 10−4 − 6.5 × 10−4 5 × 10−5


𝑥2 , 𝑥1 , 𝑥0 = = = = 1 × 10−5
𝑥2 − 𝑥0 659 − 654 5

𝑥3 , 𝑥2 , 𝑥1 − 𝑥2 , 𝑥1 , 𝑥0
𝑥3 , 𝑥1 , 𝑥1 , 𝑥0 =
𝑥3 − 𝑥0
Now
𝑥3 , 𝑥2 − 𝑥2 , 𝑥1
𝑥3 , 𝑥2 , 𝑥1 =
𝑥3 − 𝑥1
And
𝑓 𝑥3 − 𝑓 𝑥2 2.8202 − 2.8189 1.3 × 10−3
𝑥3 , 𝑥2 = = = = 6.5 × 10−4
𝑥3 − 𝑥2 661 − 659 2

6.5 × 10−4 − 7 × 10−4 5 × 10−5


⇒ 𝑥3 , 𝑥2 , 𝑥1 = =− = −1.7 × 10−5
661 − 658 3

−1.7 × 10−5 − 1 × 10−5 2.7 × 10−5


⇒ 𝑥3 , 𝑥2 , 𝑥1 , 𝑥0 = =− = −3.8 × 10−6
661 − 654 7
12
Now substituting values in Eq (1)
𝑓 𝑥 = 𝑓 𝑥0 + 𝑥 − 𝑥0 𝑥1 , 𝑥0 + 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥2 , 𝑥1 , 𝑥0
+ 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥3 , 𝑥2 , 𝑥1 , 𝑥0
𝑓 𝑥 = 2.8156 + 𝑥 − 𝑥0 6.5 × 10−4 + 𝑥 − 𝑥0 𝑥 − 𝑥1 1 × 10−5
+ 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 −3 ⋅ 8 × 10−6
At 𝑥 = 656
𝑓 𝑥 = 2.8156 + 656 − 654 6.5 × 10−4 + 656 − 654 656 − 658 1 × 10−5
+(656 − 654)(656 − 658)(656 − 559) −0.4 × 10−5
= 2.8156 + 2 6.5 × 10−4 + (2)(−2) 1 × 10−5 + 2(−2)(−3) −3.8 × 10−6
= 2.8156 + 1.3 × 10−3 − 4 × 10−5 − 4.8 × 10−5
𝑓(𝑥) = 2.8168 Required answer.
EXAMPLE # 2: Apply Newton's divided difference formula to find the value of
𝑓(8), if 𝑓 1 = 3, 𝑓 3 = 31, 𝑓 6 = 223, 𝑓 10 = 1011, 𝑓(11) = 1343
Solution:
Try Yourself Ans = 521
13
EXAMPLE # 3: Given that
𝑥: 1 3 4 6 7
𝑦𝑥 : 1 27 81 729 2187
Find 𝑦5
SOLUTION: Try yourself Ans (208.8 ≈ 209)
EXAMPLE # 4: The following table is given:
𝑥: 0 1 2 5
𝑓(𝑥): 2 3 12 147
What is the form of the function?
SOLUTION:
𝑥 𝑥0 = 0 𝑥1 = 1 𝑥2 = 2 𝑥3 = 5
𝑓(𝑥) 𝑓 𝑥0 = 2 𝑓 𝑥1 = 3 𝑓 𝑥2 = 12 𝑓 𝑥3 = 147

Using Newton's divided interpolation formula


𝑓 𝑥 = 𝑓 𝑥0 + 𝑥 − 𝑥0 𝑥1 , 𝑥0 + 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥2 , 𝑥1 , 𝑥0
+ 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥3 , 𝑥2 , 𝑥1 , 𝑥0
14
Now
𝑓 𝑥1 − 𝑓 𝑥0 3−2
𝑓 𝑥1 , 𝑥0 = 𝑥1 , 𝑥0 = = =1
𝑥1 − 𝑥0 1−0

𝑓 𝑥2 − 𝑓 𝑥1 12 − 3
𝑥2 , 𝑥1 = = =9
𝑥2 − 𝑥1 2−1

𝑓 𝑥3 − 𝑓 𝑥2 147 − 12 135
𝑥3 , 𝑥2 = = = = 45
𝑥3 − 𝑥2 5−2 3

𝑥2 , 𝑥1 − 𝑥1 , 𝑥0 9−1 8
𝑓 𝑥2 , 𝑥1 , 𝑥0 = = = =4
𝑥2 − 𝑥0 2−0 2

𝑥3 , 𝑥2 − 𝑥2 , 𝑥1 45 − 9 36
𝑓 𝑥3 , 𝑥2 , 𝑥1 = 𝑥3 , 𝑥2 , 𝑥1 = = = =9
𝑥3 − 𝑥1 5−1 4

𝑥3 , 𝑥2 , 𝑥1 − 𝑥2 , 𝑥1 , 𝑥0 9−4 5
𝑓 𝑥3 , 𝑥2 , 𝑥1 , 𝑥0 = = = =1
𝑥3 − 𝑥0 5−0 5

15
𝑓(𝑥) = 𝑓 𝑥0 + 𝑥 − 𝑥0 𝑓 𝑥1 , 𝑥0 + 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑓 𝑥2 , 𝑥1 , 𝑥0

+ 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 𝑓 𝑥3 , 𝑥2 , 𝑥1 , 𝑥0

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

= 2 + 𝑥 + 4𝑥 𝑥 − 1 + 𝑥 𝑥 − 1 𝑥 − 2

= 2 + 𝑥 + 4𝑥 2 − 4𝑥 + 𝑥 𝑥 2 − 3𝑥 + 2

= 2 + 𝑥 + 4𝑥 2 − 4𝑥 + 𝑥 3 − 3𝑥 2 + 2𝑥
𝑓 𝑥 = 𝑥3 + 𝑥2 − 𝑥 + 2 ⟶ Required answer
EXAMPLE # 5: Find the polynomial which assumes the Values
1245, 33, 5, 9 and 1335 at 𝑥 = −4, −1, 0, 2 and 5 .
Ans ⟶ 3𝑥 4 − 5𝑥 3 + 6𝑥 2 − 14𝑥 + 5

16
EXERCISE

17
18
19
20

You might also like