Interpolation
NewtoN’s DiffereNce
Interpolation
Formula
Dr. Hina Dutt
[email protected]
SEECS-NUST
Newton’s
Difference
Interpolation
Formula
Newton’s Newton’s
Forward backward
Difference Difference
Interpolation Interpolation
Formula Formula
Newton’s Forward Newton’s backward
Difference Interpolation Difference Interpolation
Formula Formula
• This formula is applicable • This formula is applicable
to equally spaced Data. to equally spaced Data.
• This formula is used for • This formula is used for
interpolating values of 𝒚 interpolating values of 𝒚
near the beginning of a set near the end of a set of
of tabulated values and for tabulated values and for
extrapolating values of 𝒚 a extrapolating values of 𝒚 a
short distance backward short distance forward
from 𝒚𝟎 . from 𝒚𝒏 .
Newton’s Forward
Difference
Interpolation
Formula
Derivation of the Formula
Let 𝑦 = 𝑓(𝑥) be a function which takes values
𝑓 𝑥0 , 𝑓 𝑥0 + ℎ , 𝑓 𝑥0 + 2ℎ , …
corresponding to various equi spaced values of 𝑥 with spacing ℎ,
𝑥0 , 𝑥0 + ℎ, 𝑥0 + 2ℎ, … .
Suppose we wish to evaluate the function 𝑓 𝑥 for a value
𝑥 = 𝑥0 + 𝑠ℎ,
where 𝑠 is any real number.
Derivation of the Formula
Now, Newton’s Divided Difference interpolation formula is
𝑓 𝑥 ≈ 𝑃𝑛 𝑥
= 𝑦0 + 𝑦 𝑥0 , 𝑥1 𝑥 − 𝑥0 + 𝑦 𝑥0 , 𝑥1 , 𝑥2 𝑥 − 𝑥0 𝑥 − 𝑥1 …
+ 𝑦 𝑥0 , 𝑥1 , … , 𝑥𝑛 𝑥 − 𝑥0 𝑥 − 𝑥1 … 𝑥 − 𝑥𝑛−1
Derivation of the Formula
Using 𝑥 = 𝑥0 + 𝑠ℎ and
1 𝑛
𝑦 𝑥0 , 𝑥1 , … , 𝑥𝑛 = 𝑛
∆ 𝑦0
𝑛! ℎ
in above formula, we get
𝑓 𝑥 = 𝑃𝑛 𝑥
𝑠 𝑠−1 2
= 𝑦0 + 𝑠∆𝑦0 + ∆ 𝑦0 + ⋯
2!
𝑠 𝑠−1 … 𝑠− 𝑛−1
+ ∆𝑛 𝑦0
𝑛!
Newton’s Forward Difference
Interpolation Formula
Thus, Newton’s Forward Difference Interpolation Formula is
𝒇 𝒙 ≈ 𝑷𝒏 𝒙
𝒔 𝒔−𝟏 𝟐
= 𝒚𝟎 + 𝒔∆𝒚𝟎 + ∆ 𝒚𝟎 + ⋯
𝟐!
𝒔 𝒔−𝟏 … 𝒔− 𝒏−𝟏
+ ∆𝒏 𝒚𝟎
𝒏!
Newton’s Backward
Difference
Interpolation
Formula
Derivation of the Formula
If we reorder the interpolating nodes(points) as 𝑥𝑛 , 𝑥𝑛−1 , … , 𝑥0
then, Newton’s Divided Difference interpolation formula is
𝑓 𝑥
= 𝑦𝑛 + 𝑦 𝑥𝑛 , 𝑥𝑛−1 𝑥 − 𝑥𝑛
+ 𝑦 𝑥𝑛 , 𝑥𝑛−1 , 𝑥𝑛−2 𝑥 − 𝑥𝑛 𝑥 − 𝑥𝑛−1 …
+ 𝑦 𝑥𝑛 , 𝑥𝑛−1 , … , 𝑥0 𝑥 − 𝑥𝑛 𝑥 − 𝑥𝑛−1 … 𝑥 − 𝑥1
Derivation of the Formula
Let 𝑦 = 𝑓(𝑥) be a function which takes values
𝑓 𝑥𝑛 , 𝑓 𝑥𝑛 − ℎ , 𝑓 𝑥𝑛 − 2ℎ , …
corresponding to various equispaced values of 𝑥 with
spacing ℎ, 𝑥𝑛 , 𝑥𝑛 − ℎ, 𝑥𝑛 − 2ℎ, … .
Suppose we wish to evaluate the function 𝑓 𝑥 for a value
𝑥 = 𝑥𝑛 + 𝑠ℎ, where 𝑠 is any real number.
Derivation of the Formula
Using 𝑥 = 𝑥𝑛 + 𝑠ℎ , 𝑥 = 𝑥𝑖 + (𝑠 + (𝑛 − 𝑖))ℎ and
1
𝑦 𝑥𝑛 , 𝑥𝑛−1 , … , 𝑥0 = 𝑛 𝛻 𝑛 𝑦𝑛 in above formula, we get
𝑛!ℎ
𝑓 𝑥
𝑠 𝑠+1 2
= 𝑦𝑛 + 𝑠𝛻𝑦𝑛 + 𝛻 𝑦𝑛 + ⋯
2!
𝑠 𝑠+1 … 𝑠+ 𝑛−1
+ 𝛻 𝑛 𝑦𝑛
𝑛!
Newton’s Backward Difference
Interpolation Formula
Thus, Newton’s Backward Difference Interpolation
Formula is
𝒇 𝒙 ≈ 𝑷𝒏 𝒙
𝒔 𝒔+𝟏 𝟐
= 𝒚𝒏 + 𝒔𝜵𝒚𝒏 + 𝜵 𝒚𝒏 + ⋯
𝟐!
𝒔 𝒔+𝟏 … 𝒔+ 𝒏−𝟏
+ 𝜵 𝒏 𝒚𝒏
𝒏!
Example
𝑥 0.1 0.3 0.5 0.7 0.9 1.1 1.3
𝑦 0.003 0.067 0.148 0.248 0.370 0.518 0.698
a) Interpolate value of 𝑦 for 𝑥 = 0.213.
b) Construct third degree interpolation polynomial using Newton’s
Forward Difference Formula.
c) Interpolate value of 𝑦 for 𝑥 = 1.2.
d) Construct third degree Newton’s Backward Interpolation polynomial.
e) Extrapolate value of 𝑦 for 𝑥 = 1.33.
Example
Forward Difference Table:
𝒏 𝑥 𝑦 ∆𝒚 ∆𝟐 𝒚 ∆𝟑 𝒚 ∆𝟒 𝒚 ∆𝟓 𝒚 ∆𝟔 𝒚
0 0.1 0.003 0.064 0.017 0.002 0.001 0.000 0.001
1 0.3 0.067 0.081 0.019 0.003 0.001 0.001
2 0.5 0.148 0.1 0.022 0.004 0.002
3 0.7 0.248 0.122 0.026 0.006
4 0.9 0.370 0.148 0.032
5 1.1 0.518 0.18
6 1.3 0.698
Example
Solution (a):
𝑥 − 𝑥0 0.213 − 0.1
𝑥 = 𝑥0 + 𝑠ℎ ⇒ 𝑠 = = = 0.565
ℎ 0.2
𝒏 𝑥 𝑦 ∆𝒚 ∆𝟐 𝒚 ∆𝟑 𝒚 ∆𝟒 𝒚 ∆𝟓 𝒚 ∆𝟔 𝒚
0 0.1=𝒙𝟎 0.003= 0.064= 0.017= 0.002= 0.001= 0.000= 0.001=
𝒚𝟎 ∆𝒚𝟎 ∆𝟐 𝒚𝟎 ∆𝟑 𝒚𝟎 ∆𝟒 𝒚𝟎 ∆ 𝟓 𝒚𝟎 ∆ 𝟔 𝒚𝟎
1 0.3 0.067 0.081 0.019 0.003 0.001 0.001
2 0.5 0.148 0.1 0.022 0.004 0.002
3 0.7 0.248 0.122 0.026 0.006
4 0.9 0.370 0.148 0.032
5 1.1 0.518 0.18
6 1.3 0.698
Example
𝑓 𝑥
𝑠 𝑠−1 2 𝑠 𝑠 − 1 (𝑠 − 2) 3 𝑠 𝑠−1 𝑠−2 𝑠−3 4
= 𝑦0 + 𝑠∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0 + ∆ 𝑦0
2! 3! 4!
𝑠 𝑠 − 1 𝑠 − 2 𝑠 − 3 (𝑠 − 4) 5 𝑠 𝑠 − 1 𝑠 − 2 𝑠 − 3 (𝑠 − 4)(𝑠 − 5) 6
+ ∆ 𝑦0 + ∆ 𝑦0
5! 6!
𝑓 0.2
0.565 0.565 − 1
= 0.003 + 0.565 0.064 + 0.017
2!
0.565 0.565 − 1 0.565 − 2
+ (0.002)
3!
0.565 0.565 − 1 0.565 − 2 0.565 − 3
+ (0.001) Simplify
4!
0.565 0.565 − 1 0.565 − 2 0.565 − 3 0.565 − 4 and get
+ (0) the
5!
0.565 0.565 − 1 0.565 − 2 0.565 − 3 0.565 − 4 0.565 − 5
+ (0.001) answer
6!
Example
Solution (b):
Third Degree polynomial is
𝑠 𝑠−1 2 𝑠 𝑠 − 1 (𝑠 − 2) 3
𝑃3 𝑥 = 𝑦0 + 𝑠∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0
2! 3!
𝑥−𝑥0 𝑥−0.1
Putting 𝑠 = = , we get
ℎ 0.2
𝑃3 𝑥
𝑥 − 0.1 𝑥 − 0.1
𝑥 − 0.1 −1
0.2 0.2
= 0.003 + 0.064 + 0.017
0.2 2!
𝑥 − 0.1 𝑥 − 0.1 𝑥 − 0.1
−1 −2
0.2 0.2 0.2
+ 0.002
3!
After simplification we get
𝑃3 𝑥 = 0.0146𝑥 3 + 0.175𝑥 2 + 0.2445𝑥 − 0.0232 Verify it
Example
Solution (c):
𝑥 − 𝑥𝑛 1.2 − 1.3
𝑥 = 𝑥𝑛 + 𝑠ℎ ⇒ 𝑠 = = = −0.5
ℎ 0.2
𝒏 𝑥 𝑦 𝛁𝒚 𝛁𝟐𝒚 𝛁𝟑𝒚 𝛁𝟒𝒚 𝛁𝟓𝒚 𝛁𝟔𝒚
0 0.1 0.003
1 0.3 0.067 0.064
2 0.5 0.148 0.081 0.017
3 0.7 0.248 0.1 0.019 0.002
4 0.9 0.370 0.122 0.022 0.003 0.001
5 1.1 0.518 0.148 0.026 0.004 0.001 0.000
6 1.3=𝑥6 0.698= 0.18= 0.032= 0.006= 0.002= 0.001= 0.001=
𝑦6 𝛻𝑦6 𝛻 2 𝑦6 𝛻 3 𝑦6 𝛻 4 𝑦6 𝛻 5 𝑦6 𝛻 6 𝑦6
Example
𝑓 𝑥
𝑠 𝑠+1 2 𝑠 𝑠 + 1 (𝑠 + 2) 3 𝑠 𝑠+1 𝑠+2 𝑠+3 4
= 𝑦6 + 𝑠𝛻𝑦6 + 𝛻 𝑦6 + 𝛻 𝑦6 + 𝛻 𝑦6
2! 3! 4!
𝑠 𝑠 + 1 𝑠 + 2 𝑠 + 3 (𝑠 + 4) 5 𝑠 𝑠 + 1 𝑠 + 2 𝑠 + 3 (𝑠 + 4)(𝑠 + 5) 6
+ 𝛻 𝑦6 + 𝛻 𝑦6
5! 6!
𝑓 1.2
−0.5 −0.5 + 1 −0.5 −0.5 + 1 −0.5 + 2
= 0.698 − 0.5 0.18 + 0.032 + (0.006)
2! 3!
−0.5 −0.5 + 1 −0.5 + 2 −0.5 + 3
+ (0.002)
4! Simplify
−0.5 −0.5 + 1 −0.5 + 2 −0.5 + 3 −0.5 + 4
+ (0.001) and get
5! the
−0.5 −0.5 + 1 −0.5 + 2 −0.5 + 3 −0.5 + 4 −0.5 + 5
+ (0.001) answer
6!
Example
Solution (d):
𝑠 𝑠+1 2 𝑠 𝑠 + 1 (𝑠 + 2) 3
𝑓 𝑥 = 𝑃3 𝑥 = 𝑦6 + 𝑠𝛻𝑦6 + 𝛻 𝑦6 + 𝛻 𝑦6
2! 3!
𝑥 − 𝑥𝑛 𝑥 − 1.3
𝑠= =
ℎ 0.2
So
𝑃3 𝑥
𝑥 − 1.3 𝑥 − 1.3
𝑥 − 1.3 0.2 0.2 + 1
= 0.698 + 0.18 + 0.032
0.2 2!
𝑥 − 1.3 𝑥 − 1.3 𝑥 − 1.3
0.2 0.2 + 1 0.2 + 2
+ 0.006
3!
Simplify and get the answer.
Example
Solution (e):
𝑥 − 𝑥𝑛 1.33 − 1.3
𝑥 = 𝑥𝑛 + 𝑠ℎ ⇒ 𝑠 = = = 0.15
ℎ 0.2
𝒏 𝑥 𝑦 𝛁𝒚 𝛁𝟐𝒚 𝛁𝟑𝒚 𝛁𝟒𝒚 𝛁𝟓𝒚 𝛁𝟔𝒚
0 0.1 0.003
1 0.3 0.067 0.064
2 0.5 0.148 0.081 0.017
3 0.7 0.248 0.1 0.019 0.002
4 0.9 0.370 0.122 0.022 0.003 0.001
5 1.1 0.518 0.148 0.026 0.004 0.001 0.000
6 1.3=𝑥6 0.698= 0.18= 0.032= 0.006= 0.002= 0.001= 0.001=
𝑦6 𝛻𝑦6 𝛻 2 𝑦6 𝛻 3 𝑦6 𝛻 4 𝑦6 𝛻 5 𝑦6 𝛻 6 𝑦6
Example
𝑓 𝑥
𝑠 𝑠+1 2 𝑠 𝑠 + 1 (𝑠 + 2) 3 𝑠 𝑠+1 𝑠+2 𝑠+3 4
= 𝑦6 + 𝑠𝛻𝑦6 + 𝛻 𝑦6 + 𝛻 𝑦6 + 𝛻 𝑦6
2! 3! 4!
𝑠 𝑠 + 1 𝑠 + 2 𝑠 + 3 (𝑠 + 4) 5 𝑠 𝑠 + 1 𝑠 + 2 𝑠 + 3 (𝑠 + 4)(𝑠 + 5) 6
+ 𝛻 𝑦6 + 𝛻 𝑦6
5! 6!
𝑓 1.33
0.15 0.15 + 1 0.15 0.15 + 1 0.15 + 2
= 0.698 + 0.15 0.18 + 0.032 + (0.006)
2! 3!
0.15 0.15 + 1 0.15 + 2 0.15 + 3
+ (0.002)
4! Simplify
0.15 0.15 + 1 0.15 + 2 0.15 + 3 0.15 + 4 and get
+ (0.001)
5! the
0.15 0.15 + 1 0.15 + 2 0.15 + 3 0.15 + 4 0.15 + 5
+ (0.001) answer
6!