After the initialization routine
e04raf has been called and unless the objective function has already been defined,
e04rmf may be used to declare the objective function of the optimization problem as a sum of squares. It will typically be used in data fitting or calibration problems of the form
where
$x$ is an
$n$-dimensional variable vector and
${r}_{i}\left(x\right)$ are nonlinear residuals (see
Section 2.2.3 in the
E04 Chapter Introduction). The values of the residuals, and possibly their derivatives, will be communicated to the solver by a user-supplied function.
e04rmf also allows the structured first derivative matrix
to be declared as being dense or sparse. If declared as sparse, its sparsity structure must be specified here.
See
Section 3.1 in the
E04 Chapter Introduction for more details about the NAG optimization modelling suite.
None.
If on entry
${\mathbf{ifail}}=0$ or
$-1$, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Not applicable.
None.
In this example, we demonstrate how to declare a least squares problem through
e04rmf and solve it with
e04fff on a very simple example. Here
$n=2$,
${m}_{r}=3$ and the residuals are computed by:
The expected result is:
with an objective value of
$0.015$.
None.