NAG Library Routine Document
E04GDF
1 Purpose
E04GDF is a comprehensive modified Gauss–Newton algorithm for finding an unconstrained minimum of a sum of squares of $m$ nonlinear functions in $n$ variables $\left(m\ge n\right)$. First derivatives are required.
The routine is intended for functions which have continuous first and second derivatives (although it will usually work even if the derivatives have occasional discontinuities).
2 Specification
SUBROUTINE E04GDF ( 
M, N, LSQFUN, LSQMON, IPRINT, MAXCAL, ETA, XTOL, STEPMX, X, FSUMSQ, FVEC, FJAC, LDFJAC, S, V, LDV, NITER, NF, IW, LIW, W, LW, IFAIL) 
INTEGER 
M, N, IPRINT, MAXCAL, LDFJAC, LDV, NITER, NF, IW(LIW), LIW, LW, IFAIL 
REAL (KIND=nag_wp) 
ETA, XTOL, STEPMX, X(N), FSUMSQ, FVEC(M), FJAC(LDFJAC,N), S(N), V(LDV,N), W(LW) 
EXTERNAL 
LSQFUN, LSQMON 

3 Description
E04GDF is essentially identical to the subroutine LSQFDN in the NPL Algorithms Library. It is applicable to problems of the form
where
$x={\left({x}_{1},{x}_{2},\dots ,{x}_{n}\right)}^{\mathrm{T}}$ and
$m\ge n$. (The functions
${f}_{i}\left(x\right)$ are often referred to as ‘residuals’.)
You must supply a subroutine to calculate the values of the ${f}_{i}\left(x\right)$ and their first derivatives $\frac{\partial {f}_{i}}{\partial {x}_{j}}$ at any point $x$.
From a starting point
${x}^{\left(1\right)}$ supplied by you, the routine generates a sequence of points
${x}^{\left(2\right)},{x}^{\left(3\right)},\dots $, which is intended to converge to a local minimum of
$F\left(x\right)$. The sequence of points is given by
where the vector
${p}^{\left(k\right)}$ is a direction of search, and
${\alpha}^{\left(k\right)}$ is chosen such that
$F\left({x}^{\left(k\right)}+{\alpha}^{\left(k\right)}{p}^{\left(k\right)}\right)$ is approximately a minimum with respect to
${\alpha}^{\left(k\right)}$.
The vector ${p}^{\left(k\right)}$ used depends upon the reduction in the sum of squares obtained during the last iteration. If the sum of squares was sufficiently reduced, then ${p}^{\left(k\right)}$ is the Gauss–Newton direction; otherwise finite difference estimates of the second derivatives of the ${f}_{i}\left(x\right)$ are taken into account.
The method is designed to ensure that steady progress is made whatever the starting point, and to have the rapid ultimate convergence of Newton's method.
4 References
Gill P E and Murray W (1978) Algorithms for the solution of the nonlinear leastsquares problem SIAM J. Numer. Anal. 15 977–992
5 Parameters
 1: M – INTEGERInput
 2: N – INTEGERInput
On entry: the number $m$ of residuals, ${f}_{i}\left(x\right)$, and the number $n$ of variables, ${x}_{j}$.
Constraint:
$1\le {\mathbf{N}}\le {\mathbf{M}}$.
 3: LSQFUN – SUBROUTINE, supplied by the user.External Procedure
LSQFUN must calculate the vector of values
${f}_{i}\left(x\right)$ and Jacobian matrix of first derivatives
$\frac{\partial {f}_{i}}{\partial {x}_{j}}$ at any point
$x$. (However, if you do not wish to calculate the residuals or first derivatives at a particular
$x$, there is the option of setting a parameter to cause E04GDF to terminate immediately.)
The specification of
LSQFUN is:
SUBROUTINE LSQFUN ( 
IFLAG, M, N, XC, FVEC, FJAC, LDFJAC, IW, LIW, W, LW) 
INTEGER 
IFLAG, M, N, LDFJAC, IW(LIW), LIW, LW 
REAL (KIND=nag_wp) 
XC(N), FVEC(M), FJAC(LDFJAC,N), W(LW) 

Note: the dimension declaration for
FJAC must contain the variable
LDFJAC, not an integer constant.
 1: IFLAG – INTEGERInput/Output
