e04ab searches for a minimum, in a given finite interval, of a continuous function of a single variable, using function values only. The method (based on quadratic interpolation) is intended for functions which have a continuous first derivative (although it will usually work if the derivative has occasional discontinuities).
Public Shared Sub e04ab ( _ funct As E04..::..E04AB_FUNCT, _ ByRef e1 As Double, _ ByRef e2 As Double, _ ByRef a As Double, _ ByRef b As Double, _ ByRef maxcal As Integer, _ <OutAttribute> ByRef x As Double, _ <OutAttribute> ByRef f As Double, _ <OutAttribute> ByRef ifail As Integer _ )
public: static void e04ab( E04..::..E04AB_FUNCT^ funct, double% e1, double% e2, double% a, double% b, int% maxcal, [OutAttribute] double% x, [OutAttribute] double% f, [OutAttribute] int% ifail )
- Type: NagLibrary..::..E04..::..E04AB_FUNCTYou must supply this method to calculate the value of the function at any point in . It should be tested separately before being used in conjunction with e04ab.
A delegate of type E04AB_FUNCT.
- Type: System..::..Double%On entry: the relative accuracy to which the position of a minimum is required. (Note that, since e1 is a relative tolerance, the scaling of is automatically taken into account.)e1 should be no smaller than , and preferably not much less than , where is the machine precision.
- Type: System..::..Double%On entry: the absolute accuracy to which the position of a minimum is required. e2 should be no smaller than .
- Type: System..::..Double%On entry: the lower bound of the interval containing a minimum.On exit: an improved lower bound on the position of the minimum.
- Type: System..::..Double%On entry: the upper bound of the interval containing a minimum.On exit: an improved upper bound on the position of the minimum.
- Type: System..::..Int32%On entry: the maximum number of calls of to be allowed.Constraint: . (Few problems will require more than .)On exit: the total number of times that funct was actually called.
- Type: System..::..Double%On exit: the estimated position of the minimum.
e04ab is applicable to problems of the form:
It normally computes a sequence of values which tend in the limit to a minimum of subject to the given bounds. It also progressively reduces the interval in which the minimum is known to lie. It uses the safeguarded quadratic-interpolation method described in Gill and Murray (1973).
You must supply a funct to evaluate . The parameters e1 and e2 together specify the accuracy
to which the position of the minimum is required. Note that funct is never called at any point which is closer than to a previous point.
If the original interval contains more than one minimum, e04ab will normally find one of the minima.
Gill P E and Murray W (1973) Safeguarded steplength algorithms for optimization using descent methods NPL Report NAC 37 National Physical Laboratory
Note: e04ab may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the method:
On entry, , or ,
- The number of calls of funct has exceeded maxcal. This may have happened simply because maxcal was set too small for a particular problem, or may be due to a mistake in funct. If no mistake can be found in funct, restart e04ab (preferably with the values of a and b given on exit from the previous call of e04ab).
If is -unimodal for some , where , then, on exit, approximates the minimum of in the original interval with an error less than .
Timing depends on the behaviour of , the accuracy demanded and the length of the interval . Unless can be evaluated very quickly, the run time will usually be dominated by the time spent in funct.
If has more than one minimum in the original interval , e04ab will determine an approximation (and improved bounds and ) for one of the minima.
A sketch of the function
shows that it has a minimum somewhere in the range . The following program shows how e04ab can be used to obtain a good approximation to the position of a minimum.