Chris Beaumont's IDL Library

Download source code

single page | use frames     summary     class     fields     routine details     file attributes

nr/

brent.pro

This function minimizes a function of one variable. The function requires 3 input abscissas which bracket at least one local minimum (see, e.g. bracket.pro)

The algorithm is adapted from Numerical Recipes, but is substantially modified in an attempt to simplify the procedure. This may make the program slower, but I don't think it should be any less stable.

The program attempts to improve upon goldenmin by using parabolic extrapolation in the vicinity of the minimum. If the function is smooth, then this should quickly converge. If it seems that parabolic extrapolation isn't behaving well, then it defaults to a goldenmin style partitioning of (abc) into golden sections. This ensures convergence.

The biggest change from the routine in Numerical Recipes is the test for when to use parabolic extrapolation. The default state is to use parabolic extrapolation if the extrapolated minimum is interior to (a,c). However, if the range of (a,c) decreases by less than a factor of 1.5 in any iteration, then the algorithm is 'punished', and parabolic extrapolation is not used for a round. The value of 1.5 is used because the goldenmin style of partitioning shrinks (a,c) by about 1.67 per iteration. For smooth functions, typical shrinkages seem to be >2 per iteration. They can be as high as several thousand for nearly parabolic functions.

topbrent

result = brent(func, ax, bx, cx, fax, fbx, fcx, tol=tol, verbose=verbose, fmin=fmin, _extra=_extra, plot=plot, golden=golden)

Parameters

func
ax
bx
cx
fax
fbx
fcx

Keywords

tol
verbose
fmin
_extra
plot
golden

File attributes

Modifcation date: Mon Aug 9 19:41:59 2010
Lines: 232