On entry: to
LSQFUN,
IFLAG will be set to
$1$ or
$2$.
 ${\mathbf{IFLAG}}=1$
 Indicates that only the Jacobian matrix needs to be evaluated
 ${\mathbf{IFLAG}}=2$
 Indicates that both the residuals and the Jacobian matrix must be calculated
On exit: if it is not possible to evaluate the
${f}_{i}\left(x\right)$ or their first derivatives at the point given in
XC (or if it wished to stop the calculations for any other reason), you should reset
IFLAG to some negative number and return control to E04GDF. E04GDF will then terminate immediately, with
IFAIL set to your setting of
IFLAG.
 2: M – INTEGERInput
On entry: $m$, the numbers of residuals.
 3: N – INTEGERInput
On entry: $n$, the numbers of variables.
 4: XC(N) – REAL (KIND=nag_wp) arrayInput
On entry: the point $x$ at which the values of the ${f}_{i}$ and the $\frac{\partial {f}_{i}}{\partial {x}_{j}}$ are required.
 5: FVEC(M) – REAL (KIND=nag_wp) arrayOutput
On exit: unless
${\mathbf{IFLAG}}=1$ on entry, or
IFLAG is reset to a negative number, then
${\mathbf{FVEC}}\left(i\right)$ must contain the value of
${f}_{\mathit{i}}$ at the point
$x$, for
$\mathit{i}=1,2,\dots ,m$.
 6: FJAC(LDFJAC,N) – REAL (KIND=nag_wp) arrayOutput
On exit: unless
IFLAG is reset to a negative number,
${\mathbf{FJAC}}\left(\mathit{i},\mathit{j}\right)$ must contain the value of
$\frac{\partial {f}_{\mathit{i}}}{\partial {x}_{\mathit{j}}}$ at the point
$x$, for
$\mathit{i}=1,2,\dots ,m$ and
$\mathit{j}=1,2,\dots ,n$.
 7: LDFJAC – INTEGERInput
On entry: the first dimension of the array
FJAC as declared in the (sub)program from which E04GDF is called.
 8: IW(LIW) – INTEGER arrayWorkspace
 9: LIW – INTEGERInput
 10: W(LW) – REAL (KIND=nag_wp) arrayWorkspace
 11: LW – INTEGERInput
LSQFUN is called with E04GDF's parameters
IW,
LIW,
W,
LW as these parameters. They are present so that, when other library routines require the solution of a minimization subproblem, constants needed for the evaluation of residuals can be passed through
IW and
W. Similarly, you could pass quantities to
LSQFUN from the segment which calls E04GDF by using partitions of
IW and
W beyond those used as workspace by E04GDF. However, because of the danger of mistakes in partitioning, it is
recommended that you should pass information to
LSQFUN via COMMON global variables and
not use IW or W at all. In any case you
must not change the elements of
IW and
W used as workspace by E04GDF.
LSQFUN must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which E04GDF is called. Parameters denoted as
Input must
not be changed by this procedure.
Note: LSQFUN should be tested separately before being used in conjunction with E04GDF.
 4: LSQMON – SUBROUTINE, supplied by the NAG Library or the user.External Procedure
If
${\mathbf{IPRINT}}\ge 0$, you must supply
LSQMON which is suitable for monitoring the minimization process.
LSQMON must not change the values of any of its parameters.
If
${\mathbf{IPRINT}}<0$, the dummy routine E04FDZ can be used as
LSQMON.
The specification of
LSQMON is:
SUBROUTINE LSQMON ( 
M, N, XC, FVEC, FJAC, LDFJAC, S, IGRADE, NITER, NF, IW, LIW, W, LW) 
INTEGER 
M, N, LDFJAC, IGRADE, NITER, NF, IW(LIW), LIW, LW 
REAL (KIND=nag_wp) 
XC(N), FVEC(M), FJAC(LDFJAC,N), S(N), W(LW) 

Note: the dimension declaration for
FJAC must contain the variable
LDFJAC, not an integer constant.
 1: M – INTEGERInput
On entry: $m$, the numbers of residuals.
 2: N – INTEGERInput
On entry: $n$, the numbers of variables.
 3: XC(N) – REAL (KIND=nag_wp) arrayInput
On entry: the coordinates of the current point $x$.
 4: FVEC(M) – REAL (KIND=nag_wp) arrayInput
