# naginterfaces.library.opt.lsq_​uncon_​mod_​func_​easy¶

naginterfaces.library.opt.lsq_uncon_mod_func_easy(m, lsfun1, x, data=None)[source]

lsq_uncon_mod_func_easy is an easy-to-use algorithm for finding an unconstrained minimum of a sum of squares of nonlinear functions in variables . No derivatives are required.

It is intended for functions which are continuous and which have continuous first and second derivatives (although it will usually work even if the derivatives have occasional discontinuities).

For full information please refer to the NAG Library document for e04fy

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/e04/e04fyf.html

Parameters
mint

The number of residuals, , and the number of variables, .

lsfun1callable fvec = lsfun1(m, xc, data=None)

You must supply this function to calculate the vector of values at any point .

It should be tested separately before being used in conjunction with lsq_uncon_mod_func_easy (see the E04 Introduction).

Parameters
mint

, the numbers of residuals.

xcfloat, ndarray, shape

The point at which the values of the are required.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
fvecfloat, array-like, shape

must contain the value of at the point , for .

xfloat, array-like, shape

must be set to a guess at the th component of the position of the minimum, for .

dataarbitrary, optional

User-communication data for callback functions.

Returns
xfloat, ndarray, shape

The lowest point found during the calculations. Thus, if no exception or warning is raised on exit, is the th component of the position of the minimum.

fsumsqfloat

The value of the sum of squares, , corresponding to the final point stored in .

commdict, communication object

Communication structure.

Raises
NagValueError
(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

There have been calls to .

(errno )

Failure in computing SVD of estimated Jacobian matrix.

Warns
NagAlgorithmicWarning
(errno )

The conditions for a minimum have not all been satisfied, but a lower point could not be found.

(errno )

It is probable that a local minimum has been found, but it cannot be guaranteed.

(errno )

It is possible that a local minimum has been found, but it cannot be guaranteed.

(errno )

It is unlikely that a local minimum has been found.

(errno )

It is very unlikely that a local minimum has been found.

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

lsq_uncon_mod_func_easy is essentially identical to the function LSNDN1 in the NPL Algorithms Library. It is applicable to problems of the form

where and . (The functions are often referred to as ‘residuals’.)

You must supply a function to evaluate functions at any point .

From a starting point supplied by you, a sequence of points is generated which is intended to converge to a local minimum of the sum of squares. These points are generated using estimates of the curvature of .

References

Gill, P E and Murray, W, 1978, Algorithms for the solution of the nonlinear least squares problem, SIAM J. Numer. Anal. (15), 977–992