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

◆ dfmin()

double dfmin ( double  a,
double  b,
double(*)(double)  f,
double  tol 
)

Minimum of a single variable general nonlinear function

Purpose
dfmin 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.
Returns
Abscissa approximating the point where f(x) attains a minimum on the interval [a, b].
Parameters
[in]aLeft endpoint of initial interval.
[in]bRight endpoint of initial interval.
[in]fUser supplied function, which evaluates f(x) defined as follows:
double f(double x)
{
return (computed function value f(x));
}
[in]tolDesired length of the interval of uncertainty of the final result. (tol >= 0)
Reference
D. Kahaner, C. Moler, S. Nash, "Numerical Methods and Software", Prentice-Hall (1989)