SciPy 0.6.0 API Documentation Generated by Endo, 2007-10-17
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:
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
Extended Anderson method.
Computes an approximation to the inverse Jacobian from the last M interations. Avoids NxN matrix multiplication, it only has MxM matrix multiplication and inversion.
M=0 .... linear mixing M=1 .... Anderson mixing with 2 iterations M=2 .... Anderson mixing with 3 iterations etc. optimal is M=5
Anderson method.
M=0 .... linear mixing M=1 .... Anderson mixing with 2 iterations M=2 .... Anderson mixing with 3 iterations etc. optimal is M=5
Broyden's first method. Updates Jacobian and computes inv(J) by a matrix inversion at every iteration. It's very slow. The best norm |F(x)|=0.005 achieved in ~45 iterations.
Broyden's first method, modified by O. Certik. Updates inverse Jacobian using some matrix identities at every iteration, its faster then newton_slow, but still not optimal. The best norm |F(x)|=0.005 achieved in ~45 iterations.
Broyden's second method. Updates inverse Jacobian by an optimal formula. There is NxN matrix multiplication in every iteration. The best norm |F(x)|=0.003 achieved in ~20 iterations. Recommended.
Broyden's second method. Updates inverse Jacobian by an optimal formula. The NxN matrix multiplication is avoided. The best norm |F(x)|=0.003 achieved in ~20 iterations. Recommended.
Generalized Broyden's method.
Computes an approximation to the inverse Jacobian from the last M interations. Avoids NxN matrix multiplication, it only has MxM matrix multiplication and inversion.
M=0 .... linear mixing M=1 .... Anderson mixing with 2 iterations M=2 .... Anderson mixing with 3 iterations etc. optimal is M=5
Modified Broyden's method.
Updates inverse Jacobian using information from all the iterations and avoiding the NxN matrix multiplication. The problem is with the weights, it converges the same or worse than broyden2 or broyden_generalized
J=-1/alpha The best norm |F(x)|=0.005 achieved in ~140 iterations.
J=-1/alpha The best norm |F(x)|=0.005 achieved in ~140 iterations.
Returns an L2 norm of the vector.
Solve Ax=b, returns x
J=diag(d1,d2,...,dN) The best norm |F(x)|=0.005 achieved in ~110 iterations.
| Local name | Refers to |
|---|---|
| math | math |
| numpy | numpy |