Package minfx :: Package line_search :: Module interpolate
[hide private]
[frames] | no frames]

Module interpolate

source code

Quadratic and cubic interpolation method.

This file is part of the minfx optimisation library.

Functions [hide private]
 
cubic_int(a, b, fa, fb, ga, gb)
Cubic interpolation using f(a), f(b), g(a), and g(b).
source code
 
cubic_ext(a, b, fa, fb, ga, gb, full_output=0)
Cubic Extrapolation using f(a), f(b), g(a), and g(b).
source code
 
quadratic_fafbga(a, b, fa, fb, ga)
Quadratic interpolation using f(a), f(b), and g(a).
source code
 
quadratic_gagb(a, b, ga, gb)
Quadratic interpolation using g(a) and g(b).
source code
Variables [hide private]
  __package__ = 'minfx.line_search'

Imports: sqrt


Function Details [hide private]

cubic_int(a, b, fa, fb, ga, gb)

source code 

Cubic interpolation using f(a), f(b), g(a), and g(b).

Equations

The equations used are:

   f(a) = a'a**3 + b'a**2 + c'a + d'
   f(b) = a'b**3 + b'b**2 + c'b + d'
   g(a) = 3a'a**2 + 2b'a + c'
   g(b) = 3a'b**2 + 2b'b + c'

Interpolation

The extrema are the roots of the quadratic equation:

   3a'*alpha**2 + 2b'*alpha + c' = 0

The cubic interpolant is given by the formula:

                      g(b) + beta2 - beta1
   ac = b - (b - a) . ---------------------
                      g(b) - g(a) + 2*beta2

where:

                             f(a) - f(b)
   beta1 = g(a) + g(b) - 3 . -----------
                                a - b

   if a < b:

       beta2 = sqrt(beta1**2 - g(a).g(b))

   else:

       beta2 = -sqrt(beta1**2 - g(a).g(b))

cubic_ext(a, b, fa, fb, ga, gb, full_output=0)

source code 

Cubic Extrapolation using f(a), f(b), g(a), and g(b).

Extrapolation

The extrema are the roots of the quadratic equation:

   3a'*alpha**2 + 2b'*alpha + c' = 0

The cubic extrapolant is given by the formula:

                      g(b) + beta2 - beta1
   ac = b - (b - a) . ---------------------
                      g(b) - g(a) + 2*beta2

where:

                             f(a) - f(b)
   beta1 = g(a) + g(b) - 3 . -----------
                                a - b

   if a < b:

       beta2 = sqrt(max(0.0, beta1**2 - g(a).g(b)))

   else:

       beta2 = -sqrt(max(0.0, beta1**2 - g(a).g(b)))

quadratic_fafbga(a, b, fa, fb, ga)

source code 

Quadratic interpolation using f(a), f(b), and g(a).

The extremum of the quadratic is given by:

                1             g(a)
   aq  =  a  +  - . -------------------------
                2   f(a) - f(b) - (a - b)g(a)

quadratic_gagb(a, b, ga, gb)

source code 

Quadratic interpolation using g(a) and g(b).

The extremum of the quadratic is given by:

          bg(a) - ag(b)
   aq  =  -------------
           g(a) - g(b)