0% found this document useful (0 votes)
491 views59 pages

PowerPoint Presentation

This document covers numerical differentiation methods, specifically the finite difference method, including forward, backward, and central methods. It outlines intended learning outcomes, provides formulas for calculating derivatives, and includes examples for applying these methods in civil engineering problems. The document emphasizes accuracy in calculations and presents detailed tables for coefficients used in the differentiation formulas.

Uploaded by

Natsu Igneel
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
0% found this document useful (0 votes)
491 views59 pages

PowerPoint Presentation

This document covers numerical differentiation methods, specifically the finite difference method, including forward, backward, and central methods. It outlines intended learning outcomes, provides formulas for calculating derivatives, and includes examples for applying these methods in civil engineering problems. The document emphasizes accuracy in calculations and presents detailed tables for coefficients used in the differentiation formulas.

Uploaded by

Natsu Igneel
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/ 59

CE007: NUMERICAL SOLUTION

Module: ON CE PROBLEMS

7.0
NUMERICAL
DIFFERENTIATION
PREPARED BY: FRANKLYN F. MANGGAPIS
MODULE 7: Numerical Differentiation
Textbook References:

Numerical Methods for Engineers 7th


Edition by Steven C. Chapra and Raymond
P. Canale
MODULE 7: Numerical Differentiation
Intended Learning Outcomes (ILO’s):
At the end of this presentation, the student should be able to:

01
01
Polynomial 04
Perform Numerical Differentiation using Finite Difference
Interpolation
Method

Perform Numerical Differentiation using more accurate


0202 05
central finite difference method

Apply methods of numerical differentiation in civil


03
03 engineering problems 06
MODULE 7: Numerical Differentiation

NUMERICAL DIFFERENTIATION
USING FINITE DIFFERENCE
METHOD
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

The numerical value of the derivative of the function can be obtained by


the finite difference method. This can be done using forward, backward, or
central methods. For simplicity, the formulas for approximating the first and
second derivative of the function is provided without providing a proof.
Forward Finite Difference Formulas (2nd Order Accuracy)
−𝑓 𝑥𝑜 + 2ℎ + 4𝑓 𝑥𝑜 + ℎ − 3𝑓(𝑥𝑜 )
𝑓′ 𝑥𝑜 =
2ℎ

−𝑓 𝑥𝑜 + 3ℎ + 4𝑓 𝑥𝑜 + 2ℎ − 5𝑓 𝑥𝑜 + ℎ + 2𝑓 𝑥𝑜
𝑓 ′ 𝑥𝑜 =
ℎ2
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Backward Finite Difference Formulas (2nd Order Accuracy)



3𝑓 𝑥𝑜 − 4𝑓 𝑥𝑜 − ℎ + 𝑓 𝑥𝑜 − 2ℎ
𝑓 𝑥𝑜 =
2ℎ

2𝑓 𝑥𝑜 − 5𝑓 𝑥𝑜 − ℎ + 4𝑓 𝑥𝑜 − 2ℎ − 𝑓 𝑥𝑜 − 3ℎ
𝑓 ′ 𝑥𝑜 =
ℎ2
Central Finite Difference Method (4th Order Accuracy)
−𝑓 𝑥𝑜 + 2ℎ + 8𝑓 𝑥𝑜 + ℎ − 8𝑓 𝑥𝑜 − ℎ + 𝑓(𝑥𝑜 − 2ℎ)
𝑓′ 𝑥𝑜 =
12ℎ

−𝑓 𝑥𝑜 + 2ℎ + 16𝑓 𝑥𝑜 + ℎ − 30𝑓 𝑥𝑜 + 16𝑓 𝑥𝑜 − ℎ − 𝑓(𝑥𝑜 − 2ℎ)
𝑓 ′ 𝑥𝑜 =
12ℎ2
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Likewise, a tabular presentation for the coefficients of 𝑓 𝑥𝑜 ± 𝑛ℎ is shown to


determine the first to fourth derivative of a function.
Forward Finite Difference Formulas (2nd Order Accuracy)
Derivative 𝒇 𝒙𝒐 𝒇 𝒙𝒐 + 𝒉 𝒇 𝒙𝒐 + 𝟐𝒉 𝒇 𝒙𝒐 + 𝟑𝒉 𝒇 𝒙𝒐 + 𝟒𝒉 𝒇 𝒙𝒐 + 𝟓𝒉

1st -3/2 2 -1/2


2nd 2 -5 4 -1
3rd -5/2 9 -12 7 -3/2
4th 3 -14 26 -24 11 -2
Table 1. The forward finite difference formulas for 2nd order accuracy
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Backward Finite Difference Formulas (2nd Order Accuracy)

