# lmdif

sherpa.optmethods.optfcts.lmdif(fcn, x0, xmin, xmax, ftol=1.1920928955078125e-07, xtol=1.1920928955078125e-07, gtol=1.1920928955078125e-07, maxfev=None, epsfcn=1.1920928955078125e-07, factor=100.0, numcores=1, verbose=0)[source] [edit on github]

Levenberg-Marquardt optimization method.

The Levenberg-Marquardt method is an interface to the MINPACK subroutine lmdif to find the local minimum of nonlinear least squares functions of several variables by a modification of the Levenberg-Marquardt algorithm .

Parameters:
• fcn (function reference) – Returns the current statistic and per-bin statistic value when given the model parameters.

• x0 (sequence of number) – The starting point, minimum, and maximum values for each parameter.

• xmin (sequence of number) – The starting point, minimum, and maximum values for each parameter.

• xmax (sequence of number) – The starting point, minimum, and maximum values for each parameter.

• ftol (number) – The function tolerance to terminate the search for the minimum; the default is FLT_EPSILON ~ 1.19209289551e-07, where FLT_EPSILON is the smallest number x such that ```1.0 != 1.0 + x```. The conditions are satisfied when both the actual and predicted relative reductions in the sum of squares are, at most, ftol.

• xtol (number) – The relative error desired in the approximate solution; default is FLT_EPSILON ~ 1.19209289551e-07, where FLT_EPSILON is the smallest number x such that `1.0 != 1.0 + x`. The conditions are satisfied when the relative error between two consecutive iterates is, at most, `xtol`.

• gtol (number) – The orthogonality desired between the function vector and the columns of the jacobian; default is FLT_EPSILON ~ 1.19209289551e-07, where FLT_EPSILON is the smallest number x such that `1.0 != 1.0 + x`. The conditions are satisfied when the cosine of the angle between fvec and any column of the jacobian is, at most, `gtol` in absolute value.

• maxfev (int or `None`) – The maximum number of function evaluations; the default value of `None` means to use `1024 * n`, where `n` is the number of free parameters.

• epsfcn (number) – This is used in determining a suitable step length for the forward-difference approximation; default is FLT_EPSILON ~ 1.19209289551e-07, where FLT_EPSILON is the smallest number x such that `1.0 != 1.0 + x`. This approximation assumes that the relative errors in the functions are of the order of `epsfcn`. If `epsfcn` is less than the machine precision, it is assumed that the relative errors in the functions are of the order of the machine precision.

• factor (int) – Used in determining the initial step bound; default is 100. The initial step bound is set to the product of `factor` and the euclidean norm of diag*x if nonzero, or else to factor itself. In most cases, `factor` should be from the interval (.1,100.).

• numcores (int) – The number of CPU cores to use. The default is `1`.

• verbose (int) – The amount of information to print during the fit. The default is `0`, which means no output.

References