You are on page 1of 18

Numerical

Methods
Lecture-13
[MA-200]
ARISHA ALI
Difference Operators

ARISHA ALI 2
Let 𝑦 = 𝑓(𝑥) be a given function and ℎ is any fixed value. Let
𝑥 = 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑛
such that
𝑥1 = 𝑥0 + ℎ, 𝑥2 = 𝑥0 + 2ℎ, 𝑥3 = 𝑥0 + 3ℎ, … , 𝑥𝑛 = 𝑥0 + 𝑛ℎ
Also,
𝑦0 = 𝑓 𝑥0 , 𝑦1 = 𝑓 𝑥1 , 𝑦2 = 𝑓 𝑥2 , … , 𝑦𝑛 = 𝑓 𝑥𝑛
Note:
ℎ = 𝑙𝑒𝑛𝑔𝑡ℎ 𝑜𝑓 𝑡ℎ𝑒 𝑖𝑛𝑡𝑒𝑟𝑣𝑎𝑙
ARISHA ALI 3
Shift Operator
Symbol of shift operator is 𝐸 and it is defined as 𝐸𝑓 𝑥 = 𝑓(𝑥 + ℎ)
𝐸𝑦0 = 𝐸𝑓 𝑥0 = 𝑓 𝑥0 + ℎ = 𝑓 𝑥1 = 𝑦1
𝐸𝑦0 = 𝑦1
Similarly
𝐸𝑦1 = 𝑦2

𝐸 2 𝑓 𝑥 = 𝐸 𝐸𝑓 𝑥 = 𝐸𝑓 𝑥 + ℎ = 𝑓 𝑥 + 2ℎ

𝐸 −1 𝑓 𝑥 = 𝑓(𝑥 − ℎ)
𝐸 −2 𝑓 𝑥 = 𝑓(𝑥 − 2ℎ)

ARISHA ALI 4
Interpolation and Extrapolation
The process of computing an approximate value of function at some points within
the given range but not in the table of data, is called interpolation. If 𝑥 lies
outside the range, then process is called extrapolation.
x y
𝒙𝟏 𝒚𝟏
𝒙𝟐 𝒚𝟐 𝒙 = 𝒙𝒊 ⟹ 𝒚(𝒙𝒊 )
𝒙𝟑 𝒚𝟑 𝒙𝒊 ∈ (𝒙𝟏 , 𝒙𝒏 )
𝒙𝟒 𝒚𝟒
⋮ ⋮
𝒙𝒏 𝒚𝒏

ARISHA ALI 5
Methods

▪Newton’s Gregory Forward Difference Interpolation


▪Newton Gregory Backward Difference Interpolation
▪Lagrange Interpolation
▪Newton Divided Difference Interpolation

ARISHA ALI 6
Methods

▪Newton’s Gregory Forward Difference Interpolation


Equally spaced
▪Newton Gregory Backward Difference Interpolation data points
▪Lagrange Interpolation
▪Newton Divided Difference Interpolation

ARISHA ALI 7
Methods

▪Newton’s Gregory Forward Difference Interpolation


▪Newton Gregory Backward Difference Interpolation
▪Lagrange Interpolation Unequally
▪Newton Divided Difference Interpolation spaced data
points

ARISHA ALI 8
Forward Difference Operator
Symbol of forward difference operator is ∆ (𝑑𝑒𝑙) and it is defined as
∆𝑓 𝑥 = 𝑓 𝑥 + ℎ − 𝑓 𝑥
∆𝑦0 = 𝑦1 − 𝑦0
∆𝑦1 = 𝑦2 − 𝑦1
∆𝑦2 = 𝑦3 − 𝑦2

ARISHA ALI 9
Cont…

∆2 𝑓 𝑥 = ∆ ∆𝑓 𝑥 =∆ 𝑓 𝑥+ℎ −𝑓 𝑥

= 𝑓 𝑥 + 2ℎ − 𝑓 𝑥 + ℎ − 𝑓 𝑥 + ℎ − 𝑓 𝑥
∆2 𝑓 𝑥 = 𝑓 𝑥 + 2ℎ − 2𝑓 𝑥 + ℎ + 𝑓(𝑥)
∆2 𝑦0 = ∆ ∆𝑦0 = ∆ 𝑦1 − 𝑦0 = ∆𝑦1 − ∆𝑦0 = 𝑦2 − 𝑦1 − (𝑦1 − 𝑦0 )
∆2 𝑦0 = 𝑦2 − 2𝑦1 + 𝑦0

ARISHA ALI 10
Newton Gregory's forward difference
Interpolation

𝑃(𝑃−1) 2 𝑃(𝑃−1)(𝑃−2) 3
𝑦 = 𝑓 𝑥 = 𝑦0 + 𝑃∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0 +
2! 3!
𝑃(𝑃−1)(𝑃−2)(𝑃−3) 4
∆ 𝑦0 +…
4!
𝑥−𝑥0
Where 𝑃 = 𝑖. 𝑒. , 𝑥 = 𝑥0 𝑃ℎ

