scipy.optimize.fsolve

scipy.optimize.fsolve(func, x0, args=(), fprime=None, full_output=0, col_deriv=0, xtol=1.49012e-08, maxfev=0, band=None, epsfcn=0.0, factor=100, diag=None, warning=True)

Find the roots of a function.

Return the roots of the (non-linear) equations defined by func(x) = 0 given a starting estimate.

Parameters :

func : callable f(x, *args)

A function that takes at least one (possibly vector) argument.

x0 : ndarray

The starting estimate for the roots of func(x) = 0.

args : tuple

Any extra arguments to func.

fprime : callable(x)

A function to compute the Jacobian of func with derivatives across the rows. By default, the Jacobian will be estimated.

full_output : bool

If True, return optional outputs.

col_deriv : bool

Specify whether the Jacobian function computes derivatives down the columns (faster, because there is no transpose operation).

warning : bool

Whether to print a warning message when the call is unsuccessful. This option is deprecated, use the warnings module instead.

Returns :

x : ndarray

The solution (or the result of the last iteration for an unsuccessful call).

infodict : dict

A dictionary of optional outputs with the keys:

* 'nfev': number of function calls
* 'njev': number of Jacobian calls
* 'fvec': function evaluated at the output
* 'fjac': the orthogonal matrix, q, produced by the QR
          factorization of the final approximate Jacobian
          matrix, stored column wise
* 'r': upper triangular matrix produced by QR factorization of same
       matrix
* 'qtf': the vector (transpose(q) * fvec)

ier : int

An integer flag. Set to 1 if a solution was found, otherwise refer to mesg for more information.

mesg : str

If no solution is found, mesg details the cause of failure.

Notes

fsolve is a wrapper around MINPACK’s hybrd and hybrj algorithms.

From scipy 0.8.0 fsolve returns an array of size one instead of a scalar when solving for a single parameter.

Previous topic

scipy.optimize.curve_fit

Next topic

scipy.optimize.brentq

This Page