A positive real number,termination occurs when both the
actual and predicted relative reductions in the sum of squares
are at most ftol. therefore,
ftol measures the relative error desired in
the sum of squares.

xtol

A positive real number, termination occurs when the
relative error between two consecutive iterates is at most
xtol. therefore, xtol
measures the relative error desired in the approximate
solution.

gtol

A nonnegative input variable. termination occurs when
the cosine of the angle between fct(x) and
any column of the jacobian is at most gtol
in absolute value. therefore, gtolmeasures
the orthogonality desired between the function vector and the
columns of the jacobian.

maxfev

A positive integer, termination occurs when the number
of calls to fct is at least maxfev by the
end of an iteration.

epsfcn

A positive real number, used in determining a suitable
step length for the forward-difference approximation. 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

A positive real number, used in determining the initial
step bound. this 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 lie in the interval
(0.1,100). 100 is a
generally recommended value.

diag

is an array of length n.
diag must contain positive entries that serve as
multiplicative scale factors for the variables.

x :

real vector (final estimate of the solution vector).

v :

real vector (value of fct(x)).

info

termination indicator

0

improper input parameters.

1

algorithm estimates that the relative error between
x and the solution is at most
tol.

2

number of calls to fcn reached

3

tol is too small. No further
improvement in the approximate solution x
is possible.

4

iteration is not making good progress.

5

number of calls to fcn has reached or
exceeded maxfev

6

ftol is too small. no further
reduction in the sum of squares is possible.

7

xtol is too small. no further
improvement in the approximate solutionx is
possible.

8

gtol is too small.
fvec is orthogonal to the columns of the
jacobian to machine precision.

Description

minimize the sum of the squares of m nonlinear functions in n
variables by a modification of the levenberg-marquardt algorithm. the user
must provide a subroutine which calculates the functions. the jacobian is
then calculated by a forward-difference approximation.

minimize sum(fct(x,m).^2) where
fct is function from R^n to
R^m

fct should be :

a Scilab function whose calling sequence is
v=fct(x,m) given x and
m.

a character string which refers to a C or Fortran routine which
must be linked to Scilab.

Fortran calling sequence should be
fct(m,n,x,v,iflag) where m,
n, iflag are integers,
x a double precision vector of size
n and v a double precision
vector of size m.