D401: Numerical Differentiation

Author(s): K.S. Kölbig Library: MATHLIB
Submitter: Submitted: 15.02.1989
Language: Fortran Revised: 01.12.1994

Subroutine subprograms RDERIV and DDERIV compute an approximate numerical value of the derivative f'(x) of a function f(x) at a specified point x.

On computers other than CDC and Cray, only the double-precision version DDERIV is available. On CDC and Cray computers, only the single-precision version RDERIV is available.

Structure:

SUBROUTINE subprograms
User Entry Names : RDERIV, DDERIV
Obsolete User Entry Names: DERIV tex2html_wrap_inline116 RDERIV
Files Referenced : Unit 6
External References: MTLMTR, ABEND, user-supplied FUNCTION subprogram

Usage:

For tex2html_wrap_inline118 (type REAL), tex2html_wrap_inline120 (type DOUBLE PRECISION),

    CALL tDERIV(F,X,DELTA,DFDX,RERR)
F
(type according to t) Name of a user-supplied FUNCTION subprogram, declared EXTERNAL in the calling program. This subprogram must set tex2html_wrap_inline122 .
X
(type according to t) The specified point x for which the derivative is to be calculated.
DELTA
(type according to t) On entry, DELTA must contain a scaling factor tex2html_wrap_inline126 , which can usually be set equal to 1. On exit, it contains the last value of this factor (see Method).
DFDX
(type according to t) On exit, DFDX contains an approximation to tex2html_wrap_inline128 .
RERR
(type according to t) On exit, RERR contains an estimate of the relative error of DFDX.

Method:

The method is based on an extension to numerical differentiation of Romberg's principle of sequence extrapolation, originally developed for numerical integration. The subroutine starts by computing the 10 numbers

displaymath130

with

displaymath132

where the scaling factor tex2html_wrap_inline134 is initially set to DELTA. This procedure is repeated up to 9 times, with tex2html_wrap_inline136 replaced by tex2html_wrap_inline138 each time, until the sequence tex2html_wrap_inline140 is found to be monotone. A Romberg-like triangular table

displaymath142

with appropriate weights tex2html_wrap_inline144 is then computed for tex2html_wrap_inline146 and DFDX is set equal to tex2html_wrap_inline148 .

Restrictions:

The function f(x) must be differentiable at tex2html_wrap_inline152 and in a neighbourhood of X. Misleading results will be obtained if this is not true.

Error handling:

Error D401.1: If the function f(x) is such that, after 9 successive reductions of tex2html_wrap_inline156 by a factor 1/10, the sequence tex2html_wrap_inline158 is not monotone, an error message is written Unit 6, unless subroutine MTLSET (N002) has been called. DFDX is set equal to zero, RERR is set equal to one in this case.

References:

  1. H. Rutishauser, Ausdehnung des Rombergschen Prinzips, Numer. Math. 5 (1963) 48-54.
tex2html_wrap_inline160

Michel Goossens Wed Jun 5 00:43:01 METDST 1996