On entry: the values of the residuals ${f}_{i}$ at the current point $x$.
 5: FJAC(LDFJAC,N) – REAL (KIND=nag_wp) arrayInput
On entry: ${\mathbf{FJAC}}\left(\mathit{i},\mathit{j}\right)$ contains the value of $\frac{\partial {f}_{\mathit{i}}}{\partial {x}_{\mathit{j}}}$ at the current point $x$, for $\mathit{i}=1,2,\dots ,m$ and $\mathit{j}=1,2,\dots ,n$.
 6: LDFJAC – INTEGERInput
On entry: the first dimension of the array
FJAC as declared in the (sub)program from which E04GDF is called.
 7: S(N) – REAL (KIND=nag_wp) arrayInput
On entry: the singular values of the current Jacobian matrix. Thus
S may be useful as information about the structure of your problem. (If
${\mathbf{IPRINT}}>0$,
LSQMON is called at the initial point before the singular values have been calculated. So the elements of
S are set to zero for the first call of
LSQMON.)
 8: IGRADE – INTEGERInput
On entry: E04GDF estimates the dimension of the subspace for which the Jacobian matrix can be used as a valid approximation to the curvature (see
Gill and Murray (1978)). This estimate is called the grade of the Jacobian matrix, and
IGRADE gives its current value.
 9: NITER – INTEGERInput
On entry: the number of iterations which have been performed in E04GDF.
 10: NF – INTEGERInput
On entry: the number of times that
LSQFUN has been called so far with
${\mathbf{IFLAG}}=2$. (In addition to these calls monitored by
NF,
LSQFUN is called not more than
N times per iteration with
IFLAG set to
$1$.)
 11: IW(LIW) – INTEGER arrayWorkspace
 12: LIW – INTEGERInput
 13: W(LW) – REAL (KIND=nag_wp) arrayWorkspace
 14: LW – INTEGERInput
As in
LSQFUN, these parameters correspond to the parameters
IW,
LIW,
W,
LW of E04GDF. They are included in
LSQMON's parameter list primarily for when E04GDF is called by other library routines.
LSQMON must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which E04GDF is called. Parameters denoted as
Input must
not be changed by this procedure.
Note: you should normally print the sum of squares of residuals, so as to be able to examine the sequence of values of
$F\left(x\right)$ mentioned in
Section 7. It is usually also helpful to print
XC, the gradient of the sum of squares,
NITER and
NF.
 5: IPRINT – INTEGERInput
On entry: the frequency with which
LSQMON is to be called.
 ${\mathbf{IPRINT}}>0$
 LSQMON is called once every IPRINT iterations and just before exit from E04GDF.
 ${\mathbf{IPRINT}}=0$
 LSQMON is just called at the final point.
 ${\mathbf{IPRINT}}<0$
 LSQMON is not called at all.
IPRINT should normally be set to a small positive number.
Suggested value:
${\mathbf{IPRINT}}=1$.
 6: MAXCAL – INTEGERInput
On entry: enables you to limit the number of times that
LSQFUN is called by E04GDF. There will be an error exit (see
Section 6) after
MAXCAL evaluations of the residuals (i.e., calls of
LSQFUN with
IFLAG set to
$2$). It should be borne in mind that, in addition to the calls of
LSQFUN which are limited directly by
MAXCAL, there will be calls of
LSQFUN (with
IFLAG set to
$1$) to evaluate only first derivatives.
Suggested value:
${\mathbf{MAXCAL}}=50\times n$.
Constraint:
${\mathbf{MAXCAL}}\ge 1$.
 7: ETA – REAL (KIND=nag_wp)Input
On entry: every iteration of E04GDF involves a linear minimization, i.e., minimization of
$F\left({x}^{\left(k\right)}+{\alpha}^{\left(k\right)}{p}^{\left(k\right)}\right)$ with respect to
${\alpha}^{\left(k\right)}$.
ETA specifies how accurately these linear minimizations are to be performed. The minimum with respect to
${\alpha}^{\left(k\right)}$ will be located more accurately for small values of
ETA (say,
$0.01$) than for large values (say,
$0.9$).
Although accurate linear minimizations will generally reduce the number of iterations, they will tend to increase the number of calls of
LSQFUN (with
IFLAG set to
$2$) needed for each linear minimization. On balance it is usually efficient to perform a low accuracy linear minimization.
Suggested value:
${\mathbf{ETA}}=0.5$ (${\mathbf{ETA}}=0.0$ if ${\mathbf{N}}=1$).
Constraint:
$0.0\le {\mathbf{ETA}}<1.0$.
 8: XTOL – REAL (KIND=nag_wp)Input
