Routines for minimizing a function
$F\left({x}_{1},{x}_{2},\dots ,{x}_{n}\right)$ of the variables
${x}_{1},{x}_{2},\dots ,{x}_{n}$ may require you to provide a subroutine to evaluate the second derivatives of
$F$.
e04hdc is designed to check the second derivatives calculated by such user-supplied functions. As well as the function to be checked (
hessfun), you must supply a function (
objfun) to evaluate the first derivatives, and a point
$x={\left({x}_{1},{x}_{2},\dots ,{x}_{n}\right)}^{\mathrm{T}}$ at which the checks will be made. Note that
e04hdc checks functions of the form required for
e04lbc.
e04hdc first calls
objfun and
hessfun to evaluate the first and second derivatives of
$F$ at
$x$. The user-supplied Hessian matrix (
$H$, say) is projected onto two orthogonal vectors
$y$ and
$z$ to give the scalars
${y}^{\mathrm{T}}Hy$ and
${z}^{\mathrm{T}}Hz$ respectively. The same projections of the Hessian matrix are also estimated by finite differences, giving
respectively, where
$g\left(\right)$ denotes the vector of first derivatives at the point in brackets and
$h$ is a small positive scalar. If the relative difference between
$p$ and
${y}^{\mathrm{T}}Hy$ or between
$q$ and
${z}^{\mathrm{T}}Hz$ is judged too large, an error indicator is set.
None.
The error
NE_DERIV_ERRORS is returned if
where
$h$ is set equal to
$\sqrt{\epsilon}$ (
$\epsilon $ being the
machine precision as given by
X02AJC and other quantities are as defined in
Section 3.
Suppose that it is intended to use
e04lbc to minimize
The following program could be used to check the second derivatives calculated by the required
hessfun function. (The call of
e04hdc is preceded by a call of
e04hcc to check the function
objfun which calculates the first derivatives.)
None.