Derivative 𝒇 𝒙𝒐 − 𝟓𝒉 𝒇 𝒙𝒐 − 𝟒𝒉 𝒇 𝒙𝒐 − 𝟑𝒉 𝒇 𝒙𝒐 − 𝟐𝒉 𝒇 𝒙𝒐 − 𝒉 𝒇 𝒙𝒐

1st 1/2 -2 3/2


2nd -1 4 -5 2
3rd 3/2 -7 12 -9 5/2
4th -2 11 -24 26 -14 3
Table 2. The backward finite difference formulas for 2nd order accuracy
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Central Finite Difference Formulas (4th Order Accuracy)

Derivative 𝒇 𝒙𝒐 − 𝟑𝒉 𝒇 𝒙𝒐 − 𝟐𝒉 𝒇 𝒙𝒐 − 𝒉 𝒇 𝒙𝒐 𝒇 𝒙𝒐 + 𝒉 𝒇 𝒙𝒐 + 𝟐𝒉 𝒇 𝒙𝒐 + 𝟑𝒉

1st 1/12 -2/3 0 2/3 -1/12


2nd -1/12 4/3 -5/2 4/3 -1/12
3rd 1/8 -1 13/8 0 -13/8 1 -1/8
4th -1/6 2 -13/2 28/3 -13/2 2 -1/6
Table 3. The central difference formulas for 4th order accuracy
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Example 1
Determine the value of the first and second derivatives of the function shown below at
x =3: 1
− 𝑥
𝑓 𝑥 = 5 cos 3𝑥 − 𝑒 2
a. Use the analytical method
b. Use the forward finite difference method
c. Use the backward finite difference method
d. Use the central finite difference method

For the finite difference methods, use h = 0.20


HINT: For the purpose of accuracy, the initial and final answer must be expressed in six decimal
places.
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Solution
a. Analytical Solution
For this method, obtain the first and second derivative of the function using the rules of
differentiation:

First derivative:

1
− 𝑥 1 1 −1 𝑥
𝑓 (𝑥) = 5 − sin 3𝑥 3 − 𝑒 2 − = −15 sin 3𝑥 + 𝑒 2
2 2
1 −
1
3
𝑓 ′ (3) = −15 sin 3)(3 + 𝑒 2 = −𝟔. 𝟎𝟕𝟎𝟐𝟏𝟐
2
Take note: Your calculator should be in radian mode!
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Solution
a. Analytical Solution
For this method, obtain the first and second derivative of the function using the rules of
differentiation:

Second derivative:
1 −1 𝑥 1 1 −1 𝑥
𝑓′′ 𝑥 = −15 − cos 3𝑥 3 − 𝑒 2 − = −45 cos 3𝑥 + 𝑒 2
2 2 4
1 1
𝑓 ′′ 3 = −45 cos 3)(3 + 𝑒 2 3 = 𝟒𝟎. 𝟗𝟒𝟓𝟎𝟕𝟗

4
Take note: Your calculator should be in radian mode!
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Solution
b. Forward Finite Difference Method
recall that we have this table for forward finite difference method:

Derivative 𝒇 𝒙𝒐 𝒇 𝒙𝒐 + 𝒉 𝒇 𝒙𝒐 + 𝟐𝒉 𝒇 𝒙𝒐 + 𝟑𝒉 𝒇 𝒙𝒐 + 𝟒𝒉 𝒇 𝒙𝒐 + 𝟓𝒉

1st -3/2 2 -1/2


2nd 2 -5 4 -1
3rd -5/2 9 -12 7 -3/2
4th 3 -14 26 -24 11 -2
Table 1. The forward difference formulas for 2nd order accuracy
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Solution
b. Forward Finite Difference Method
Solve for the value for 𝑓 𝑥𝑜 to 𝑓 𝑥𝑜 + 3ℎ at 𝑥𝑜 = 3 and ℎ = 0.2
1
𝑓 𝑥𝑜 = 5 cos 3𝑥 − 𝑒 −2 𝑥
Note: Use your calculator in radian mode!
1
− 3
𝑓 𝑥0 = 𝑓 3 = 5 cos 3)(3 − 𝑒 2 = −4.778781
1
− 3.2
𝑓 𝑥𝑜 + ℎ = 𝑓 3 + 0.2 = 𝑓(3.2) = 5 cos 3)(3.2 − 𝑒 2 = −5.125336
1
− 3.4
𝑓 𝑥𝑜 + 2ℎ = 𝑓 3 + 2(0.2) = 𝑓(3.4) = 5 cos 3)(3.4 − 𝑒 2 = −3.754012
1
−2 3.4
𝑓 𝑥𝑜 + 3ℎ = 𝑓 3 + 3(0.2) = 𝑓(3.6) = 5 cos 3)(3.4 − 𝑒 = −1.136948

Use the table #1 for the coefficients to solve for the first and second derivatives of the function
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method
𝑓 𝑥𝑜 = −4.778781
Solution 𝑓 𝑥𝑜 + ℎ = −5.125336
b. Forward Finite Difference Method 𝑓 𝑥𝑜 + 2ℎ = −3.754012
𝑓 𝑥𝑜 + 3ℎ = −1.136948
First derivative:
1 3 1
𝑓 ′ (𝑥𝑜 ) = − 𝑓 𝑥𝑜 + 2𝑓 𝑥𝑜 + ℎ − 𝑓 𝑥𝑜 + 2ℎ
ℎ 2 2
1 3 1
𝑓 ′ (3) = − (−4.778781) + 2(−5.125336) − −3.754012
0.2 2 2

𝑓 ′ 3 = −𝟔. 𝟎𝟐𝟕𝟒𝟕𝟑

Use the table #1 for the coefficients to solve for the first and second derivatives of the function
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method
𝑓 𝑥𝑜 = −4.778781
Solution 𝑓 𝑥𝑜 + ℎ = −5.125336
b. Forward Finite Difference Method 𝑓 𝑥𝑜 + 2ℎ = −3.754012
𝑓 𝑥𝑜 + 3ℎ = −1.136948
Second derivative:
′′
1
𝑓 𝑥𝑜 = 2 2 𝑓 𝑥𝑜 − 5𝑓 𝑥𝑜 + ℎ + 4𝑓 𝑥𝑜 + 2ℎ − 𝑓 𝑥𝑜 + 3ℎ

1
𝑓 ′′ 3 = 2 −4.778781 − 5 −5.125336 + 4 −3.754012 − (−1.136948)]
0.22

