Optimization and root finding (scipy.optimize)



fmin (func, x0[, args=(), xtol, ftol, ...]) Minimize a function using the downhill simplex algorithm.
fmin_powell (func, x0[, args=(), xtol, ftol, ...]) Minimize a function using modified Powell’s method.
fmin_cg (f, x0[, fprime, args=(), ...]) Minimize a function using a nonlinear conjugate gradient algorithm.
fmin_bfgs (f, x0[, fprime, args=(), ...]) Minimize a function using the BFGS algorithm.
fmin_ncg (f, x0, fprime[, fhess_p, fhess, ...]) Minimize a function using the Newton-CG method.
leastsq (func, x0[, args=(), Dfun, full_output, ...]) Minimize the sum of squares of a set of equations.

Constrained (multivariate)

fmin_l_bfgs_b (func, x0[, fprime, args=(), ...])
Minimize a function func using the L-BFGS-B algorithm.
fmin_tnc (func, x0[, fprime, args=(), ...]) Minimize a function with variables subject to bounds, using gradient information.
fmin_cobyla (func, x0, cons[, args=(), consargs, ...]) Minimize a function using the Constrained Optimization BY Linear Approximation (COBYLA) method
nnls (A, b)
Solve || Ax - b ||_2 -> min with x>=0


anneal (func, x0[, args=(), schedule, ...]) Minimize a function using simulated annealing.
brute (func, ranges[, args=(), Ns, full_output, ...]) Minimize a function over a given range by brute force.

Scalar function minimizers

fminbound (func, x1, x2[, args=(), xtol, maxfun, ...]) Bounded minimization for scalar functions.
golden (func[, args=(), brack, ...]) Given a function of one-variable and a possible bracketing interval, return the minimum of the function isolated to a fractional precision of tol.
bracket (func[, xa, xb, args=(), ...]) Given a function and distinct initial points, search in the downhill direction (as defined by the initital points) and return new points xa, xb, xc that bracket the minimum of the function f(xa) > f(xb) < f(xc). It doesn’t always mean that obtained solution will satisfy xa<=x<=xb
brent (func[, args=(), brack, ...]) Given a function of one-variable and a possible bracketing interval, return the minimum of the function isolated to a fractional precision of tol.

Root finding

fsolve (func, x0[, args=(), fprime, ...]) Find the roots of a function.

Scalar function solvers

brentq (f, a, b[, args=(), xtol, rtol, ...]) Find a root of a function in given interval.
brenth (f, a, b[, args=(), xtol, rtol, ...]) Find root of f in [a,b].
ridder (f, a, b[, args=(), xtol, rtol, ...]) Find a root of a function in an interval.
bisect (f, a, b[, args=(), xtol, rtol, ...]) Find root of f in [a,b].
newton (func, x0[, fprime, args=(), ...]) Given a function of a single variable and a starting point, find a nearby zero using Newton-Raphson.

Fixed point finding:

fixed_point (func, x0[, args=(), xtol, maxiter]) Find the point where func(x) == x

General-purpose nonlinear (multidimensional)

broyden1 (F, xin[, iter, alpha, verbose]) Broyden’s first method.
broyden2 (F, xin[, iter, alpha, verbose]) Broyden’s second method.
broyden3 (F, xin[, iter, alpha, verbose]) Broyden’s second method.
broyden_generalized (F, xin[, iter, alpha, M, ...]) Generalized Broyden’s method.
anderson (F, xin[, iter, alpha, M, ...]) Extended Anderson method.
anderson2 (F, xin[, iter, alpha, M, ...]) Anderson method.

Utility Functions

line_search (f, myfprime, xk, pk, gfk, old_fval, old_old_fval[, args=(), c1, c2, ...]) Find alpha that satisfies strong Wolfe conditions.
check_grad (func, grad, x0, *args)