fibsearch.RdFibonacci search for function minimum.
fibsearch(f, a, b, ..., endp = FALSE, tol = .Machine$double.eps^(1/2))Fibonacci search for a univariate function minimum in a bounded interval.
Return a list with components xmin, fmin,
the function value at the minimum, niter, the number of iterations
done, and the estimated precision estim.prec
f <- function(x) x * cos(0.1*exp(x)) * sin(0.1*pi*exp(x))
fibsearch(f, 0, 4, tol=10^-10) # $xmin = 3.24848329403424
#> $xmin
#> [1] 3.248483
#>
#> $fmin
#> [1] -2.665089
#>
#> $niter
#> [1] 51
#>
#> $estim.prec
#> [1] 6.955103e-11
#>
optimize(f, c(0,4), tol=10^-10) # $minimum = 3.24848328971188
#> $minimum
#> [1] 3.248483
#>
#> $objective
#> [1] -2.665089
#>