On entry: the accuracy in
$x$ to which the solution is required.
If
${x}_{\mathrm{true}}$ is the true value of
$x$ at the minimum, then
${x}_{\mathrm{sol}}$, the estimated position before a normal exit, is such that
where
$\Vert y\Vert =\sqrt{{\displaystyle \sum _{j=1}^{n}}{y}_{j}^{2}}$. For example, if the elements of
${x}_{\mathrm{sol}}$ are not much larger than
$1.0$ in modulus and if
${\mathbf{XTOL}}=\text{1.0E\u22125}$, then
${x}_{\mathrm{sol}}$ is usually accurate to about five decimal places. (For further details see
Section 7.)
If
$F\left(x\right)$ and the variables are scaled roughly as described in
Section 8 and
$\epsilon $ is the
machine precision, then a setting of order
${\mathbf{XTOL}}=\sqrt{\epsilon}$ will usually be appropriate. If
XTOL is set to
$0.0$ or some positive value less than
$10\epsilon $, E04GDF will use
$10\epsilon $ instead of
XTOL, since
$10\epsilon $ is probably the smallest reasonable setting.
Constraint:
${\mathbf{XTOL}}\ge 0.0$.
 9: STEPMX – REAL (KIND=nag_wp)Input
On entry: an estimate of the Euclidean distance between the solution and the starting point supplied by you. (For maximum efficiency, a slight overestimate is preferable.) E04GDF will ensure that, for each iteration,
where
$k$ is the iteration number. Thus, if the problem has more than one solution, E04GDF is most likely to find the one nearest to the starting point. On difficult problems, a realistic choice can prevent the sequence of
${x}^{\left(k\right)}$ entering a region where the problem is illbehaved and can help avoid overflow in the evaluation of
$F\left(x\right)$. However, an underestimate of
STEPMX can lead to inefficiency.
Suggested value:
${\mathbf{STEPMX}}=100000.0$.
Constraint:
${\mathbf{STEPMX}}\ge {\mathbf{XTOL}}$.
 10: X(N) – REAL (KIND=nag_wp) arrayInput/Output
On entry: ${\mathbf{X}}\left(\mathit{j}\right)$ must be set to a guess at the $\mathit{j}$th component of the position of the minimum, for $\mathit{j}=1,2,\dots ,n$.
On exit: the final point ${x}^{\left(k\right)}$. Thus, if ${\mathbf{IFAIL}}={\mathbf{0}}$ on exit, ${\mathbf{X}}\left(j\right)$ is the $j$th component of the estimated position of the minimum.
 11: FSUMSQ – REAL (KIND=nag_wp)Output
On exit: the value of
$F\left(x\right)$, the sum of squares of the residuals
${f}_{i}\left(x\right)$, at the final point given in
X.
 12: FVEC(M) – REAL (KIND=nag_wp) arrayOutput
On exit: the value of the residual
${f}_{\mathit{i}}\left(x\right)$ at the final point given in
X, for
$\mathit{i}=1,2,\dots ,m$.
 13: FJAC(LDFJAC,N) – REAL (KIND=nag_wp) arrayOutput
On exit: the value of the first derivative
$\frac{\partial {f}_{\mathit{i}}}{\partial {x}_{\mathit{j}}}$ evaluated at the final point given in
X, for
$\mathit{i}=1,2,\dots ,m$ and
$\mathit{j}=1,2,\dots ,n$.
 14: LDFJAC – INTEGERInput
On entry: the first dimension of the array
FJAC as declared in the (sub)program from which E04GDF is called.
Constraint:
${\mathbf{LDFJAC}}\ge {\mathbf{M}}$.
 15: S(N) – REAL (KIND=nag_wp) arrayOutput
On exit: the singular values of the Jacobian matrix at the final point. Thus
S may be useful as information about the structure of your problem.
 16: V(LDV,N) – REAL (KIND=nag_wp) arrayOutput
On exit: the matrix
$V$ associated with the singular value decomposition
of the Jacobian matrix at the final point, stored by columns. This matrix may be useful for statistical purposes, since it is the matrix of orthonormalized eigenvectors of
${J}^{\mathrm{T}}J$.
 17: LDV – INTEGERInput
