﻿FunctionMath.FindMinimum Method (Func(Double, Double), Double, ExtremumSettings)

Minimizes a function in the vicinity of a given point subject to the given evaluation settings.

Namespace:  Meta.Numerics.Analysis
Assembly:  Meta.Numerics (in Meta.Numerics.dll) Version: 4.1.4
Syntax
```public static Extremum FindMinimum(
Func<double, double> f,
double x,
ExtremumSettings settings
)```

#### Parameters

f
Type: SystemFuncDouble, Double
The function.
x
Type: SystemDouble
A point suspected to be near the minimum. The search begins at this point.
settings
Type: Meta.Numerics.AnalysisExtremumSettings
The settings to use when searching for the minimum.

#### Return Value

Type: Extremum
The minimum.
Exceptions
ExceptionCondition
ArgumentNullExceptionf is null or settings is null.
NonconvergenceExceptionMore than the maximum allowed number of function evaluations occurred without a minimum being determined to the prescribed precision.
Remarks

When you supply settings, note that the supplied RelativePrecision and AbsolutePrecision values refer to argument (i.e. x) values, not function (i.e. f) values. Note also that, for typical functions, the best attainable relative precision is of the order of the square root of machine precision (about 10-7), i.e. half the number of digits in a Double. This is because to identify an extremum we need to resolve changes in the function value, and near an extremum δf ∼ (δx)2, so changes in the function value δf ∼ ε correspond to changes in the argument value δx ∼ √ε. If you supply zero values for both precision settings, the method will adaptively approximate the best attainable precision for the supplied function and locate the extremum to that resolution. This is our suggested practice unless you know that you require a less precise determination.

Since the search algorithm begins by evaluating f at points near x, it can fail if x is near a singularity or other point at which the evaluation of f could fail. If you can reliably bracket an extremum, the FindMinimum(FuncDouble, Double, Interval, ExtremumSettings) overload of this method is safer and, if your bracket is any good, usually slightly faster.