MINF_BRACKET

MINF_BRACKET

Name

MINF_BRACKET

Purpose

Bracket a local minimum of a 1-D function with 3 points,

Explanation

Brackets a local minimum of a 1-d function with 3 points,
thus ensuring that a minimum exists somewhere in the interval.
This routine assumes that the function has a minimum somewhere....
Routine can also be applied to a scalar function of many variables,
for such case the local minimum in a specified direction is bracketed,
This routine is called by minF_conj_grad, to bracket minimum in the
direction of the conjugate gradient of function of many variables
CALLING EXAMPLE:
xa=0 & xb=1
minF_bracket, xa,xb,xc, fa,fb,fc, FUNC_NAME="name" ;for 1-D func.
or:
minF_bracket, xa,xb,xc, fa,fb,fc, FUNC="name", $
POINT=[0,1,1], $
DIRECTION=[2,1,1] ;for 3-D func.

Inputs

xa = scalar, guess for point bracketing location of minimum.
xb = scalar, second guess for point bracketing location of minimum.

Keywords

FUNC_NAME = function name (string)
Calling mechanism should be: F = func_name( px )
where:
px = scalar or vector of independent variables, input.
F = scalar value of function at px.
POINT_NDIM = when working with function of N variables,
use this keyword to specify the starting point in N-dim space.
Default = 0, which assumes function is 1-D.
DIRECTION = when working with function of N variables,
use this keyword to specify the direction in N-dim space
along which to bracket the local minimum, (default=1 for 1-D).
(xa,xb,xc) are then relative distances from POINT_NDIM.

Outputs

xa,xb,xc = scalars, 3 points which bracket location of minimum,
that is, f(xb) < f(xa) and f(xb) < f(xc), so minimum exists.
When working with function of N variables
(xa,xb,xc) are then relative distances from POINT_NDIM,
in the direction specified by keyword DIRECTION,
with scale factor given by magnitude of DIRECTION.

Optional Output

fa,fb,fc = value of function at 3 points which bracket the minimum,
again note that fb < fa and fb < fc if minimum exists.