next up previous index
Next: C207 Roots of Up: CERNLIB Previous: C202 Zeros of

C205 Zero of a Function of One Real Variable

Routine ID: C205
Author(s): T. PomentaleLibrary: MATHLIB
Submitter: K.S. KölbigSubmitted: 20.04.1970
Language: FortranRevised: 15.03.1993

Subroutine subprograms RZERO and DZERO compute, to an attempted specified accuracy, a zero of a real-valued function f(x) lying in a given interval [a,b] , where f(a)*f(b)≤0 .

On CDC and Cray computers, the double-precision version DZERO is not available.

Structure:

SUBROUTINE subprograms
User Entry Names: RZERO, DZERO
Files Referenced: Unit 6
External References: MTLMTR (N002), ABEND (Z035), user-supplied FUNCTION subprogram

Usage:

For t=R (type REAL), t=D (type DOUBLE PRECISION),

    CALL tZERO(A,B,X0,R,EPS,MAXF,F)
A,B
(type according to t) On entry, A and B must specify the end-points of the search interval. Unchanged on exit.
X0
(type according to t) On exit, X0 is the computed approximation to a zero x0 of the function f(x) .
R
(type according to t) On exit, the value of R is such that X0 -x0< R, unless an error condition is detected (see Error Handling).
EPS
(type according to t) On entry, EPS must be equal to the accuracy parameter (see Accuracy). Unchanged on exit.
MAXF
( INTEGER) On entry, MAXF must be equal to the maximum permitted number of references to the function F within the iteration loop. Unchanged on exit.
F
(type according to t) Name of a user-supplied FUNCTION subprogram, declared EXTERNAL in the calling program.
The user-supplied function subprogram F must be of the form FUNCTION F(X,I) and must set F(X)= f(X) . The INTEGER argument I is set by RZERO before each reference to F as follows:
I=1 First reference.
I=2 Subsequent references.
I=3 Final reference, before a normal (R>0 ) exit.

Method:

A mixed strategy is used, based on the Muller method of parabolic interpolation supplemented by bisection.

Accuracy:

The routine tries to compute a value X0 such that |X0- x0| ≤(1 + X0) * EPS.

If this accuracy is obtained with fewer than MAXF references to the function F within the iteration loop, the subroutine exits with R positive.

Error handling:

Error C205.1: F(A,1)*F(B,1) > 0 . X0 is set equal to zero and R is set equal to -2|B-A| .
Error C205.2: The number of calls to F exceeds MAXF. X0 is set equal to zero and R is set to -|B-A|/2 .
A message is written on Unit 6, unless subroutine MTLSET (N002) has been called.

C207



next up previous index
Next: C207 Roots of Up: CERNLIB Previous: C202 Zeros of


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995