SciPy

scipy.optimize.fminbound

scipy.optimize.fminbound(func, x1, x2, args=(), xtol=1e-05, maxfun=500, full_output=0, disp=1)[source]

Bounded minimization for scalar functions.

Parameters
funccallable f(x,*args)

Objective function to be minimized (must accept and return scalars).

x1, x2float or array scalar

The optimization bounds.

argstuple, optional

Extra arguments passed to function.

xtolfloat, optional

The convergence tolerance.

maxfunint, optional

Maximum number of function evaluations allowed.

full_outputbool, optional

If True, return optional outputs.

dispint, optional
If non-zero, print messages.

0 : no message printing. 1 : non-convergence notification messages only. 2 : print a message on convergence too. 3 : print iteration results.

Returns
xoptndarray

Parameters (over given interval) which minimize the objective function.

fvalnumber

The function value at the minimum point.

ierrint

An error flag (0 if converged, 1 if maximum number of function calls reached).

numfuncint

The number of function calls made.

See also

minimize_scalar

Interface to minimization algorithms for scalar univariate functions. See the ‘Bounded’ method in particular.

Notes

Finds a local minimizer of the scalar function func in the interval x1 < xopt < x2 using Brent’s method. (See brent for auto-bracketing).

Examples

fminbound finds the minimum of the function in the given range. The following examples illustrate the same

>>> def f(x):
...     return x**2
>>> from scipy import optimize
>>> minimum = optimize.fminbound(f, -1, 2)
>>> minimum
0.0
>>> minimum = optimize.fminbound(f, 1, 2)
>>> minimum
1.0000059608609866

Previous topic

scipy.optimize.fmin_slsqp

Next topic

scipy.optimize.brent