Recall that
Example
|
|
||
More general derivative formulas:
Suppose
distinct numbers,
is the interval and
. Using Lagrange polynomials
:
Express
Differentiating:
Price payed: more functional evaluations and possible round-off error. Thus, we must balance truncation error versus round-off error and speed benefits.
Most common: 3 and 5 point formulas.
Look at (42) on an evenly spaced grid:
,
take
3-point formulas : Recall that
There are 5-point formulas
(43) is useful at end of interval.
(46) is also useful formula at end of interval.
Higher-order derivatives?
Can use same procedure as above. Another way:
Example Take
Second derivative of
, for example,
found by expanding
and add and solve for
:
Suppose we take into account truncation and round off errors?
Take
case: Let
be computed approximation to
and
In Figure 43 we show the error as a function of
for the
central difference approximation of a smooth function.
|
The table below shows the errors for different values of
. Note that for larger values of
(
) the errors seem to be decreasing by a factor of approximately 100. This is due to the truncation error of the central difference method. As the method is of order
when we decrease
by ten we decrease the error by 100. But as
becomes smaller the round off error of the computer becomes more important and the error starts to increase with decreasing
. This increase is approximately by a factor of 10 with every decrease of
by a factor of 10. This is because the
term is dominating for small values of
. The value of
given in this example is
; the value of
is
.
| Estimated Error | ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|