c05ay locates a simple zero of a continuous function in a given interval using Brent's method, which is a combination of nonlinear interpolation, linear extrapolation and bisection.
Syntax
C# |
---|
public static void c05ay( double a, double b, double eps, double eta, C05..::..C05AY_F f, out double x, out int ifail ) |
Visual Basic |
---|
Public Shared Sub c05ay ( _ a As Double, _ b As Double, _ eps As Double, _ eta As Double, _ f As C05..::..C05AY_F, _ <OutAttribute> ByRef x As Double, _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void c05ay( double a, double b, double eps, double eta, C05..::..C05AY_F^ f, [OutAttribute] double% x, [OutAttribute] int% ifail ) |
F# |
---|
static member c05ay : a : float * b : float * eps : float * eta : float * f : C05..::..C05AY_F * x : float byref * ifail : int byref -> unit |
Parameters
- a
- Type: System..::..DoubleOn entry: , the lower bound of the interval.
- b
- Type: System..::..DoubleOn entry: , the upper bound of the interval.Constraint: .
- 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..::..C05AY_Ff must evaluate the function whose zero is to be determined.
A delegate of type C05AY_F.
- x
- Type: System..::..Double%
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
c05ay attempts to obtain an approximation to a simple zero of the function given an initial interval such that .
The same core algorithm is used by c05az whose specification should be consulted for details of the method 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, and .
Constraint: .On entry, .
Constraint: .On entry, and have the same sign with neither equalling : and .
-
The function values in the interval might contain a pole rather than a zero. Reducing eps may help in distinguishing between a pole and 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
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 c05az is recommended. Use of c05az 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 c05az are more flexible than the direct communication of f required by c05ay.
Example
This example calculates an approximation to the zero of within the interval using a tolerance of .