On entry: the first dimension of the array
V as declared in the (sub)program from which E04GDF is called.
Constraint:
${\mathbf{LDV}}\ge {\mathbf{N}}$.
 18: NITER – INTEGEROutput
On exit: the number of iterations which have been performed in E04GDF.
 19: NF – INTEGEROutput
On exit: the number of times that the residuals have been evaluated (i.e., number of calls of
LSQFUN with
IFLAG set to
$2$).
 20: IW(LIW) – INTEGER arrayCommunication Array
 21: LIW – INTEGERInput
On entry: the dimension of the array
IW as declared in the (sub)program from which E04GDF is called.
Constraint:
${\mathbf{LIW}}\ge 1$.
 22: W(LW) – REAL (KIND=nag_wp) arrayCommunication Array
 23: LW – INTEGERInput
On entry: the dimension of the array
W as declared in the (sub)program from which E04GDF is called.
Constraints:
 if ${\mathbf{N}}>1$, ${\mathbf{LW}}\ge 7\times {\mathbf{N}}+{\mathbf{M}}\times {\mathbf{N}}+2\times {\mathbf{M}}+{\mathbf{N}}\times {\mathbf{N}}$;
 if ${\mathbf{N}}=1$, ${\mathbf{LW}}\ge 9+3\times {\mathbf{M}}$.
 24: IFAIL – INTEGERInput/Output