ℎ = 𝑥1 − 𝑥0 = 𝑥2 − 𝑥1 = ⋯ = 𝑥𝑛 − 𝑥𝑛−1

ARISHA ALI 11
Forward Difference Table
𝒙𝒊 𝒚𝒊 ∆𝒚𝒊 ∆𝟐 𝒚𝒊 ∆𝟑 𝒚𝒊 ∆𝟒 𝒚𝒊

𝒙𝟎 𝒚𝟎 ∆𝒚𝟎 = 𝒚𝟏 − 𝒚𝟎

𝒙𝟏 𝒚𝟏 ∆𝒚𝟏 = 𝒚𝟐 − 𝒚𝟏 ∆𝟐 𝒚𝟎 = ∆𝒚𝟏 − ∆𝒚𝟎 ∆𝟑 𝒚𝟎

𝒙𝟐 𝒚𝟐 ∆𝟐 𝒚𝟏 = ∆𝒚𝟐 − ∆𝒚𝟏 ∆𝟒 𝒚𝟎

𝒙𝟑 𝒚𝟑 ∆𝒚𝟐 = 𝒚𝟑 − 𝒚𝟐 ∆𝟐 𝒚𝟐 = ∆𝒚𝟑 − ∆𝒚𝟐 ∆𝟑 𝒚𝟏

𝒙𝟒 𝒚𝟒 ∆𝒚𝟑 = 𝒚𝟒 − 𝒚𝟑

ARISHA ALI 12
Example
Find the cubic polynomial which takes following values
𝒙 0 1 2 3
𝒇(𝒙) 1 2 1 10

Also find 𝑓(4) 𝑎𝑛𝑑 𝑓 ′ (4)


Solution:
The forward difference table for the given data points

ARISHA ALI 13
Cont…
𝒙 𝒚 = 𝒇(𝒙𝟎 ) ∆𝒚 ∆𝟐 𝒚 ∆𝟑 𝒚
0 1 𝟐−𝟏=𝟏

1 2 𝟏 − 𝟐 = −𝟏 −𝟏 − 𝟏 = −𝟐

2 1 𝟏𝟎 − 𝟏 = 𝟗 𝟗 + 𝟏 = 𝟏𝟎 𝟏𝟎 + 𝟐 = 𝟏𝟐

3 10

ARISHA ALI 14
Cont…
ℎ=1
𝑥−𝑥0 𝑥−0
𝑃= = =𝑥⟹𝑃=𝑥
ℎ 1

𝑃(𝑃−1) 2 𝑃(𝑃−1)(𝑃−2) 3
𝑓 𝑥 = 𝑦0 + 𝑃∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0
2! 3!

𝑥(𝑥−1)(−2) 𝑥(𝑥−1)(𝑥−2)(12)
𝑓 𝑥 =1+𝑥 1 + +
2! 3!

𝑓(𝑥) = 2𝑥 3 − 7𝑥 2 + 6𝑥 + 1
𝑓 4 = 41
𝑓 ′ 4 = 46

ARISHA ALI 15
Example
Interpolation 𝑓(2.1) with the given data
𝒙
0
𝒙 𝟎 𝟏1 𝟐 𝟑
2
𝒚 𝟔 𝟐𝟒3 𝟔𝟎 𝟏𝟐𝟎
Solution:
The forward difference table for the given data points
𝒇(𝒙)
1
2
1
10

ARISHA ALI 16
Cont…
𝒙 𝒚 = 𝒇(𝒙𝟎 ) ∆𝒚 ∆𝟐 𝒚 ∆𝟑 𝒚
0 6 𝟐𝟒 − 𝟔 = 𝟏𝟖

1 24 𝟔𝟎 − 𝟐𝟒 = 𝟑𝟔 𝟑𝟔 − 𝟏𝟖 = 𝟏𝟖

2 60 𝟏𝟐𝟎 − 𝟔𝟎 = 𝟔𝟎 𝟔𝟎 − 𝟑𝟔 = 𝟐𝟒 𝟐𝟒 − 𝟏𝟖 = 𝟔

3 120

ARISHA ALI 17
Cont…
ℎ=1
𝑥−𝑥0 2.1−1
𝑃= = = 1.1 ⟹ 𝑃 = 1.1
ℎ 1
𝑃(𝑃−1) 2 𝑃(𝑃−1)(𝑃−2) 3
𝑓 𝑥 = 𝑦0 + 𝑃∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0
2! 3!
1.1(1.1−1) 1.1(1.1−1)(1.1−2)
𝑓 2.1 = 6 + 1.1 18 + 18 + 6
2! 3!

𝑓 2.1 = 16 + 19.0 + 0.99 − 0.099


𝑓 2.1 = 26.691

ARISHA ALI 18

You might also like