NMath User's Guide

TOC | Previous | Next | Index

Chapter 26. Minimizing Univariate Functions (.NET, C#, CSharp, VB, Visual Basic, F#)

NMath provides classes for minimizing univariate functions using golden section search and Brent's method. Minimization is the process of finding the value of the variable x within some interval where f(x) takes on a minimum value. (To maximize a function f, simply minimize -f.)

All NMath minimization classes derive from the abstract base class MinimizerBase, which provides Tolerance and MaxIterations properties. In general, minimization stops when either the decrease in function value is less than the tolerance, or the maximum number of iterations is reached. Setting the error tolerance to less than zero ensures that the maximum number of iterations is always reached. After minimization, the following properties on MinimizerBase can be useful for gathering more information about the minimum just computed:

Error gets the error associated with the mimimum just computed.

ToleranceMet returns a boolean value indicating whether the minimum just computed stopped because the error tolerance was reached.

MaxIterationsMet returns a boolean value indicating whether the minimum just computed stopped because the maximum number of iterations was reached.

The univariate minimization classes also implement one of the following interfaces:

Classes that implement the IOneVariableMinimizer interface require only function evaluations to minimize a function.

Classes that implement the IOneVariableDMinimizer interface also require evaluations of the derivative of a function.

This chapter describes how to use the univariate minimizer classes.


Top

Top