INTERFACE BrentUniMin; PROCEDURE Minimize( ax: REAL; (* Left endpoint of domain. *) bx: REAL; (* Right endpoint of domain. *) f: Function; (* Function to minimize. *) tol: REAL; (* Desired width of uncertainty interval of result. *) good: GoodProc := NIL; (* Acceptance criterion. *) verbose: BOOLEAN := FALSE; (* TRUE to print diagnostics. *) ): REAL; (* Returns an approximation "x" to the point where "f" attains a minimum on the interval "(ax,bx)". The method used is a combination of golden section search and successive parabolic interpolation. Convergence is never much slower than that for a Fibonacci search. If "f" has a continuous second derivative which is positive at the minimum (which is not at "ax" or "bx"), then convergence is superlinear, and usually of the order of about 1.324.... The function "f" is never evaluated at two points closer together than "eps*abs(fmin)+(tol/3)", where "eps" is approximately the square root of the relative machine precision. If "f" is a unimodal function and the computed values of "f" are always unimodal when separated by at least "eps*abs(x)+(tol/3)", then "fmin" approximates the abcissa of the global minimum of "f" on the interval "(ax,bx)" with an error less than "3*eps*abs(fmin)+tol". If "f" is not unimodal, then "fmin" may approximate a local, but perhaps non-global, minimum to the same accuracy. This function subprogram is a slightly modified version of the algol 60 procedure "localmin" given in Richard Brent, "Algorithms for minimization without derivatives", Prentice-Hall, Inc. (1973). Translated into Modula-3 BY Jorge Stolfi in May-Jul 1994. *) TYPE Function = PROCEDURE (x: REAL): REAL; GoodProc = PROCEDURE (x, fx: REAL): BOOLEAN; END BrentUniMin.