Minimisation

Introduction

This module provides functions for numerical minimisation of univariate and multivariate functions, $R^n \to R$.

API

NumericalMethods.Min.brentMethod

This code, drawn from Numerical Recipes, implements Brent's method (without derivative) to minimize the function f.

Arguments

  • f::Function: The function to minimize.
  • ax::Real: The lower bound of the interval to search.
  • bx::Real: The middle bound of the interval to search. Must satisfy f(ax) > f(bx) and f(cx) > f(bx).
  • cx::Real: The upper bound of the interval to search.
  • atol::Real=1e-6: The absolute tolerance for the minimum.
  • rtol::Real=1e-6: The relative tolerance for the minimum.
  • max_iter::Integer=1000: The maximum number of iterations to perform.

Returns

  • xmin: The minimum argument of f.
  • fmin: The value of f at the xmin.
  • niter: The number of iterations performed.
source
NumericalMethods.Min.newtonMethod
newton(f, x_0, δ; atol=1e-6, rtol=1e-6, max_iter=1000)

Find the minima of the function f starting at x_0 using Newton's method and numerical differentiation.

Arguments

  • f::Function: The function to minimize.
  • x_0::AbstractVector{<:Real}: The initial guess.
  • δ::Real: The step size for the numerical derivative.
  • atol::Real=1e-6: The absolute tolerance for the minimum.
  • rtol::Real=1e-6: The relative tolerance for the minimum.
  • max_iter::Integer=1000: The maximum number of iterations to perform.

Returns

  • xmin: The minimum argument of f.
  • fmin: The value of f at xmin.
  • niter: The number of iterations performed.
source
NumericalMethods.Min.newtonMethod
newton(f, x_0; atol=1e-6, rtol=1e-6, max_iter=1000)

Find the minima of the function f: R^n → R starting at x_0 using Newton's method and automatic differentiation.

Arguments

  • f::Function: The function to minimize.
  • x_0::AbstractVector{<:Real}: The initial guess.
  • atol::Real=1e-6: The absolute tolerance for the minimum.
  • rtol::Real=1e-6: The relative tolerance for the minimum.
  • max_iter::Integer=1000: The maximum number of iterations to perform.

Returns

  • xmin: The minimum argument of f.
  • fmin: The value of f at xmin.
  • niter: The number of iterations performed.
source
NumericalMethods.Min.newtonMethod
newton(f, x_0, δ; atol=1e-6, rtol=1e-6, max_iter=1000)

Find the minima of the function f starting at x_0 using Newton's method.

Arguments

  • f::Function: The function to minimize.
  • x_0::Real: The initial guess.
  • δ::Real: The step size for the numerical derivative.
  • atol::Real=1e-6: The absolute tolerance for the minimum.
  • rtol::Real=1e-6: The relative tolerance for the minimum.
  • max_iter::Integer=1000: The maximum number of iterations to perform.

Returns

  • xmin: The minimum argument of f.
  • fmin: The value of f at xmin.
  • niter: The number of iterations performed.
source
NumericalMethods.Min.newtonMethod
newton(f, x_0; atol=1e-6, rtol=1e-6, max_iter=1000)

Find the minima of the function f: R → R starting at x_0 using Newton's method and automatic differentiation.

Arguments

  • f::Function: The function to minimize.
  • x_0::Real: The initial guess.
  • atol::Real=1e-6: The absolute tolerance for the minimum.
  • rtol::Real=1e-6: The relative tolerance for the minimum.
  • max_iter::Integer=1000: The maximum number of iterations to perform.

Returns

  • xmin: The minimum argument of f.
  • fmin: The value of f at xmin.
  • niter: The number of iterations performed.
source