| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The functions described in this chapter compute numerical derivatives by finite differencing. An adaptive algorithm is used to find the best choice of finite difference and to estimate the error in the derivative. These functions are declared in the header file ‘gsl_deriv.h’.
| 27.1 Functions | ||
| 27.2 Examples | ||
| 27.3 References and Further Reading |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This function computes the numerical derivative of the function f at the point x using an adaptive central difference algorithm with a step-size of h. The derivative is returned in result and an estimate of its absolute error is returned in abserr.
The initial value of h is used to estimate an optimal step-size,
based on the scaling of the truncation error and round-off error in the
derivative calculation. The derivative is computed using a 5-point rule
for equally spaced abscissae at
,
,
,
,
, with an error estimate taken from the difference
between the 5-point rule and the corresponding 3-point rule
,
,
. Note that the value of the function at
does not contribute to the derivative calculation, so only 4-points are
actually used.
This function computes the numerical derivative of the function f
at the point x using an adaptive forward difference algorithm with
a step-size of h. The function is evaluated only at points greater
than x, and never at x itself. The derivative is returned in
result and an estimate of its absolute error is returned in
abserr. This function should be used if
has a
discontinuity at x, or is undefined for values less than x.
The initial value of h is used to estimate an optimal step-size,
based on the scaling of the truncation error and round-off error in the
derivative calculation. The derivative at
is computed using an
“open” 4-point rule for equally spaced abscissae at
,
,
,
, with an error estimate taken
from the difference between the 4-point rule and the corresponding
2-point rule
,
.
This function computes the numerical derivative of the function f
at the point x using an adaptive backward difference algorithm
with a step-size of h. The function is evaluated only at points
less than x, and never at x itself. The derivative is
returned in result and an estimate of its absolute error is
returned in abserr. This function should be used if
has a discontinuity at x, or is undefined for values greater than
x.
This function is equivalent to calling gsl_deriv_forward with a
negative step-size.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following code estimates the derivative of the function
at
and at
. The function
is
undefined for
so the derivative at
is computed
using gsl_deriv_forward.
|
Here is the output of the program,
$ ./a.outf(x) = x^(3/2) x = 2.0 f'(x) = 2.1213203120 +/- 0.0000004064 exact = 2.1213203436 x = 0.0 f'(x) = 0.0000000160 +/- 0.0000000339 exact = 0.0000000000 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The algorithms used by these functions are described in the following sources:
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Autobuild on September, 26 2007 using texi2html 1.78.