e04ab {NAGFWrappers}R Documentation

e04ab: Minimum, function of one variable using function values only

Description

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).

Usage

e04ab(funct, e1, e2, a, b, maxcal)

Arguments

funct

function

You must supply this function to calculate the value of the function F(x) at any point x in [ab]. It should be tested separately before being used in conjunction with e04ab.

(FC) = funct(xc)

e1

double

The relative accuracy to which the position of a minimum is required. (Note that, since e1 is a relative tolerance, the scaling of x is automatically taken into account.)

e2

double

The absolute accuracy to which the position of a minimum is required. e2 should be no smaller than .

a

double

The lower bound a of the interval containing a minimum.

b

double

The upper bound b of the interval containing a minimum.

maxcal

integer

The maximum number of calls of F(x) to be allowed.

Details

R interface to the NAG Fortran routine E04ABF.

Value

E1

double

If you set e1 to 0.0 (or to any value less than ε), e1will be reset to the default value sqrt(ε) before starting the minimization process.

E2

double

If you set e2 to 0.0 (or to any value less than ε), e2 will be reset to the default value sqrt(ε).

A

double

An improved lower bound on the position of the minimum.

B

double

An improved upper bound on the position of the minimum.

MAXCAL

integer

The total number of times that funct was actually called.

X

double

The estimated position of the minimum.

F

double

The function value at the final point given in x.

IFAIL

integer

ifail =0

unless the function detects an error or a warning has been flagged (see the Errors section in Fortran library documentation).

Author(s)

NAG

References

http://www.nag.co.uk/numeric/FL/nagdoc_fl23/pdf/E04/e04abf.pdf

Examples


ifail <- 0
funct = function(xc) {
    
    fc <- sin(xc)/xc
    list(FC = fc)
}

e1 <- 0

e2 <- 0

a <- 3.5

b <- 5

maxcal <- 30

e04ab(funct, e1, e2, a, b, maxcal) 


[Package NAGFWrappers version 24.0 Index]