![]() |
Institut für Astronomie und AstrophysikAbteilung AstronomieSand 1, D-72076 Tübingen, GermanyNew Address! -- Neue Adresse! |
![]() |
ZBRENT
Find the zero of a 1-D function up to specified tolerance.
This routine assumes that the function is known to have a zero.
Adapted from procedure of the same name in "Numerical Recipes" by
Press et al. (1992), Section 9.3
x_zero = ZBRENT( x1, x2, FUNC_NAME="name", MaX_Iter=, Tolerance= )
x1, x2 = scalars, 2 points which bracket location of function zero,
that is, F(x1) < 0 < F(x2).
Note: computations are performed with
same precision (single/double) as the inputs and user supplied function.
FUNC_NAME = function name (string)
Calling mechanism should be: F = func_name( px )
where: px = scalar independent variable, input.
F = scalar value of function at px,
should be same precision (single/double) as input.
MAX_ITER = maximum allowed number iterations, default=100.
TOLERANCE = desired accuracy of minimum location, default = 1.e-3.
Returns the location of zero, with accuracy of specified tolerance.
Brent's method to find zero of a function by using bracketing,
bisection, and inverse quadratic interpolation,
Find the root of the COSINE function between 1. and 2. radians
IDL> print, zbrent( 1, 2, FUNC = 'COS')
and the result will be !PI/2 within the specified tolerance
Written, Frank Varosi NASA/GSFC 1992.
FV.1994, mod to check for single/double prec. and set zeps accordingly.
Converted to IDL V5.0 W. Landsman September 1997
Use MACHAR() to define machine precision W. Landsman September 2002
[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]