100% found this document useful (1 vote)
119 views

Lecture 4 Numerical Differentiation

The document discusses numerical differentiation techniques. It introduces the concept of the derivative as the rate of change of a dependent variable with respect to an independent variable. It then presents three common approaches to approximating derivatives from discrete data points: forward differencing, backward differencing, and centered differencing. Examples are provided to demonstrate how to use each technique to estimate the derivative of a function at a given point. Finally, it discusses formulas for numerical differentiation based on Newton's forward and backward interpolation as well as Stirling's interpolation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
119 views

Lecture 4 Numerical Differentiation

The document discusses numerical differentiation techniques. It introduces the concept of the derivative as the rate of change of a dependent variable with respect to an independent variable. It then presents three common approaches to approximating derivatives from discrete data points: forward differencing, backward differencing, and centered differencing. Examples are provided to demonstrate how to use each technique to estimate the derivative of a function at a given point. Finally, it discusses formulas for numerical differentiation based on Newton's forward and backward interpolation as well as Stirling's interpolation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

LECTURE 4: NUMERICAL DIFFERENTIATION

𝐺𝑖𝑣𝑒𝑛 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛
Derivative

 rate of change of a dependent variable with respect to an independent variable


 for 𝑓(𝑥), the derivative starts at the difference approximation

 As Δ𝑥 → 0, the difference becomes a derivative


 Graphically,
First Derivative Approximations

 from Taylor Series Expansion

 where:
 ℎ = 𝑥𝑖+1 − 𝑥𝑖
 𝑅𝑛 = remainder term
First Derivative Approximations

 Forward Difference
 from Taylor series expansion

(1)


𝑓 𝑥𝑖+1 − 𝑓 𝑥𝑖 Δ𝑓𝑖
𝑓 𝑥 ≈ =
𝑥𝑖+1 − 𝑥𝑖 ℎ
 Where:
 Δ𝑓𝑖 = 𝑓𝑖𝑟𝑠𝑡 𝑓𝑜𝑟𝑤𝑎𝑟𝑑 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒

 ℎ = 𝑠𝑡𝑒𝑝 𝑠𝑖𝑧𝑒
First Derivative Approximations

 Example:
Estimate the first derivative of 𝑓 𝑥 = −0.1𝑥 4 − 0.15𝑥 3 − 0.5𝑥 2 − 0.25𝑥 + 1.2 at 𝑥 = 0.5 using a
step size ℎ = 0.5.
Solution:
𝑥𝑖 = 0.5 𝑓(𝑥𝑖 ) = 0.925

𝑥𝑖+1 = 0.5 + ℎ = 0.5 + 0.5 = 1 𝑓(𝑥𝑖+1 ) = 0.2

𝑓 𝑥𝑖+1 −𝑓 𝑥𝑖 0.2−0.925
𝑓′ 𝑥 ≈ = = −𝟏. 𝟒𝟓
ℎ 0.5
First Derivative Approximations

 Backward Difference
 from Taylor series expanded backward

(2)


𝑓 𝑥𝑖 − 𝑓 𝑥𝑖−1 𝛻𝑓𝑖
𝑓 𝑥 ≈ =
𝑥𝑖 − 𝑥𝑖−1 ℎ
 Where:
 𝛻𝑓𝑖 = 𝑓𝑖𝑟𝑠𝑡 𝑏𝑎𝑐𝑘𝑤𝑎𝑟𝑑 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒
 ℎ = 𝑠𝑡𝑒𝑝 𝑠𝑖𝑧𝑒
First Derivative Approximations

 Example:
Estimate the first derivative of 𝑓 𝑥 = −0.1𝑥 4 − 0.15𝑥 3 − 0.5𝑥 2 − 0.25𝑥 + 1.2 at 𝑥 = 0.5 using a
step size ℎ = 0.5.
Solution:
𝑥𝑖 = 0.5 𝑓(𝑥𝑖 ) = 0.925

𝑥𝑖−1 = 0.5 − ℎ = 0.5 − 0.5 = 0 𝑓(𝑥𝑖−1 ) = 1.2

𝑓 𝑥𝑖 − 𝑓 𝑥𝑖−1 0.925 − 1.2


