ECE 3040 Lecture 21: Numerical Differentiation
ECE 3040
Lecture 21: Numerical Differentiation
? Prof. Mohamad Hassoun
This lecture covers the following topics:
?
?
?
?
Introduction
Numerical Differentiation formulas
Richardson extrapolation
Matlab numerical differentiation function: diff
? Matlab polynomial and symbolic differentiation: polyder and diff
Introduction
The differentiation of a function has many engineering applications, from finding
slopes (rate of change) to solving optimization problems to differential equations
that model electric circuits and mechanical systems. Given a function ?(?), we
denote its first derivative with respect to its independent variable ? by the symbol
(devised by the German Gottfried Leibniz, 1646-1716),
??(?)
??
. Alternative symbols
for the first derivative are: ?(?) (attributed to the French Joseph-Louis Lagrange,
1736-1813) and ?? (?) (attributed to the English Isaac Newton, 1642-1726). Recall
(from your calculus course) that the first derivative of an analytic function ?(?) is
an analytic function expressed as the limit
?? (? ) = ? (? ) =
??(?)
??
?(? + ?? ) ? ?(?)
= lim
= lim
??0 ??
??0
??
??
The derivative of a function at a specific point ?? ,
??(? ) = ? (?? ) =
??(?)
??(?? )
?(?? + ?? ) ? ?(?? )
|
=
= lim
??0
?? ?=??
??
??
is a numeric value that specifies the slope of the function at the point (?? , ?(?? )), as
depicted in the following figures.
Recall that the straight line that passes through the point (?? , ?(?? )), and has a slope
? (?? ), is a tangent line to ?(?).
The second derivative represents the derivative of the first derivative and is denoted
by
??(?) ? (? )
? ??(?)
?2 ?(?)
(
)
?? ??
?? 2
The second derivative measures the rate of change of the first derivative and is
commonly referred to as the curvature. From physics, if ?(?) describes the position
of a moving object then ?(?) =
is the objects acceleration.
??(?)
??
is the velocity of the object, and ?(?) =
?2 ?(?)
?? 2
Numerical Differentiation Formulas
We have already derived few basic numerical differentiation formulas back in
Lecture 10 in connection with truncation error. The following is a repeat (for
convenience) of such derivation. Starting from the Taylor series expansion of the
function ?(?) at a point ? = ?? and evaluating the series at the point ? = ??+1 ,
close to ?? , we obtain the (forward) Taylor expansion,
? (?? )
? (3) (?? )
3
? (??+1 ) = ?(?? ) + ?? ?? ) + ?
+?
+?
2!
3!
(
2
(1)
where ? = ??+1 ? ?? is referred to as the step size. We may now solve Eqn. (1) for
the derivative at ?? to obtain
? (??+1 ) ? ? (?? )
? (?? )
? ?? ) =
??
??
?
2!
(
(2)
or
? (?? ) =
?(??+1 ) ? ?(?? )
? ?(?)
?
Here, ?(?) means that the remainder of the series is of order ?. That is, if the terms
in the second and higher derivatives are dropped then the truncation error would be
proportional to the step size, ?.
The last expression should not be strange to us. In fact, if we take the limit of that
expression as ? approaches zero we arrive at the definition of the derivative [note
that ?(?) approaches zero as h approaches zero]:
? (?? ) = lim
?0
? (??+1 ) ? ? (?? )
?(?? + ?) ? ?(?? )
? lim ?(?) = lim
?0
?0
?
?
Using a finite (but small) ?, results in the forward finite-difference formula for
numerically approximating the first derivative,
? (?? ) ?
? (??+1 ) ? ? (?? )
?
Based on Eqn. (2), the truncation error for the above formula is proportional to,
?(?). This means that the formula is exact for linear functions.
The convergence of the forward difference method is of order ?, and is relatively
slow; i.e., a very, very small (positive) ? is required in order to achieve high
accuracy.
Alternatively, the Taylor series can be applied backwards with ???1 < ?? as
follows,
? (?? )
? (3) (?? )
3
?(???1 ) = ?(?? ) + (???1 ? ?? )? ?? ) + (???1 ??? )
+ (???1 ??? )
2!
3!
+?
(
2
The above expression can be rewritten, with positive ? = ?? ? ???1 , as
? (?? )
? (3) (?? )
3
? (???1 ) = ?(?? ) ? ?? ?? ) + ?
??
+?
2!
3!
(
2
(3)
from which one can derive the order ?(?) backward finite-difference formula for
computing the first derivative,
? (?? ) ? ? (???1 )
( )
? ?? ?
?
A third way to approximate the derivative is to subtract the backward Taylor series
[Eqn. (3)] from the forward Taylor series [Eqn. (1)] to yield
? (3) (?? )
?(??+1 ) = ? (???1 ) + 2?? ?? ) + 2?
+?
3!
(
3
which can be solved for the first derivative as
?(??+1 ) ? ? (???1 )
? (3) (?? )
2
? (?? ) =
??
+?
2?
6
or
? (?? ) =
?(??+1 ) ? ?(???1 )
? ?(?2 )
2?
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- 2 2 limits of functions university of manitoba
- chapter 10 limits of trigonometric functions
- math 113 hw 4 solutions
- the squeeze theorem ucla mathematics
- i the limit laws
- lecture 4 calculating limits using limit laws
- when given a function f x p x f x f q x0 x0 h pq f x0 h f
- thederivative oxford university press
- the derivative
- trigonometric limits math 120 calculus i