You are on page 1of 18

CE50P-2:

Numerical Solution
to Engineering Problems
NUMERICAL
DIFFERENTIATION
COURSE OUTCOME 3:
Use computer to develop
approximate solution to problem by
Numerical Differentiation and
Integration.
CE50P-2/A2
APRIL 1 – BB COLLABORATE ULTRA
10:30-12 - CO3A Lecture
12-1:30 – CW3A and LA3A

NUMERICAL
DIFFERENTIATION
COURSE OUTCOME 3:
Use computer to develop
approximate solution to problem by
Numerical Differentiation and
Integration.
Numerical Differentiation
COURSE OUTCOME 3:
Use computer to develop approximate solution to
problem by Numerical Differentiation and Integration.
Numerical Differentiation
Numerical Differentiation
Defines the analytic form of derivatives for a given
function especially when the analytic form is very
complicated. Moreover, numerical differentiation may
be used when the function as explicit expression is
not known, but only as tabulated values.
Numerical algorithms for computing the derivative
of a function require the estimate of the slope of the
function for some particular range of x values.
Three common approaches are the forward
difference, backward difference, and the central
difference.
Numerical Differentiation
(a) Graphical depiction of forward finite-divided-
difference approximations of the first derivative
Numerical Differentiation
(b) Graphical depiction of backward finite-divided-
difference approximations of the first derivative
Numerical Differentiation
(c) Graphical depiction of centered finite-divided-
difference approximations of the first derivative
Numerical Differentiation
Consider the case when n = 1 so that
𝑝1 𝑥 = 𝑓0 + 𝑓 𝑥0 , 𝑥1 𝑥 − 𝑥0 FORWARD
DIFFERENCE
Then OPERATOR
APPROXIMATELY 𝑓1 − 𝑓0
EQUIVALENT TO
𝑝′1 𝑥 = 𝑓 𝑥0 , 𝑥1 = . (1)
𝑥1 − 𝑥0
If we set 𝑥0 = 𝑥 and 𝑥1 = 𝑥 + ℎ, then 𝑥1 − 𝑥0 = ℎ and
𝑓 𝑥+ℎ −𝑓 𝑥

𝑓 (𝑥) ≈ = 𝐷 𝐹ℎ 𝑓 , (2)

which is called the forward difference formula. From
elementary calculus,
𝑓 𝑥+ℎ −𝑓 𝑥

𝑓 𝑥 = lim . (3)
ℎ→0 ℎ
Numerical Differentiation
Of interest in computations is how good this
approximation is. This is measured by estimating the
error
𝑓 𝑥+ℎ −𝑓 𝑥

𝐸=𝑓 𝑥 − . (4)

Numerical Differentiation
Example
Using 𝐷 𝐹ℎ 𝑓 of (2), approximate the derivative of the
function 𝑓 𝑥 = 𝑒 𝑥 at 𝑥 = 0. Results for various values
of ℎ are given in Table 1. Ratio is the quantity 𝐷 𝐹ℎ 𝑓 /
𝐹
𝐷ℎ/2 (𝑓) and shows that, for ℎ sufficiently small, the
error is reduced by a factor of two when ℎ is halved.
GIVEN
VALUES Table 1 𝑓 𝑥 = 𝑒 𝑥 = 𝑒 0 = 1
h 𝐷ℎ𝐹 Error Ratio 𝐸 = 1 − 𝐷ℎ𝐹
0.20000 1.10701 0.10701 0.00000 𝐸1 = 1 − 1.10701
0.10000 1.05171 0.05171 2.06953 =0.10701
0.05000 1.02542 0.02542 2.03404 𝑅 = 𝐸𝑛−1 /𝐸𝑛
0.02500 1.01260 0.01260 2.01684 0
0.01250 1.00628 0.00628 2.00838 𝑅1 = 0.10701
R2=0.10701/0.05171
Numerical Differentiation
Numerical Differentiation
Returning to (1) and setting 𝑥0 = 𝑥 − ℎ and 𝑥1 = 𝑥 + ℎ,
we have 𝑥1 − 𝑥0 = 2ℎ and

