fminbnd(f, x1, x2, ..., minimize = TRUE, tol = .Machine$double.eps^(2/3))
fminbnd
may only give local solutions.
fminbnd
never evaluates fun at the endpoints.
fibsearch
, golden_ratio
fminbnd(cos, 3, 4) # x = 3.141593 , fval = -1
f <- function(x) x^3-2*x-5
fminbnd(f, 0, 2) # x = 0.8164966 , fval = -6.088662
Run the code above in your browser using DataLab