e04bb {NAGFWrappers} | R Documentation |
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).
e04bb(funct, e1, e2, a, b, maxcal)
funct |
function You must supply this function to calculate the values of F(x) and (dF)/(dx) at any point x in [ab].
|
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 2ε. |
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. |
R interface to the NAG Fortran routine E04BBF.
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 =0unless the function detects an error or a warning has been flagged (see the Errors section in Fortran library documentation). |
NAG
http://www.nag.co.uk/numeric/FL/nagdoc_fl23/pdf/E04/e04bbf.pdf
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)