NAG Library Function Document
nag_zero_cont_func_bd (c05adc) locates a zero of a continuous function in a given interval by a combination of the methods of nonlinear interpolation, linear extrapolation and bisection.
||nag_zero_cont_func_bd (double a,
nag_zero_cont_func_bd (c05adc) attempts to obtain an approximation to a simple zero of the function given an initial interval such that .
to the zero
is determined so that at least one of the following criteria is satisfied:
Brent R P (1973) Algorithms for Minimization Without Derivatives Prentice–Hall
a – doubleInput
On entry: , the lower bound of the interval.
b – doubleInput
On entry: , the upper bound of the interval.
x – double *Output
On exit: the approximation to the zero.
f – function, supplied by the userExternal Function
must evaluate the function
whose zero is to be determined.
The specification of f
xx – doubleInput
On entry: the point at which the function must be evaluated.
xtol – doubleInput
: the termination tolerance on
(see Section 3
ftol – doubleInput
: a value such that if
is accepted as the zero. ftol
may be specified as
(see Section 7
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
On entry, and .
On entry, and have the same sign with neither equalling : and .
The function values in the interval
a pole rather than a zero. Reducing xtol
may help in distinguishing between
a pole and a zero.
On entry, .
No further improvement in the solution is possible.
is too small:
The levels of accuracy depend on the values of xtol
. If full machine accuracy is required, they may be set very small, resulting in an exit with NE_XTOL_TOO_SMALL
, although this may involve many more iterations than a lesser accuracy. You are recommended to set
and to use xtol
to control the accuracy, unless you have considerable knowledge of the size of
for values of
near the zero.
The time taken by nag_zero_cont_func_bd (c05adc) depends primarily on the time spent evaluating f
(see Section 5
This example calculates an approximation to the zero of within the interval using a tolerance of .
9.1 Program Text
Program Text (c05adce.c)
9.2 Program Data
9.3 Program Results
Program Results (c05adce.r)