𝑓 𝑥+ℎ −𝑓 𝑥−ℎ
𝑓 (𝑥) ≈ = 𝐷 ℎ𝐶 𝑓 , (5)
2ℎ
the central difference formula.

CENTRAL
DIFFERENCE
OPERATOR
Numerical Differentiation
Example
Using 𝐷 𝐶ℎ 𝑓 of (5), approximate the derivative of the
function 𝑓 𝑥 = 𝑒 𝑥 at 𝑥 = 0. From Table 2, we see that
the error is now reduced by a factor of 4 when the
value of ℎ is halved.
GIVEN Table 2
VALUES

𝐷ℎ𝐶 𝐸 = 1 − 𝐷ℎ𝐶
h Error Ratio
0.20000 1.00668 0.00668 0.00000
0.10000 1.00167 0.00167 4.00600
0.05000 1.00042 0.00042 4.00150 𝑅 = 𝐸𝑛−1 /𝐸𝑛
0.02500 1.00010 0.00010 4.00038
0.01250 1.00003 0.00003 4.00009
Numerical Differentiation
Numerical Differentiation
Returning to (1) and setting 𝑥0 = 𝑥 − ℎ and 𝑥1 = 𝑥, we
have 𝑥1 − 𝑥0 = ℎ and

𝑓 𝑥 −𝑓 𝑥−ℎ
𝑓 (𝑥) ≈ = 𝐷 𝐵ℎ 𝑓 , (6)

the backward difference formula.

BACKWARD
DIFFERENCE
OPERATOR
Numerical Differentiation
Example
Using 𝐷 𝐵ℎ 𝑓 of (6), approximate the derivative of the
function 𝑓 𝑥 = 𝑒 𝑥 at 𝑥 = 0. Results for various values
of ℎ are given in Table 3. Actual
𝑓 𝑥 = 𝑒 𝑥 = 𝑒0 = 1
Table 3 value

GIVEN 𝐸 = 1 − 𝐷ℎ𝐵
VALUES
h 𝐷ℎ𝐵 Error Ratio
0.20000 0.90635 0.09365 0.00000
0.10000 0.95163 0.04837 1.93603
0.05000 0.97541 0.02459 1.96735 𝑅 = 𝐸𝑛−1 /𝐸𝑛
0.02500 0.98760 0.01240 1.98351
0.01250 0.99378 0.00622 1.99171
Numerical Differentation
CW3A (page 1 of CW3)
Compute for the derivative of 𝑓(𝑥)=cos𝑥 at 𝑥=𝜋/6 by
a) Forward Difference Formula
b) Central Difference Formula
c) Backward Difference Formula
Use the following for the values of
ℎ=0.1
=0.05 Upload Word file of CW3
Filename: CW3-Surname
=0.025 CW3A-Page1: Numerical Differentiation
=0.0125 CW3B-Page2: Numerical Integration
Solution could be presented by using
=0.00625 Word-Equation Tool or handwritten
Numerical Differentation
LA3-SHEET1
Compute for the derivative of 𝑓(𝑥)=cos𝑥 at 𝑥=𝜋/6 by
a) Forward Difference Formula
b) Central Difference Formula
c) Backward Difference Formula
Use the following for the values of
ℎ=0.1
=0.05 Upload Excel file of LA3
Filename: LA3-Surname
=0.025 LA3-Sheet1: Numerical Differentiation
=0.0125 LA3-Sheet2: Numerical Integration
Formula should be inserted to cells for
=0.00625 each Table presented
Meaning there would be
no links for submission for
CW3A and LA3A
CE50P-2/A2
THANK YOU … I WILL UPLOAD
THIS PPT ASAP …
YOU MAY LEAVE THE COLLAB
SESSION NOW

NUMERICAL
DIFFERENTIATION
COURSE OUTCOME 3:
Use computer to develop
approximate solution to problem by
Numerical Differentiation and
Integration.

You might also like