SciPy.org SciPy 0.6.0 API Documentation Generated by Endo, 2007-10-17

Nonlinear solvers

These solvers find x for which F(x)=0. Both x and F is multidimensional.

They accept the user defined function F, which accepts a python tuple x and it should return F(x), which can be either a tuple, or numpy array.

Example:

def F(x):
"Should converge to x=[0,0,0,0,0]" import numpy d = numpy.array([3,2,1.5,1,0.5]) c = 0.01 return -d*numpy.array(x)-c*numpy.array(x)**3

from scipy import optimize x = optimize.broyden2(F,[1,1,1,1,1])

All solvers have the parameter iter (the number of iterations to compute), some of them have other parameters of the solver, see the particular solver for details.

A collection of general-purpose nonlinear multidimensional solvers.

broyden1 -- Broyden's first method - is a quasi-Newton-Raphson
method for updating an approximate Jacobian and then inverting it
broyden2 -- Broyden's second method - the same as broyden1, but
updates the inverse Jacobian directly
broyden3 -- Broyden's second method - the same as broyden2, but
instead of directly computing the inverse Jacobian, it remembers how to construct it using vectors, and when computing inv(J)*F, it uses those vectors to compute this product, thus avoding the expensive NxN matrix multiplication.
broyden_generalized -- Generalized Broyden's method, the same as broyden2,
but instead of approximating the full NxN Jacobian, it construct it at every iteration in a way that avoids the NxN matrix multiplication. This is not as precise as broyden3.
anderson -- extended Anderson method, the same as the
broyden_generalized, but added w_0^2*I to before taking inversion to improve the stability
anderson2 -- the Anderson method, the same as anderson, but
formulated differently

The broyden2 is the best. For large systems, use broyden3. excitingmixing is also very effective. There are some more solvers implemented (see their docstrings), however, those are of mediocre quality.

Utility Functions

norm -- Returns an L2 norm of the vector

Function summary

Functions

Imported Names

Local nameRefers to
mathmath
numpynumpy