𝑓′ 𝑥 ≈ = = −𝟎. 𝟓𝟓
ℎ 0.5
First Derivative Approximations

 Centered Difference
 Subtracting (2) from (1), we get


𝑓 𝑥𝑖+1 − 𝑓 𝑥𝑖−1
𝑓 𝑥 ≈
𝑥𝑖+1 − 𝑥𝑖−1
𝑓 𝑥𝑖+1 − 𝑓 𝑥𝑖−1
𝑓′ 𝑥 ≈
2ℎ
First Derivative Approximations

 Example:
Estimate the first derivative of 𝑓 𝑥 = −0.1𝑥 4 − 0.15𝑥 3 − 0.5𝑥 2 − 0.25𝑥 + 1.2 at 𝑥 = 0.5 using a
step size ℎ = 0.5.
Solution:
𝑥𝑖 = 0.5 𝑓(𝑥𝑖 ) = 0.925
𝑥𝑖−1 = 0.5 − ℎ = 0.5 − 0.5 = 0 𝑓(𝑥𝑖−1 ) = 1.2
𝑥𝑖+1 = 0.5 + ℎ = 0.5 + 0.5 = 1 𝑓(𝑥𝑖+1 ) = 0.2

𝑓 𝑥𝑖+1 − 𝑓 𝑥𝑖−1 0.2 − 1.2


𝑓′ 𝑥 ≈ = = −𝟏
2ℎ 2(0.5)
𝐺𝑖𝑣𝑒𝑛 𝑆𝑒𝑡 𝑜𝑓 𝑃𝑜𝑖𝑛𝑡𝑠
Formulae
 Derivatives based on Newton’s forward interpolation formula
 for finding the derivative for some given x lying near the beginning of the data
table

 Derivatives based on Newton’s backward interpolation formula


 suitable for a point near the end of the data table

 Derivatives based on Stirling’s interpolation formula


 for some point lying near the middle of the data table
Based on Newton’s Forward Interpolation Formula
 From

 We get

𝑑𝑢 1
where: 𝑢′ = 𝑑𝑥 = ℎ
Based on Newton’s Forward Interpolation Formula
 and from

 We get

 and so on..
Example

i xi yi Δyi Δ2yi Δ3yi Δ4yi Δ5yi


0 1 5.468 0.1985 0.0614 0.0074 0.0001 -0.0002
1 1.1 5.6665 0.2599 0.0688 0.0075 -0.0001
2 1.2 5.9264 0.3287 0.0763 0.0074
3 1.3 6.2551 0.405 0.0837
4 1.4 6.6601 0.4887
5 1.5 7.1488
i xi yi Δyi Δ2yi Δ3yi Δ4yi Δ5yi
0 1 5.468 0.1985 0.0614 0.0074 0.0001 -0.0002
1 1.1 5.6665 0.2599 0.0688 0.0075 -0.0001
2 1.2 5.9264 0.3287 0.0763 0.0074
3 1.3 6.2551 0.405 0.0837
4 1.4 6.6601 0.4887
5 1.5 7.1488
Based on Newton’s Backward Interpolation Formula
 From

 We get

 and so on..
Example
Based on Stirling’s Interpolation Formula
 From

 We get

 and so on..
Example

i xi yi Δyi Δ2yi Δ3yi Δ4yi Δ5yi


-2 0 0 0.10017 0.001 0.00101 4E-05 1.25E-16
-1 0.1 0.10017 0.10117 0.00201 0.00105 4E-05
0 0.2 0.20134 0.10318 0.00306 0.00109
1 0.3 0.30452 0.10624 0.00415
2 0.4 0.41076 0.11039
3 0.5 0.52115
i xi yi Δyi Δ2yi Δ3yi Δ4yi Δ5yi
-2 0 0 0.10017 0.001 0.00101 4E-05 1.25E-16
-1 0.1 0.10017 0.10117 0.00201 0.00105 4E-05
0 0.2 0.20134 0.10318 0.00306 0.00109
1 0.3 0.30452 0.10624 0.00415
2 0.4 0.41076 0.11039
3 0.5 0.52115

You might also like