XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ dfmin_r()

void dfmin_r ( double  a,
double  b,
double  tol,
double *  xx,
double  yy,
int *  irev 
)

Minimum of a single variable general nonlinear function (reverse communication version)

Purpose
dfmin_r finds a minimum of a function f(x) between the given values a and b.

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 the function f has a continuous second derivative which is positive at the minimum (which is not at a or b), 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(dfmin) + (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(xstar) + (tol/3), then dfmin approximates the abscissa of the global minimum of f on the interval [a, b] with an error less than 3*eps*abs(dfmin) + tol. If f is not unimodal, then dfmin may approximate a local, but perhaps non-global, minimum to the same accuracy.
Parameters
[in]aLeft endpoint of initial interval.
[in]bRight endpoint of initial interval.
[in]tolDesired length of the interval of uncertainty of the final result. (tol >= 0)
[out]xxirev = 0: The abscissa approximating the point where f(x) attains a minimum on the interval [a, b].
irev = 1 or 2: The abscissa where the function value shoule be evaluated and given in the next call.
[in]yyirev = 1 or 2: The function value f(xx) should be given in yy in the next call.
[in,out]irevControl variable for reverse communication.
[in] Before first call, irev should be initialized to zero. On succeeding calls, irev should not be altered.
[out] If irev is not zero, complete the following process and call this routine again.
= 0: Computation finished.
= 1 or 2: User should set the function values at xx in yy. Do not alter any variables other than yy.
Reference
D. Kahaner, C. Moler, S. Nash, "Numerical Methods and Software", Prentice-Hall (1989)