c05au locates a simple zero of a continuous function from a given starting value. It uses a binary search to locate an interval containing a zero of the function, then Brent's method, which is a combination of nonlinear interpolation, linear extrapolation and bisection, to locate the zero precisely.
Syntax
C# |
---|
public static void c05au( ref double x, double h, double eps, double eta, C05..::..C05AU_F f, out double a, out double b, out int ifail ) |
Visual Basic |
---|
Public Shared Sub c05au ( _ ByRef x As Double, _ h As Double, _ eps As Double, _ eta As Double, _ f As C05..::..C05AU_F, _ <OutAttribute> ByRef a As Double, _ <OutAttribute> ByRef b As Double, _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void c05au( double% x, double h, double eps, double eta, C05..::..C05AU_F^ f, [OutAttribute] double% a, [OutAttribute] double% b, [OutAttribute] int% ifail ) |
F# |
---|
static member c05au : x : float byref * h : float * eps : float * eta : float * f : C05..::..C05AU_F * a : float byref * b : float byref * ifail : int byref -> unit |
Parameters
- x
- Type: System..::..Double%On entry: an initial approximation to the zero.
- h
- Type: System..::..DoubleOn entry: a step length for use in the binary search for an interval containing the zero. The maximum interval searched is .Constraint: must be sufficiently large that on the computer.
- eps
- Type: System..::..DoubleOn entry: the termination tolerance on (see [Description]).Constraint: .
- eta
- Type: System..::..DoubleOn entry: a value such that if , is accepted as the zero. eta may be specified as (see [Accuracy]).
- f
- Type: NagLibrary..::..C05..::..C05AU_Ff must evaluate the function whose zero is to be determined.
A delegate of type C05AU_F.
- a
- Type: System..::..Double%On exit: the lower and upper bounds respectively of the interval resulting from the binary search. If the zero is determined exactly such that or is determined so that at any stage in the calculation, then on exit .
- b
- Type: System..::..Double%On exit: the lower and upper bounds respectively of the interval resulting from the binary search. If the zero is determined exactly such that or is determined so that at any stage in the calculation, then on exit .
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
c05au attempts to locate an interval containing a simple zero of the function by a binary search starting from the initial point and using repeated calls to c05av. If this search succeeds, then the zero is determined to a user-specified accuracy by a call to c05ay. The specifications of methods c05av and c05ay should be consulted for details of the methods used.
The approximation to the zero is determined so that at least one of the following criteria is satisfied:
(i) | , |
(ii) | . |
References
Brent R P (1973) Algorithms for Minimization Without Derivatives Prentice–Hall
Error Indicators and Warnings
Errors or warnings detected by the method:
-
On entry, .
Constraint: .On entry, and .
Constraint: (to machine accuracy).
-
Solution may be a pole rather than a zero.
Accuracy
The levels of accuracy depend on the values of eps and eta. If full machine accuracy is required, they may be set very small, resulting in an exit with , although this may involve many more iterations than a lesser accuracy. You are recommended to set and to use eps to control the accuracy, unless you have considerable knowledge of the size of for values of near the zero.
Parallelism and Performance
None.
Further Comments
The time taken by c05au depends primarily on the time spent evaluating f (see [Parameters]). The accuracy of the initial approximation x and the value of h will have a somewhat unpredictable effect on the timing.
If it is important to determine an interval of relative length less than containing the zero, or if f is expensive to evaluate and the number of calls to f is to be restricted, then use of c05av followed by c05az is recommended. Use of this combination is also recommended when the structure of the problem to be solved does not permit a simple f to be written: the reverse communication facilities of these methods are more flexible than the direct communication of f required by c05au.
If the iteration terminates with successful exit and there is no guarantee that the value returned in x corresponds to a simple zero and you should check whether it does.
Example
This example calculates an approximation to the zero of using a tolerance of starting from and using an initial search step .