goldensearch function

Golden Section Search Algorithm

Golden Section Search Algorithm

Minimising a continuous univariate function using the golden section search algorithm.

goldensearch(fn, interval, tol = 1)

Arguments

  • fn: the function; should be scalar valued
  • interval: a vector containing the lower and upper bounds of search
  • tol: tolerance level for convergence

Returns

a list of objects

  • k: minimiser
  • value: mimimum value
  • iter: number of iterations before convergence
  • iterfn: number of function evaluations

Examples

fn = function(x) (x-1)^2; goldensearch(fn=fn,interval=c(-2,3),tol=1)
  • Maintainer: Emmanuel S Tsyawo
  • License: GPL-2
  • Last published: 2019-06-04

Useful links