Page 220 - Applied Numerical Methods Using MATLAB
P. 220
5
NUMERICAL
DIFFERENTIATION/
INTEGRATION
5.1 DIFFERENCE APPROXIMATION FOR FIRST DERIVATIVE
For a function f(x) of a variable x, its first derivative is defined as
f(x + h) − f(x)
f (x) = lim (5.1.1)
h→0 h
However, this gives our computers a headache, since they do not know how
to take a limit. Any input number given to computers must be a definite num-
ber and can be neither too small nor too large to be understood by the com-
puter. The ‘theoretically’ infinitesimal number h involved in this equation is a
problem.
A simple approximation that computers might be happy with is the forward
difference approximation
f(x + h) − f(x)
D f 1 (x, h) = (h is step size) (5.1.2)
h
How far away is this approximation from the true value of (5.1.1)? In order to do
the error analysis, we take the Taylor series expansion of f(x + h) about x as
h 2 h 3
(2) (3)
f(x + h) = f(x) + hf (x) + f (x) + f (x) +· · · (5.1.3)
2 3!
Applied Numerical Methods Using MATLAB , by Yang, Cao, Chung, and Morris
Copyright 2005 John Wiley & Sons, I nc., ISBN 0-471-69833-4
209