On entry:
IFAIL must be set to
$0$,
$1\text{ or}1$. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
$1\text{ or}1$ is recommended. If the output of error messages is undesirable, then the value
$1$ is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if
${\mathbf{IFAIL}}\ne {\mathbf{0}}$ on exit, the recommended value is
$1$.
When the value $\mathbf{1}\text{ or}1$ is used it is essential to test the value of IFAIL on exit.
On exit:
${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
${\mathbf{IFAIL}}={\mathbf{0}}$ or
${{\mathbf{1}}}$, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Note: E04GDF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
 ${\mathbf{IFAIL}}<0$
A negative value of
IFAIL indicates an exit from E04GDF because you have set
IFLAG negative in
LSQFUN. The value of
IFAIL will be the same as your setting of
IFLAG.
 ${\mathbf{IFAIL}}=1$
On entry,  ${\mathbf{N}}<1$, 
or  ${\mathbf{M}}<{\mathbf{N}}$, 
or  ${\mathbf{MAXCAL}}<1$, 
or  ${\mathbf{ETA}}<0.0$, 
or  ${\mathbf{ETA}}\ge 1.0$, 
or  ${\mathbf{XTOL}}<0.0$, 
or  ${\mathbf{STEPMX}}<{\mathbf{XTOL}}$, 
or  ${\mathbf{LDFJAC}}<{\mathbf{M}}$, 
or  ${\mathbf{LDV}}<{\mathbf{N}}$, 
or  ${\mathbf{LIW}}<1$, 
or  ${\mathbf{LW}}<7\times {\mathbf{N}}+{\mathbf{M}}\times {\mathbf{N}}+2\times {\mathbf{M}}+{\mathbf{N}}\times {\mathbf{N}}$ when ${\mathbf{N}}>1$, 
or  ${\mathbf{LW}}<9+3\times {\mathbf{M}}$ when ${\mathbf{N}}=1$. 
When this exit occurs, no values will have been assigned to
FSUMSQ, or to the elements of
FVEC,
FJAC,
S or
V.
 ${\mathbf{IFAIL}}=2$
There have been
MAXCAL evaluations of the residuals. If steady reductions in the sum of squares,
$F\left(x\right)$, were monitored up to the point where this exit occurred, then the exit probably occurred simply because
MAXCAL was set too small, so the calculations should be restarted from the final point held in
X. This exit may also indicate that
$F\left(x\right)$ has no minimum.
 ${\mathbf{IFAIL}}=3$
The conditions for a minimum have not all been satisfied, but a lower point could not be found. This could be because
XTOL has been set so small that rounding errors in the evaluation of the residuals and derivatives make attainment of the convergence conditions impossible.
 ${\mathbf{IFAIL}}=4$
The method for computing the singular value decomposition of the Jacobian matrix has failed to converge in a reasonable number of subiterations. It may be worth applying E04GDF again starting with an initial approximation which is not too close to the point at which the failure occurred.
The values
${\mathbf{IFAIL}}={\mathbf{2}}$,
${\mathbf{3}}$ or
${\mathbf{4}}$ may also be caused by mistakes in
LSQFUN, by the formulation of the problem or by an awkward function. If there are no such mistakes it is worth restarting the calculations from a different starting point (not the point at which the failure occurred) in order to avoid the region which caused the failure.
7 Accuracy
A successful exit (
${\mathbf{IFAIL}}={\mathbf{0}}$) is made from E04GDF when the matrix of approximate second derivatives of
$F\left(x\right)$ is positive definite, and when (B1, B2 and B3) or B4 or B5 hold, where
and where
$\Vert .\Vert $ and
$\epsilon $ are as defined in
XTOL, and
${F}^{\left(k\right)}$ and
${g}^{\left(k\right)}$ are the values of
$F\left(x\right)$ and its vector of estimated first derivatives at
${x}^{\left(k\right)}$.
If
${\mathbf{IFAIL}}={\mathbf{0}}$ then the vector in
X on exit,
${x}_{\mathrm{sol}}$, is almost certainly an estimate of
${x}_{\mathrm{true}}$, the position of the minimum to the accuracy specified by
XTOL.
If
${\mathbf{IFAIL}}={\mathbf{3}}$, then
${x}_{\mathrm{sol}}$ may still be a good estimate of
${x}_{\mathrm{true}}$, but to verify this you should make the following checks. If
(a) 
the sequence $\left\{F\left({x}^{\left(k\right)}\right)\right\}$ converges to $F\left({x}_{\mathrm{sol}}\right)$ at a superlinear or a fast linear rate, and 
(b) 
$g{\left({x}_{\mathrm{sol}}\right)}^{\mathrm{T}}g\left({x}_{\mathrm{sol}}\right)<10\epsilon $, where $\mathrm{T}$ denotes transpose, then it is almost certain that ${x}_{\mathrm{sol}}$ is a close approximation to the minimum. 
When
(b) is true, then usually
$F\left({x}_{\mathrm{sol}}\right)$ is a close approximation to
$F\left({x}_{\mathrm{true}}\right)$. The values of
$F\left({x}^{\left(k\right)}\right)$ can be calculated in
LSQMON, and the vector
$g\left({x}_{\mathrm{sol}}\right)$ can be calculated from the contents of
FVEC and
FJAC on exit from E04GDF.
Further suggestions about confirmation of a computed solution are given in the
E04 Chapter Introduction.
The number of iterations required depends on the number of variables, the number of residuals, the behaviour of
$F\left(x\right)$, the accuracy demanded and the distance of the starting point from the solution. The number of multiplications performed per iteration of E04GDF varies, but for
$m\gg n$ is approximately
$n\times {m}^{2}+\mathit{O}\left({n}^{3}\right)$. In addition, each iteration makes at least one call of
LSQFUN. So, unless the residuals and their derivatives can be evaluated very quickly, the run time will be dominated by the time spent in
LSQFUN.
Ideally, the problem should be scaled so that, at the solution, $F\left(x\right)$ and the corresponding values of the ${x}_{j}$ are each in the range $\left(1,+1\right)$, and so that at points one unit away from the solution, $F\left(x\right)$ differs from its value at the solution by approximately one unit. This will usually imply that the Hessian matrix of $F\left(x\right)$ at the solution is wellconditioned. It is unlikely that you will be able to follow these recommendations very closely, but it is worth trying (by guesswork), as sensible scaling will reduce the difficulty of the minimization problem, so that E04GDF will take less computer time.
When the sum of squares represents the goodnessoffit of a nonlinear model to observed data, elements of the variancecovariance matrix of the estimated regression coefficients can be computed by a subsequent call to
E04YCF, using information returned in the arrays
S and
V. See
E04YCF for further details.
9 Example
This example finds least squares estimates of
${x}_{1}$,
${x}_{2}$ and
${x}_{3}$ in the model
using the
$15$ sets of data given in the following table.
Before calling E04GDF, the program calls
E04YAF to check
LSQFUN. It uses
$\left(0.5,1.0,1.5\right)$ as the initial guess at the position of the minimum.
9.1 Program Text
Program Text (e04gdfe.f90)
9.2 Program Data
Program Data (e04gdfe.d)
9.3 Program Results
Program Results (e04gdfe.r)