e04bb {NAGFWrappers}R Documentation

e04bb: Minimum, function of one variable, using first derivative

Description

e04bb searches for a minimum, in a given finite interval, of a continuous function of a single variable, using function and first derivative values. The method (based on cubic interpolation) is intended for functions which have a continuous first derivative (although it will usually work if the derivative has occasional discontinuities).

Usage

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

Arguments

funct

function

You must supply this function to calculate the values of F(x) and (dF)/(dx) at any point x in [ab].

(FC,GC) = 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 funct to be allowed.

Details

R interface to the NAG Fortran routine E04BBF.

Value

E1

double

If you set e1 to 0.0 (or to any value less than ε), e1 will 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.

G

double

The value of the first derivative at the final point 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/e04bbf.pdf

Examples


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

e1 <- 0

e2 <- 0

a <- 3.5

b <- 5

maxcal <- 30

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


[Package NAGFWrappers version 24.0 Index]