𝑓 ′′ 3 = 𝟓𝟒. 𝟕𝟓𝟎𝟒𝟓𝟎

Use the table #1 for the coefficients to solve for the first and second derivatives of the function
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Solution
c. Backward Finite Difference Method
recall that we have this table for backward finite difference method:

Derivative 𝒇 𝒙𝒐 − 𝟓𝒉 𝒇 𝒙𝒐 − 𝟒𝒉 𝒇 𝒙𝒐 − 𝟑𝒉 𝒇 𝒙𝒐 − 𝟐𝒉 𝒇 𝒙𝒐 − 𝒉 𝒇 𝒙𝒐

1st 1/2 -2 3/2


2nd -1 4 -5 2
3rd 3/2 -7 12 -9 5/2
4th -2 11 -24 26 -14 3
Table 2. The backward difference formulas for 2nd order accuracy
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Solution
c. Backward Finite Difference Method
Solve for the value for 𝑓 𝑥𝑜 − 3ℎ to 𝑓 𝑥𝑜 at 𝑥𝑜 = 3 and ℎ = 0.2
1
𝑓 𝑥𝑜 = 5 cos 3𝑥 − 𝑒 −2 𝑥
Note: Use your calculator in radian mode!
1
− 2.4
𝑓 𝑥𝑜 − 3ℎ = 𝑓 3 − 3(0.2) = 𝑓(2.4) = 5 cos 3)(2.4 − 𝑒 21 = 2.740562
−2 2.6
𝑓 𝑥𝑜 − 2ℎ = 𝑓 3 − 2(0.2) = 𝑓 2.6 = 5 cos 3)(2.6 − 𝑒 = −0.002755
1
−2 2.8
𝑓 𝑥𝑜 + ℎ = 𝑓 3 − 0.2 = 𝑓 2.8 = 5 cos 3)(2.8 −𝑒 = −2.843040
1
− 3
𝑓 𝑥0 = 𝑓 3 = 5 cos 3)(3 −𝑒 2 = −4.778781

Use the table #2 for the coefficients to solve for the first and second derivatives of the function
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method
𝑓 𝑥𝑜 − 3ℎ = 2.740562
Solution 𝑓 𝑥𝑜 − 2ℎ = −0.002755
c. Backward Finite Difference Method 𝑓 𝑥𝑜 − ℎ = −2.843040
𝑓 𝑥𝑜 = −4.778781
First derivative:


1 1 3
𝑓 (𝑥𝑜 ) = 𝑓 𝑥𝑜 − 2ℎ − 2𝑓 𝑥𝑜 − ℎ + 𝑓 𝑥𝑜
ℎ 2 2
1 1 3
𝑓 ′ (3) = −0.002755 − 2 −2.843040 + −4.778781
0.2 2 2

𝑓 ′ 3 = −𝟕. 𝟒𝟏𝟕𝟑𝟒𝟓
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method
𝑓 𝑥𝑜 − 3ℎ = 2.740562
Solution 𝑓 𝑥𝑜 − 2ℎ = −0.002755
c. Backward Finite Difference Method 𝑓 𝑥𝑜 − ℎ = −2.843040
𝑓 𝑥𝑜 = −4.778781
Second derivative:

′′
1
𝑓 (𝑥𝑜 ) = 2 −𝑓 𝑥𝑜 − 3ℎ + 4𝑓 𝑥𝑜 − 2ℎ − 5𝑓 𝑥𝑜 − ℎ + 2𝑓 𝑥𝑜

′ 1
𝑓′ (3) = − 2.740562 + 4 −0.002755 − 5 −2.843040 + 2(−4.778781)
0.22

𝑓 ′′ 3 = 𝟒𝟕. 𝟔𝟓𝟏𝟒
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Solution
d. Central Finite Difference Method
recall that we have this table for central finite difference method:
Derivative 𝒇 𝒙𝒐 − 𝟑𝒉 𝒇 𝒙𝒐 − 𝟐𝒉 𝒇 𝒙𝒐 − 𝒉 𝒇 𝒙𝒐 𝒇 𝒙𝒐 + 𝒉 𝒇 𝒙𝒐 + 𝟐𝒉 𝒇 𝒙𝒐 + 𝟑𝒉

1st 1/12 -2/3 0 2/3 -1/12


2nd -1/12 4/3 -5/2 4/3 -1/12
3rd 1/8 -1 13/8 0 -13/8 1 -1/8
4th -1/6 2 -13/2 28/3 -13/2 2 -1/6
Table 3. The central difference formulas for 4th order accuracy
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Solution
d. Central Finite Difference Method
Solve for the value for 𝑓 𝑥𝑜 − 2ℎ to 𝑓 𝑥𝑜 + 2ℎ at 𝑥𝑜 = 3 and ℎ = 0.2
1
𝑓 𝑥𝑜 = 5 cos 3𝑥 − 𝑒 −2 𝑥
Note: Use your calculator in radian mode!
1
− 2.6
𝑓 𝑥𝑜 − 2ℎ = 𝑓 3 − 2(0.2) = 𝑓(2.6) = 5 cos 3)(2.6 − 𝑒 2 = −0.002755
1
𝑓 𝑥𝑜 − ℎ = 𝑓 3 − 0.2 = 𝑓 2.8 = 5 cos 3)(2.8 − 𝑒 −2 2.8 = −2.843040
1
−2 3
𝑓 𝑥0 = 𝑓 3 = 5 cos 3)(3 −𝑒 = −4.778781
1
−2 3.2
𝑓 𝑥𝑜 + ℎ = 𝑓 3 + 0.2 = 𝑓 3.2 = 5 cos 3)(3.2 − 𝑒 = −5.125336
1
−2 3.4
𝑓 𝑥0 + 2ℎ = 𝑓 3 + 2(0.2) = 5 cos 3)(3.4 − 𝑒 = −3.754012
Use the table #3 for the coefficients to solve for the first and second derivatives of the function
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method
𝑓 𝑥𝑜 − 2ℎ = −0.002755
Solution 𝑓 𝑥𝑜 − ℎ = −2.843040
d. Central Finite Difference Method 𝑓 𝑥𝑜 = −4.778781
𝑓 𝑥𝑜 + ℎ = −5.125336
First derivative: 𝑓 𝑥𝑜 + 2ℎ = −3.754012


1 1 2 2 1
𝑓 (𝑥𝑜 ) = 𝑓 𝑥𝑜 − 2ℎ − 𝑓 𝑥𝑜 − ℎ + 𝑓 𝑥𝑜 + ℎ − 𝑓(𝑥𝑜 + 2ℎ)
ℎ 12 3 3 12
1 1 2 2 1
𝑓 ′ (3) = −0.002755 − −2.843040 + −5.125336 − (−3.754012)
0.2 12 3 3 12

𝑓 ′ 3 = −𝟔. 𝟎𝟒𝟒𝟔𝟑𝟎
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method
𝑓 𝑥𝑜 − 2ℎ = −0.002755
Solution 𝑓 𝑥𝑜 − ℎ = −2.843040
d. Central Finite Difference Method 𝑓 𝑥𝑜 = −4.778781
𝑓 𝑥𝑜 + ℎ = −5.125336
Second derivative: 𝑓 𝑥𝑜 + 2ℎ = −3.754012


1 1 4 5 4 1
𝑓′ (𝑥𝑜 ) = 2 − 𝑓 𝑥𝑜 − 2ℎ + 𝑓 𝑥𝑜 − ℎ − 𝑓 𝑥𝑜 + 𝑓 𝑥𝑜 + ℎ − 𝑓(𝑥𝑜 + 2ℎ)
ℎ 12 3 2 3 12
1 1 4 5 4 1
𝑓 ′′ (3) = − −0.002755 + −2.843040 − −4.778781 + −5.125336 − (−3.754012)
0.2 12 3 2 3 12

𝑓′′ 3 = 𝟒𝟎. 𝟖𝟖𝟕𝟖𝟕𝟕


MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Summary of Answer

Forward Finite Backward Finite Central Finite


Derivative Analytical Solution
Difference Difference Difference

𝒇′ 𝟑 −𝟔. 𝟎𝟕𝟎𝟐𝟏𝟐 −𝟔. 𝟎𝟐𝟕𝟒𝟕𝟑 −𝟕. 𝟒𝟏𝟕𝟑𝟒𝟓 −𝟔. 𝟎𝟒𝟒𝟔𝟑𝟎

𝒇′′ 𝟑 𝟒𝟎. 𝟗𝟒𝟓𝟎𝟕𝟗 𝟓𝟒. 𝟕𝟓𝟎𝟒𝟓𝟎 𝟒𝟕. 𝟔𝟓𝟏𝟒𝟎𝟎 𝟒𝟎. 𝟖𝟖𝟕𝟖𝟕𝟕


MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Summary of Answer
Now, solving for the absolute relative percentage of error, 𝜀:

𝐴𝑃𝑃𝑅𝑂𝑋𝐼𝑀𝐴𝑇𝐸 − 𝐸𝑋𝐴𝐶𝑇
𝜀= 𝑥 100%
𝐸𝑋𝐴𝐶𝑇
Where:
𝜀 = Absolute relative percentage of error (%)
𝐴𝑃𝑃𝑅𝑂𝑋𝐼𝑀𝐴𝑇𝐸 = Approximate Method Value
𝐸𝑋𝐴𝐶𝑇 = Exact Method/Analytical Value
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

Summary of Answer

Derivative Forward Finite Difference Backward Finite Difference Central Finite Difference

(−6.070212) − (−6.027473) (−7.417345) − ( − 6.027473) (−6.044630) − ( − 6.027473)


𝜀= 𝑥 100% 𝜀= 𝑥 100% 𝜀= 𝑥 100%
−6.070212 −6.070212 −6.070212
𝒇′ 𝟑
𝜺 = 𝟎. 𝟕𝟎% 𝜺 = 𝟐𝟐. 𝟏𝟗% 𝜺 = 𝟎. 𝟒𝟐%

(54.750450 ) − (40.945079) (47.651400) − (40.945079) (40.887877) − (40.945079)


𝜀= 𝑥 100% 𝜀= 𝑥 100% 𝜀= 𝑥 100%
40.945079 40.945079 40.945079
𝒇′′ 𝟑
𝜺 = 𝟑𝟑. 𝟕𝟐% 𝜺 = 𝟏𝟔. 𝟑𝟖% 𝜺 = 𝟎. 𝟏𝟒%
MODULE 7: Numerical Differentiation
7.1. Numerical Differentiation using Finite Difference Method

For some reasons, the relative error of the solution may be


unacceptable for some engineers and scientists. In order to improve the
accuracy of the result, the following recommendations can be used:
1. The values of 𝑓 𝑥𝑜 ± 𝑛ℎ is expressed in more decimal places
2. The values of h can be expressed into smaller values.
3. Use a more accurate finite difference formula.
The first and second recommendation can be a problem if hand calculation will be used due to
human error. However, this is not a problem if the calculations will be performed by computers due to its
storage power. For example, an excel file can store the value of a single number for 30 decimal places.
For the third recommendation, the more accurate formulas for central finite difference will be discussed in
the next section of this presentation.
MODULE 7: Numerical Differentiation
Intended Learning Outcomes (ILO’s):
At the end of this presentation, the student should be able to:

✓01
01
Polynomial 04
Perform Numerical Differentiation using Finite Difference
Interpolation
Method

Perform Numerical Differentiation using more accurate


0202 05
central finite difference method

Apply methods of numerical differentiation in civil


03
03 engineering problems 06
MODULE 7: Numerical Differentiation

MORE ACCURATE FORMULAS


FOR THE CENTRAL FINITE
DIFFERENCE METHOD
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method

The previous section discussed the central finite difference formulas


for 4th order accuracy only. However, a detailed coefficient table for
central finite difference is shown in the next slide.
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method

Example 2
Determine the value of the first derivatives of the function shown below at x =2:
𝑓 𝑥 = 4𝑒 cos 2𝑥 −2
a. Use the analytical method
b. Use the central finite difference method of 2nd order accuracy
c. Use the central finite difference method of 4th order accuracy
d. Use the central finite difference method of 6th order accuracy
e. Use the central finite difference method of 8th order accuracy
For the finite difference solution, use h = 0.25
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method

Solution
a. Analytical Solution
For this method, obtain the first derivative of the function using the rules of differentiation:

First derivative:

𝑓 ′ (𝑥) = 4𝑒 cos 2𝑥 −2 [− sin 2𝑥 ] 2 = −8 sin 2𝑥 𝑒 cos 2𝑥 −2

𝑓 ′ 2 = −8 sin[ 2)(2 ] 𝑒 cos 2)(2 −2 = 𝟎. 𝟒𝟐𝟔𝟏𝟗𝟔


Take note: Your calculator should be in radian mode!
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method

Solution
For the computation of numerical solution using central finite difference method
Recall:
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method
Solution
For the computation of numerical solution using central finite difference method
Solve for the value for 𝑓 𝑥𝑜 − 4ℎ to 𝑓 𝑥𝑜 + 4ℎ at 𝑥𝑜 = 2 and ℎ = 0.25
𝑓 𝑥 = 4𝑒 cos 2𝑥 −2

Note: Use your calculator in radian mode!


Derivatives Functions Value of function
𝑓(𝑥𝑜 − 4ℎ) 𝑓[2 − 4 0.25 ] 𝑓(1) 0.357060
𝑓(𝑥𝑜 − 3ℎ) 𝑓[2 − 3 0.25 ] 𝑓(1.25) 0.242962
𝑓(𝑥𝑜 − 2ℎ) 𝑓[2 − 2 0.25 ] 𝑓(1.50) 0.201151
𝑓(𝑥𝑜 − ℎ) 𝑓(2 − 0.25) 𝑓(1.75) 0.212214

1st 𝑓(𝑥𝑜 ) 𝑓(2) 𝑓(2) 0.281577


𝑓(𝑥𝑜 + ℎ) 𝑓(2 + 0.25) 𝑓(2.25) 0.438454
𝑓(𝑥𝑜 + 2ℎ) 𝑓[2 + 2 0.25 ] 𝑓(2.50) 0.718892
𝑓(𝑥𝑜 + 3ℎ) 𝑓[2 + 3 0.25 ] 𝑓(2.75) 1.099619
𝑓(𝑥𝑜 + 4ℎ) 𝑓[2 + 4 0.25 ] 𝑓(3) 1.414060
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method
Solution
b. Central Finite Difference Method for 2nd Order Accuracy
First Derivative (2nd Order Accuracy)

1 1 1
𝑓 ′ (𝑥𝑜 ) = − 𝑓 𝑥𝑜 − ℎ + 𝑓 𝑥𝑜 + ℎ
ℎ 2 2


1 1 1
𝑓 (2) = − (0.212214) + (0.438454)
0.25 2 2
𝒇′ (𝟐) = 𝟎. 𝟒𝟓𝟐𝟒𝟖𝟎
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method
Solution
c. Central Finite Difference Method for 4th Order Accuracy
First Derivative (4th Order Accuracy)

1 1 2 2 1
𝑓 ′ (𝑥𝑜 ) = 𝑓 𝑥𝑜 − 2ℎ − 𝑓 𝑥𝑜 − ℎ + 𝑓 𝑥𝑜 + ℎ − 𝑓 𝑥𝑜 + 2ℎ
ℎ 12 3 3 12
1 1 1 2 1
𝑓 ′ (2) = 0.201151 + 0.212214 + 0.438454 − 0.718892
0.25 12 2 3 12
𝒇′ 𝟐 = 𝟎. 𝟒𝟑𝟎𝟕𝟐𝟔
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method
Solution
d. Central Finite Difference Method for 6th Order Accuracy
First Derivative (6th Order Accuracy)

1 1 3 3 3 3 1
𝑓 ′ (𝑥𝑜 ) = − 𝑓 𝑥𝑜 − 3ℎ + 𝑓 𝑥𝑜 − 2ℎ − 𝑓 𝑥𝑜 − ℎ + 𝑓 𝑥𝑜 + ℎ − 𝑓 𝑥𝑜 + 2ℎ + 𝑓 𝑥𝑜 + 3ℎ
ℎ 60 20 4 4 20 60
1 1 3 3 3 3 1
𝑓 ′ (2) = − (0.242962) + 0.201151 − 0.212214 + 0.438454 − 0.718892 + 1.099619
0.25 60 20 4 4 20 60

𝒇′ 𝟐 = 𝟎. 𝟒𝟐𝟓𝟏𝟖𝟔
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method
Solution
e. Central Finite Difference Method for 8th Order Accuracy
First Derivative (8th Order Accuracy)

1 1 4 1 4 4 1 4 1
𝑓 ′ (𝑥𝑜 ) = 𝑓 𝑥𝑜 − 4ℎ − 𝑓 𝑥𝑜 − 3ℎ + 𝑓 𝑥𝑜 − 2ℎ − 𝑓 𝑥𝑜 − ℎ + 𝑓 𝑥𝑜 + ℎ − 𝑓 𝑥𝑜 + 2ℎ + 𝑓 𝑥𝑜 + 3ℎ − 𝑓 𝑥𝑜 + 4ℎ
ℎ 280 105 5 5 5 5 105 280

1 1 4 1 4 4 1 4 1
𝑓 ′ (2) = (0.357060) − (0.242962) + 0.201151 − 0.212214 + 𝑓 0.438454 − 0.718892 + 1.099619 − (1.414060)
ℎ 280 105 5 5 5 5 105 280

𝒇′ 𝟐 = 𝟎. 𝟒𝟐𝟓𝟐𝟏𝟑
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method

Summary of Answer
Solutions Answers

Analytical Solution 𝟎. 𝟒𝟐𝟔𝟏𝟗𝟔


Central Finite Difference
Method (2nd order accuracy) 𝟎. 𝟒𝟓𝟐𝟒𝟖𝟎
Central Finite Difference
Method (4th order accuracy) 𝟎. 𝟒𝟑𝟎𝟕𝟐𝟔
Central Finite Difference
Method (6th order accuracy) 𝟎. 𝟒𝟐𝟓𝟏𝟖𝟔
Central Finite Difference
Method (8th order accuracy) 𝟎. 𝟒𝟐𝟓𝟐𝟏𝟑
MODULE 7: Numerical Differentiation
7.2. More accurate formulas for Central Finite Difference Method

Summary of Answer
Solutions Absolute Relative Error of Percentage, 𝜺

Central Finite Difference (0.452480) − (0.426196)


Method (2nd order accuracy) 𝜀= 𝑥 100% = 𝟔. 𝟏𝟔𝟕𝟏%
0.426196

Central Finite Difference (0.430726) − (0.426196)


Method (4th order accuracy) 𝜀= 𝑥 100% = 𝟏. 𝟎𝟔𝟐𝟗%
0.426196

Central Finite Difference (0.425186) − (0.426196)


Method (6th order accuracy) 𝜀= 𝑥 100% = 𝟎. 𝟐𝟑𝟕𝟎%
0.426196

Central Finite Difference (0.425213) − (0.426196)


Method (8th order accuracy) 𝜀= 𝑥 100% = 𝟎. 𝟐𝟑𝟎𝟔%
0.426196
MODULE 7: Numerical Differentiation

At the end of this presentation, the student should be able to:

✓ 01
01 04
Polynomial
Perform Numerical Differentiation using Finite Difference
Interpolation
Method

✓ 0202
Perform Numerical Differentiation using more accurate
05
central finite difference method

Apply methods of numerical differentiation in civil


03
03 engineering problems 06
MODULE 7: Numerical Differentiation

CIVIL ENGINEERING
APPLICATION:
(Theory of Structures)
Relationship of deflection, slope,
moments, shear, and load
MODULE 7: Numerical Differentiation
7.3. Civil Engineering Applications: Theory of Structures

Relationship of deflection, slope, moments, shear, and load


Elastic Curve For example, we have a deflection
𝑦 − 𝑎𝑥𝑖𝑠

equation of the beam as a function of x:


𝑤
𝑦=− 𝑥 4 − 2𝐿𝑥 3 + 𝐿3 𝑥
24𝐸𝐼

1st Derivatives
𝑥 − 𝑎𝑥𝑖𝑠

𝑥 𝑑𝑦 1st Derivatives 𝑑𝜃 𝑀 𝑥
𝑑𝑥 = 𝜃 𝑥 =
Where:
𝑥 = distance along beam (m)
𝑑𝑥 𝑑𝑥 𝐸𝐼

1st Derivatives
𝑦 = deflection (m)
𝜃 𝑥 = slope (m/m)
𝐸 = modulus of elasticity (Pa = N/m2)
𝐼 = moment of inertia (mm4)
𝑀(𝑥) = moment (N-m) 𝑑𝑉 1st Derivatives 𝑑𝑀
𝑉 𝑥 = shear (N) = −𝑤(𝑥) = 𝑉(𝑥)
𝑤(𝑥) = distributed load (N/m) 𝑑𝑥 𝑑𝑥
MODULE 7: Numerical Differentiation
7.3. Civil Engineering Applications: Theory of Structures

Relationship of deflection, slope, moments, shear, and load

𝑃 𝑤 𝑤𝑜
𝑦= 4𝑥 3 − 3𝐿2 𝑥 𝑦=− 𝑥 4 − 2𝐿𝑥 3 + 𝐿3 𝑥 𝑦=− 3𝑥 5 − 10𝐿2 𝑥 2 + 7𝐿4
24𝐸𝐼 360𝐸𝐼𝐿
48𝐸𝐼
MODULE 7: Numerical Differentiation

CIVIL ENGINEERING
APPLICATION:
(Dynamics of Rigid Bodies)
Kinematics of Particles:
Continuous Motion with Variable
Acceleration
MODULE 7: Numerical Differentiation
7.4. Civil Engineering Applications: Dynamics of Rigid Bodies

In our Dynamics of Rigid Bodies, Instantaneous Velocity and Acceleration of the


particles can be represented as:

Instantaneous Instantaneous
Velocity Acceleration
MODULE 7: Numerical Differentiation
7.4. Civil Engineering Applications: Dynamics of Rigid Bodies

Now observe the following equation:


First derivative of
velocity equation

Position Equation
First derivative of
position equation
Second derivative of
Note: with respect to time position equation
MODULE 7: Numerical Differentiation
7.4. Civil Engineering Applications: Dynamics of Rigid Bodies

Now observe the following equation:


Position Equation
Derivative

Velocity Equation

Derivative

Acceleration Equation

Note: with respect to time


MODULE 7: Numerical Differentiation

Solving Civil Engineering Problem


Application using Numerical
Differentiation
MODULE 7: Numerical Differentiation
7.5. Solving Problems using Numerical Differentiation

Sample Problem #1
For the case of linearly increasing load, the slope can be computed analytically as:

𝑤𝑜
𝜃 𝑥 = −5𝑥 4 + 6𝐿2 𝑥 2 − 𝐿4
120𝐸𝐼𝐿
Employ numerical differentiation to compute the moment at the midspan (in kN-m) and
shear at the midspan (in kN). Base your numerical calculations on values of the slope
computed with the equations above at equally spaced intervals of ∆𝑥 = 0.125 𝑚 along a
3-m beam. Use the following parameter values in your computation 𝐸 = 2x108𝑘𝑁/𝑚2 ,
𝐼 = 0.0003 𝑚4, and 𝑤𝑜 = 250 𝑘𝑁/𝑚
MODULE 7: Numerical Differentiation
7.5. Solving Problems using Numerical Differentiation
MODULE 7: Numerical Differentiation
7.5. Solving Problems using Numerical Differentiation

Sample Problem #2
The position of a particle along a straight-line path is defined the following
position equation 𝑠 = 𝑡 3 − 12.5𝑡 2 + 2𝑡, where t is in seconds. Determine
the following:

a. Instantaneous velocity (m/sec) at t = 5 seconds


b. Instantaneous acceleration (m/sec^2) at t = 5 seconds

Employ ∆𝑡 = 0.125 𝑠𝑒𝑐 and use central finite 8th order for finite difference solution
MODULE 7: Numerical Differentiation
7.5. Solving Problems using Numerical Differentiation
MODULE 7: Numerical Differentiation
Intended Learning Outcomes (ILO’s):
At the end of this presentation, the student should be able to:

✓ 01
01 04
Polynomial
Perform Numerical Differentiation using Finite Difference
Interpolation
Method

Perform Numerical Differentiation using more accurate


✓ 0202 05
central finite difference method

✓ 03
Apply methods of numerical differentiation in civil
03
engineering problems 06
MODULE 7: Numerical Differentiation

OPEN FORUM
MODULE 7: Numerical Differentiation
End of Presentation

THANK YOU! ☺☺☺


If you have any inquiries, please contact me at:

fmanggapis.ce@tip.edu.ph

Franklyn Manggapis
FRANKLYN F. MANGGAPIS
Instructor
Civil Engineering Department https://www.researchgate.net/profile/
Technological Institute of the
Philippines - Quezon Franklyn-Manggapis
MODULE 7: Numerical Differentiation
Final Coursework Activity #1: Civil Engineering Applications using Numerical Differentiation

Situation #1

𝑤
𝑦=− 𝑥 4 − 2𝐿𝑥 3 + 𝐿3 𝑥
24𝐸𝐼

Employ numerical differentiation to compute the slope (in degrees), moment at the
midspan (in kN-m) and shear at the midspan (in kN). Base your numerical calculations on
values of the slope computed with the equations above at equally spaced intervals of
∆𝑥 = 0.100 𝑚 along a 2.5-m beam. Use the following parameter values in your
computation 𝐸 = 2x108𝑘𝑁/𝑚2 , 𝐼 = 0.00025 𝑚4, and 𝑤𝑜 = 325 𝑘𝑁/𝑚

You might also like