<?xml-stylesheet type="text/xsl" href="../styles/pmathml.xsl"?>
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:dsi="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xml:space="preserve"><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"/><title>E04LYF : NAG Library, Mark 22</title><link rel="stylesheet" href="../styles/libdoc.css" type="text/css"/><script type="text/javascript">
   function showLevel(_levelId){
    var thisLevel = document.getElementById(_levelId);
    var thisplus = document.getElementById( _levelId.concat('plus'));
    var thisminus = document.getElementById( _levelId.concat('minus'));
    if(thisLevel.style.display != "block"){
     thisLevel.style.display = "block";
     thisplus.style.display = "none";
     thisminus.style.display = "inline";
     }
    else{
     thisLevel.style.display = "none";
     thisminus.style.display = "none";
     thisplus.style.display = "inline";
     }
    }
  </script></head><body><hr/><div><a class="rout" href="../../pdf/E04/e04lyf.pdf">E04LYF (PDF version)</a></div><div><a class="chap" href="e04conts.xml">E04 Chapter Contents</a></div><div><a class="chapint" href="e04intro.xml">E04 Chapter Introduction</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div><hr/><h1 class="libdoc">NAG Library Routine Document<br/><br/>E04LYF</h1><div class="paramtext"><div class="header"><b>Note:</b>&#160; before using this routine, please read the Users' Note for your implementation to check the interpretation of <span class="bitalic">bold italicised</span> terms and other implementation-dependent details.</div></div><div class="htmltoc">
<h2 class="htmltoc"><span class="htmltochead" onclick="showLevel('htmltoc');"><span class="htmltocplus" id="htmltocplus">+</span><span class="htmltocminus" id="htmltocminus">&#8722;</span></span>&#160;Contents</h2>
<div class="htmltocitem" id="htmltoc">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#purpose">1&#160;&#160;<b>Purpose</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#specification">2&#160;&#160;<b>Specification</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#description">3&#160;&#160;<b>Description</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#references">4&#160;&#160;<b>References</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#parameters">5&#160;&#160;<b>Parameters</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#errors">6&#160;&#160;<b>Error Indicators and Warnings</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#accuracy">7&#160;&#160;<b>Accuracy</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#fcomments">8&#160;&#160;<b>Further Comments</b></a>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('tocexample');"><span class="htmltocplus" id="tocexampleplus">+</span><span class="htmltocminus" id="tocexampleminus">&#8722;</span></span>
<a class="htmltoc" href="#example">9&#160;&#160;<b>Example</b></a>
<div class="htmltocitem" id="tocexample">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examtext">9.1&#160;&#160;<b>Program Text</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examdata">9.2&#160;&#160;<b>Program Data</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examresults">9.3&#160;&#160;<b>Program Results</b></a>
</div>
</div>
</div>
</div>
</div><h2 class="standard"><a class="sec" name="purpose" id="purpose"/>1&#160;&#160;Purpose</h2>
<div class="paramtext">E04LYF is an easy-to-use modified-Newton algorithm for finding a minimum of a function, <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:msub><m:mi>x</m:mi><m:mi>n</m:mi></m:msub></m:mfenced></m:math>&#160;subject to fixed upper and lower bounds on the independent variables, <m:math><m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:msub><m:mi>x</m:mi><m:mi>n</m:mi></m:msub></m:math>&#160;when first and second derivatives of <m:math><m:mi>F</m:mi></m:math>&#160;are available.  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).</div><h2 class="standard"><a class="sec" name="specification" id="specification"/>2&#160;&#160;Specification</h2>
<table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;E04LYF&#160;(</td><td class="tdfspec2"><a class="arg" href="#N">N</a>, <a class="arg" href="#IBOUND">IBOUND</a>, <a class="arg" href="#FUNCT2">FUNCT2</a>, <a class="arg" href="#HESS2">HESS2</a>, <a class="arg" href="#BL">BL</a>, <a class="arg" href="#BU">BU</a>, <a class="arg" href="#X">X</a>, <a class="arg" href="#F">F</a>, <a class="arg" href="#G">G</a>, <a class="arg" href="#IW">IW</a>, <a class="arg" href="#LIW">LIW</a>, <a class="arg" href="#W">W</a>, <a class="arg" href="#LW">LW</a>, <a class="arg" href="#IUSER">IUSER</a>, <a class="arg" href="#RUSER">RUSER</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">N, IBOUND, IW(LIW), LIW, LW, IUSER(*), IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">BL(N), BU(N), X(N), F, G(N), W(LW), RUSER(*)</td></tr><tr><td class="tdfspec1">EXTERNAL</td><td class="tdfspec2">FUNCT2, HESS2</td></tr></table><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">E04LYF is applicable to problems of the form:

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mrow><m:mi>Minimize</m:mi><m:mo>&#8289;</m:mo><m:mi>F</m:mi></m:mrow><m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:msub><m:mi>x</m:mi><m:mi>n</m:mi></m:msub></m:mfenced><m:mtext>&#8195; subject to &#8195;</m:mtext><m:msub><m:mi>l</m:mi><m:mi>j</m:mi></m:msub><m:mo>&#8804;</m:mo><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub><m:mo>&#8804;</m:mo><m:msub><m:mi>u</m:mi><m:mi>j</m:mi></m:msub><m:mtext>, &#8195;</m:mtext><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi>
</m:math></td><td class="formula2"/></tr></table></div>

when first and second derivatives of <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;are available.</div><div class="paramtext">Special provision is made for problems which actually have no bounds on the  <m:math><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:math>, problems which have only non-negativity bounds and problems in which <m:math><m:msub><m:mi>l</m:mi><m:mn>1</m:mn></m:msub><m:mo>=</m:mo><m:msub><m:mi>l</m:mi><m:mn>2</m:mn></m:msub><m:mo>=</m:mo><m:mo>&#8943;</m:mo><m:mo>=</m:mo><m:msub><m:mi>l</m:mi><m:mi>n</m:mi></m:msub></m:math>&#160;and  <m:math><m:msub><m:mi>u</m:mi><m:mn>1</m:mn></m:msub><m:mo>=</m:mo><m:msub><m:mi>u</m:mi><m:mn>2</m:mn></m:msub><m:mo>=</m:mo><m:mo>&#8943;</m:mo><m:mo>=</m:mo><m:msub><m:mi>u</m:mi><m:mi>n</m:mi></m:msub></m:math>.  You must supply a subroutine  to calculate the values of <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;and its first derivatives at any point <m:math><m:mi>x</m:mi></m:math>&#160;and a subroutine to calculate the second derivatives.</div><div class="paramtext">From a starting point you supplied there is generated, on the basis of estimates of the curvature of <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>, a sequence of feasible points which is intended to converge to a local minimum of the constrained function.</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2><div class="paramtext"><a name="ref081" id="ref081"/>Gill P E and Murray W (1976)  Minimization subject to bounds on the variables <i>NPL Report NAC 72</i> National Physical Laboratory </div><h2 class="standard"><a class="sec" name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>
<dl><dt class="paramhead"><a name="N" id="N"/>1: &#160;&#160;&#8194; N &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: 

the number <m:math><m:mi>n</m:mi></m:math>&#160;of independent variables.</div>
<div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>1</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="IBOUND" id="IBOUND"/>2: &#160;&#160;&#8194; IBOUND &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: indicates whether the facility for dealing with bounds of special forms is to be used.  It must be set to one of the following values: 
<dl>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IBOUND"><m:mi mathcolor="#EE0000" mathvariant="bold">IBOUND</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math></dt>
<dd>If you are supplying all the <m:math><m:msub><m:mi>l</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>u</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;individually.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IBOUND"><m:mi mathcolor="#EE0000" mathvariant="bold">IBOUND</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math></dt>
<dd>If there are no bounds on any <m:math><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:math>.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IBOUND"><m:mi mathcolor="#EE0000" mathvariant="bold">IBOUND</m:mi></m:maction><m:mo>=</m:mo><m:mn>2</m:mn></m:math></dt>
<dd>If all the bounds are of the form <m:math><m:mn>0</m:mn><m:mo>&#8804;</m:mo><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:math>.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IBOUND"><m:mi mathcolor="#EE0000" mathvariant="bold">IBOUND</m:mi></m:maction><m:mo>=</m:mo><m:mn>3</m:mn></m:math></dt>
<dd>If <m:math><m:msub><m:mi>l</m:mi><m:mn>1</m:mn></m:msub><m:mo>=</m:mo><m:msub><m:mi>l</m:mi><m:mn>2</m:mn></m:msub><m:mo>=</m:mo><m:mo>&#8943;</m:mo><m:mo>=</m:mo><m:msub><m:mi>l</m:mi><m:mi>n</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>u</m:mi><m:mn>1</m:mn></m:msub><m:mo>=</m:mo><m:msub><m:mi>u</m:mi><m:mn>2</m:mn></m:msub><m:mo>=</m:mo><m:mo>&#8943;</m:mo><m:mo>=</m:mo><m:msub><m:mi>u</m:mi><m:mi>n</m:mi></m:msub></m:math>.</dd></dl>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:mn>0</m:mn><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#IBOUND"><m:mi mathcolor="#EE0000" mathvariant="bold">IBOUND</m:mi></m:maction><m:mo>&#8804;</m:mo><m:mn>3</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="FUNCT2" id="FUNCT2"/>3: &#160;&#160;&#8194; FUNCT2 &#8211; SUBROUTINE, supplied by the user.<span class="pclass">External Procedure</span></dt><dd><div class="paramtext">You must supply this routine to calculate the values of the function <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;and its first derivatives <m:math>
 <m:mfrac other="display">
  <m:mrow><m:mo>&#8706;</m:mo><m:mi>F</m:mi></m:mrow>
  <m:mrow><m:mo>&#8706;</m:mo><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:mrow>
 </m:mfrac>
</m:math>&#160;at any point <m:math><m:mi>x</m:mi></m:math>.  It should be tested separately before being used in conjunction with E04LYF (see the <a class="chapint" href="../E04/e04intro.xml">E04 Chapter Introduction</a>).</div><div class="subprog">
<div class="paramtext">The specification of <a class="arg" href="#FUNCT2">FUNCT2</a> is:</div><table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;FUNCT2&#160;(</td><td class="tdfspec2"><a class="arg" href="../E04/e04lyf.xml#FUNCT2_N">N</a>, <a class="arg" href="../E04/e04lyf.xml#FUNCT2_XC">XC</a>, <a class="arg" href="../E04/e04lyf.xml#FUNCT2_FC">FC</a>, <a class="arg" href="../E04/e04lyf.xml#FUNCT2_GC">GC</a>, <a class="arg" href="../E04/e04lyf.xml#FUNCT2_IUSER">IUSER</a>, <a class="arg" href="../E04/e04lyf.xml#FUNCT2_RUSER">RUSER</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">N, IUSER(*)</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">XC(N), FC, GC(N), RUSER(*)</td></tr></table>
<dl><dt class="paramhead"><a name="FUNCT2_N" id="FUNCT2_N"/>1: &#160;&#160;&#8194; N &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the number <m:math><m:mi>n</m:mi></m:math>&#160;of variables.</div></dd><dt class="paramhead"><a name="FUNCT2_XC" id="FUNCT2_XC"/>2: &#160;&#160;&#8194; XC(<a class="arg" href="../E04/e04lyf.xml#FUNCT2_N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the point <m:math><m:mi>x</m:mi></m:math>&#160;at which the function and its derivatives are required.</div></dd><dt class="paramhead"><a name="FUNCT2_FC" id="FUNCT2_FC"/>3: &#160;&#160;&#8194; FC &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the value of the function <m:math><m:mi>F</m:mi></m:math>&#160;at the current point <m:math><m:mi>x</m:mi></m:math>.</div></dd><dt class="paramhead"><a name="FUNCT2_GC" id="FUNCT2_GC"/>4: &#160;&#160;&#8194; GC(<a class="arg" href="../E04/e04lyf.xml#FUNCT2_N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#FUNCT2_GC"><m:mi mathcolor="#EE0000" mathvariant="bold">GC</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;must be set to the value of the first derivative <m:math>
 <m:mfrac other="display">
  <m:mrow><m:mo>&#8706;</m:mo><m:mi>F</m:mi></m:mrow>
  <m:mrow><m:mo>&#8706;</m:mo><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:mrow>
 </m:mfrac>
</m:math>&#160;at the point <m:math><m:mi>x</m:mi></m:math>, for <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.</div></dd><dt class="paramhead"><a name="FUNCT2_IUSER" id="FUNCT2_IUSER"/>5: &#160;&#160;&#8194; IUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; INTEGER array<span class="pclass">User Workspace</span></dt><dt class="multi-paramhead"><a name="FUNCT2_RUSER" id="FUNCT2_RUSER"/>6: &#160;&#160;&#8194; RUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">User Workspace</span></dt><dd><div class="paramtext"><a class="arg" href="#FUNCT2">FUNCT2</a> is called from E04LYF with the parameters <a class="arg" href="../E04/e04lyf.xml#FUNCT2_IUSER">IUSER</a> and <a class="arg" href="../E04/e04lyf.xml#FUNCT2_RUSER">RUSER</a> as supplied to E04LYF.  You are free to use the arrays <a class="arg" href="../E04/e04lyf.xml#FUNCT2_IUSER">IUSER</a> and <a class="arg" href="../E04/e04lyf.xml#FUNCT2_RUSER">RUSER</a> to supply information to <a class="arg" href="#FUNCT2">FUNCT2</a> as an alternative to using 
COMMON. 

</div></dd></dl>
</div>
<div class="paramtext"><a class="arg" href="#FUNCT2">FUNCT2</a> must be declared as EXTERNAL in the (sub)program from which E04LYF is called. Parameters denoted as <span class="italic">Input</span>  must <b>not</b>  be changed by this procedure.</div>
</dd><dt class="paramhead"><a name="HESS2" id="HESS2"/>4: &#160;&#160;&#8194; HESS2 &#8211; SUBROUTINE, supplied by the user.<span class="pclass">External Procedure</span></dt><dd><div class="paramtext">You must supply this routine to evaluate the elements <m:math><m:msub><m:mi>H</m:mi><m:mrow><m:mi>i</m:mi><m:mi>j</m:mi></m:mrow></m:msub><m:mo>=</m:mo><m:mfrac other="display">
  <m:mrow><m:msup><m:mo>&#8706;</m:mo><m:mn>2</m:mn></m:msup><m:mi>F</m:mi></m:mrow>
  <m:mrow><m:mo>&#8706;</m:mo><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub><m:mo>&#8706;</m:mo><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:mrow>
 </m:mfrac>
</m:math>&#160;of the matrix of second derivatives of <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;at any point <m:math><m:mi>x</m:mi></m:math>.  It should be tested separately before being used in conjunction with E04LYF (see the <a class="chapint" href="../E04/e04intro.xml">E04 Chapter Introduction</a>).</div><div class="subprog">
<div class="paramtext">The specification of <a class="arg" href="#HESS2">HESS2</a> is:</div><table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;HESS2&#160;(</td><td class="tdfspec2"><a class="arg" href="../E04/e04lyf.xml#HESS2_N">N</a>, <a class="arg" href="../E04/e04lyf.xml#HESS2_XC">XC</a>, <a class="arg" href="../E04/e04lyf.xml#HESS2_HESLC">HESLC</a>, <a class="arg" href="../E04/e04lyf.xml#HESS2_LH">LH</a>, <a class="arg" href="../E04/e04lyf.xml#HESS2_HESDC">HESDC</a>, <a class="arg" href="../E04/e04lyf.xml#HESS2_IUSER">IUSER</a>, <a class="arg" href="../E04/e04lyf.xml#HESS2_RUSER">RUSER</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">N, LH, IUSER(*)</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">XC(N), HESLC(LH), HESDC(N), RUSER(*)</td></tr></table>
<dl><dt class="paramhead"><a name="HESS2_N" id="HESS2_N"/>1: &#160;&#160;&#8194; N &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the number <m:math><m:mi>n</m:mi></m:math>&#160;of variables.</div></dd><dt class="paramhead"><a name="HESS2_XC" id="HESS2_XC"/>2: &#160;&#160;&#8194; XC(<a class="arg" href="../E04/e04lyf.xml#HESS2_N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the point <m:math><m:mi>x</m:mi></m:math>&#160;at which the derivatives are required.</div></dd><dt class="paramhead"><a name="HESS2_HESLC" id="HESS2_HESLC"/>3: &#160;&#160;&#8194; HESLC(<a class="arg" href="../E04/e04lyf.xml#HESS2_LH">LH</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: <a class="arg" href="#HESS2">HESS2</a> must place the strict lower triangle of the second derivative matrix <m:math><m:mi>H</m:mi></m:math>&#160;in <a class="arg" href="../E04/e04lyf.xml#HESS2_HESLC">HESLC</a>, stored by rows, i.e., set <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#HESS2_HESLC"><m:mi mathcolor="#EE0000" mathvariant="bold">HESLC</m:mi></m:maction><m:mfenced separators=""><m:mfenced separators=""><m:mi>i</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mfenced><m:mfenced separators=""><m:mi>i</m:mi><m:mo>-</m:mo><m:mn>2</m:mn></m:mfenced><m:mo>/</m:mo><m:mn>2</m:mn><m:mo>+</m:mo><m:mi>j</m:mi></m:mfenced><m:mo>=</m:mo><m:mfrac other="display">
  <m:mrow><m:msup><m:mo>&#8706;</m:mo><m:mn>2</m:mn></m:msup><m:mi>F</m:mi></m:mrow>
  <m:mrow><m:mo>&#8706;</m:mo><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub><m:mo>&#8706;</m:mo><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:mrow>
 </m:mfrac>
</m:math>, for <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mn>3</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>&#160;and <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>i</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:math>.  (The upper triangle is not required because the matrix is symmetric.)</div></dd><dt class="paramhead"><a name="HESS2_LH" id="HESS2_LH"/>4: &#160;&#160;&#8194; LH &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the length of the array <a class="arg" href="../E04/e04lyf.xml#HESS2_HESLC">HESLC</a>.</div></dd><dt class="paramhead"><a name="HESS2_HESDC" id="HESS2_HESDC"/>5: &#160;&#160;&#8194; HESDC(<a class="arg" href="../E04/e04lyf.xml#HESS2_N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: must contain the diagonal elements of the second derivative matrix, i.e., set <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#HESS2_HESDC"><m:mi mathcolor="#EE0000" mathvariant="bold">HESDC</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow><m:mo>=</m:mo><m:mfrac other="display">
  <m:mrow><m:msup><m:mo>&#8706;</m:mo><m:mn>2</m:mn></m:msup><m:mi>F</m:mi></m:mrow>
  <m:mrow><m:mo>&#8706;</m:mo><m:msubsup><m:mi>x</m:mi><m:mi>j</m:mi><m:mn>2</m:mn></m:msubsup></m:mrow>
 </m:mfrac>
</m:math>, for <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.</div></dd><dt class="paramhead"><a name="HESS2_IUSER" id="HESS2_IUSER"/>6: &#160;&#160;&#8194; IUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; INTEGER array<span class="pclass">User Workspace</span></dt><dt class="multi-paramhead"><a name="HESS2_RUSER" id="HESS2_RUSER"/>7: &#160;&#160;&#8194; RUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">User Workspace</span></dt><dd><div class="paramtext"><a class="arg" href="#HESS2">HESS2</a> is called from E04LYF with the parameters <a class="arg" href="../E04/e04lyf.xml#HESS2_IUSER">IUSER</a> and <a class="arg" href="../E04/e04lyf.xml#HESS2_RUSER">RUSER</a> as supplied to E04LYF.  You are free to use the arrays <a class="arg" href="../E04/e04lyf.xml#HESS2_IUSER">IUSER</a> and <a class="arg" href="../E04/e04lyf.xml#HESS2_RUSER">RUSER</a> to supply information to <a class="arg" href="#HESS2">HESS2</a> as an alternative to using 
COMMON. 

</div></dd></dl>
</div>
<div class="paramtext"><a class="arg" href="#HESS2">HESS2</a> must be declared as EXTERNAL in the (sub)program from which E04LYF is called. Parameters denoted as <span class="italic">Input</span>  must <b>not</b>  be changed by this procedure.</div>
</dd><dt class="paramhead"><a name="BL" id="BL"/>5: &#160;&#160;&#8194; BL(<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: the lower bounds <m:math><m:msub><m:mi>l</m:mi><m:mi>j</m:mi></m:msub></m:math>.
<div class="paramtext">If <a class="arg" href="#IBOUND">IBOUND</a> is set to <m:math><m:mn>0</m:mn></m:math>, <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BL"><m:mi mathcolor="#EE0000" mathvariant="bold">BL</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;must be set to <m:math><m:msub><m:mi>l</m:mi><m:mi>j</m:mi></m:msub></m:math>, for <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.  (If a lower bound is not specified for any <m:math><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:math>, the corresponding <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BL"><m:mi mathcolor="#EE0000" mathvariant="bold">BL</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;should be set to <m:math><m:mrow><m:mo>-</m:mo><m:msup><m:mn>10</m:mn><m:mn>6</m:mn></m:msup></m:mrow></m:math>.)</div>
<div class="paramtext">If <a class="arg" href="#IBOUND">IBOUND</a> is set to <m:math><m:mn>3</m:mn></m:math>, you must set <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BL"><m:mi mathcolor="#EE0000" mathvariant="bold">BL</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>&#160;to <m:math><m:msub><m:mi>l</m:mi><m:mn>1</m:mn></m:msub></m:math>; E04LYF will then set the remaining elements of <a class="arg" href="#BL">BL</a> equal to <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BL"><m:mi mathcolor="#EE0000" mathvariant="bold">BL</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>.</div>
</div>
<div class="paramtext"><i>On exit</i>: the lower bounds actually used by E04LYF.</div></dd><dt class="paramhead"><a name="BU" id="BU"/>6: &#160;&#160;&#8194; BU(<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: the upper bounds <m:math><m:msub><m:mi>u</m:mi><m:mi>j</m:mi></m:msub></m:math>.
<div class="paramtext">If <a class="arg" href="#IBOUND">IBOUND</a> is set to <m:math><m:mn>0</m:mn></m:math>, <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BU"><m:mi mathcolor="#EE0000" mathvariant="bold">BU</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;must be set to <m:math><m:msub><m:mi>u</m:mi><m:mi>j</m:mi></m:msub></m:math>, for <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.  (If an upper bound is not specified for any <m:math><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;the corresponding <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BU"><m:mi mathcolor="#EE0000" mathvariant="bold">BU</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;should be set to <m:math><m:msup><m:mn>10</m:mn><m:mn>6</m:mn></m:msup></m:math>.)</div>
<div class="paramtext">If <a class="arg" href="#IBOUND">IBOUND</a> is set to <m:math><m:mn>3</m:mn></m:math>, you must set <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BU"><m:mi mathcolor="#EE0000" mathvariant="bold">BU</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>&#160;to <m:math><m:msub><m:mi>u</m:mi><m:mn>1</m:mn></m:msub></m:math>; E04LYF will then set the remaining elements of <a class="arg" href="#BU">BU</a> equal to <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BU"><m:mi mathcolor="#EE0000" mathvariant="bold">BU</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>.</div>
</div>
<div class="paramtext"><i>On exit</i>: the upper bounds actually used by E04LYF.</div></dd><dt class="paramhead"><a name="X" id="X"/>7: &#160;&#160;&#8194; X(<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#X"><m:mi mathcolor="#EE0000" mathvariant="bold">X</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;must be set to a guess at the <m:math><m:mi>j</m:mi></m:math>th component of the position of the minimum, for <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.  The routine checks the gradient and the Hessian matrix at the starting point, and is more likely to detect any error in your programming if the initial <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#X"><m:mi mathcolor="#EE0000" mathvariant="bold">X</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;are nonzero and mutually distinct.</div>
<div class="paramtext"><i>On exit</i>: the lowest point found during the calculations.  Thus, if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;on exit, <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#X"><m:mi mathcolor="#EE0000" mathvariant="bold">X</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;is the <m:math><m:mi>j</m:mi></m:math>th component of the position of the minimum.</div></dd><dt class="paramhead"><a name="F" id="F"/>8: &#160;&#160;&#8194; F &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the value of <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;corresponding to the final point stored in <a class="arg" href="#X">X</a>.</div></dd><dt class="paramhead"><a name="G" id="G"/>9: &#160;&#160;&#8194; G(<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the value of <m:math>
 <m:mfrac other="display">
  <m:mrow><m:mo>&#8706;</m:mo><m:mi>F</m:mi></m:mrow>
  <m:mrow><m:mo>&#8706;</m:mo><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:mrow>
 </m:mfrac>
</m:math>&#160;corresponding to the final point stored in <a class="arg" href="#X">X</a>, for <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>; the value of <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#G"><m:mi mathcolor="#EE0000" mathvariant="bold">G</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;for variables not on a bound should normally be close to zero.</div></dd><dt class="paramhead"><a name="IW" id="IW"/>10: &#8194; IW(<a class="arg" href="#LIW">LIW</a>) &#8211; INTEGER array<span class="pclass">Workspace</span></dt><dt class="multi-paramhead"><a name="LIW" id="LIW"/>11: &#8194; LIW &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the dimension of the array <a class="arg" href="#IW">IW</a> as declared in the (sub)program from which E04LYF is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LIW"><m:mi mathcolor="#EE0000" mathvariant="bold">LIW</m:mi></m:maction><m:mo>&#8805;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>+</m:mo><m:mn>2</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="W" id="W"/>12: &#8194; W(<a class="arg" href="#LW">LW</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Workspace</span></dt><dt class="multi-paramhead"><a name="LW" id="LW"/>13: &#8194; LW &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the dimension of the array <a class="arg" href="#W">W</a> as declared in the (sub)program from which E04LYF is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LW"><m:mi mathcolor="#EE0000" mathvariant="bold">LW</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>&#215;</m:mo><m:mfenced separators=""><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>+</m:mo><m:mn>7</m:mn></m:mfenced></m:mrow><m:mo>,</m:mo><m:mn>10</m:mn></m:mfenced></m:mrow></m:math>.
</div></dd><dt class="paramhead"><a name="IUSER" id="IUSER"/>14: &#8194; IUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; INTEGER array<span class="pclass">User Workspace</span></dt><dd><div class="paramtext"><b>Note:</b> the dimension of the array <a class="arg" href="#IUSER">IUSER</a>
must be at least
<m:math><m:mn>1</m:mn></m:math>.</div>
<div class="paramtext"><a class="arg" href="#IUSER">IUSER</a> is not used by E04LYF, but is passed directly to <a class="arg" href="#FUNCT2">FUNCT2</a> and <a class="arg" href="#HESS2">HESS2</a> and may be used to pass information to those routines.</div></dd><dt class="paramhead"><a name="RUSER" id="RUSER"/>15: &#8194; RUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">User Workspace</span></dt><dd><div class="paramtext"><b>Note:</b> the dimension of the array <a class="arg" href="#RUSER">RUSER</a>
must be at least
<m:math><m:mn>1</m:mn></m:math>.</div>
<div class="paramtext"><a class="arg" href="#RUSER">RUSER</a> is not used by E04LYF, but is passed directly to <a class="arg" href="#FUNCT2">FUNCT2</a> and <a class="arg" href="#HESS2">HESS2</a> and may be used to pass information to those routines.</div></dd><dt class="paramhead"><a name="IFAIL" id="IFAIL"/>16: &#8194; IFAIL &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><i>On entry</i>: <a class="arg" href="#IFAIL">IFAIL</a> must be set to <m:math><m:mn>0</m:mn></m:math>, <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>. If you are unfamiliar with this parameter you should refer to <a class="sec" href="../GENINT/essint.xml#library3">Section 3.3</a> in  the Essential Introduction for details.</div>
<div class="paramtext"><i>On exit</i>: <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;unless the routine detects an error (see <a class="sec" href="#errors">Section 6</a>).
<div class="paramtext">For environments where it might be inappropriate to halt program execution when an error is detected, the value <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>&#160;is recommended.  If the output of error messages is undesirable, then the value <m:math><m:mn>1</m:mn></m:math>&#160;is recommended.  Otherwise, because for this routine the values of the output parameters may be useful even if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>&#8800;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;on exit, the recommended value is <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:math>.  <b>When the value <m:math><m:mrow><m:mo>-</m:mo><m:mn mathvariant="bold">1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>&#160;is used it is essential to test the value of <a class="arg" href="#IFAIL">IFAIL</a> on exit.</b></div>
</div></dd></dl><h2 class="standard"><a class="sec" name="errors" id="errors"/>6&#160;&#160;Error Indicators and Warnings</h2>
<div class="paramtext">If on entry <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;or <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">-1</m:mn></m:maction></m:math>, explanatory error messages are output on the current error message unit (as defined by <a class="rout" href="../X04/x04aaf.xml">X04AAF</a>).</div><div class="paramtext"><b>Note:</b> E04LYF may return useful information for one or more of the following detected errors or warnings.</div><div class="paramtext">Errors or warnings detected by the routine:</div>
<dl class="ifail">
<dt class="errorhead"><a name="IFeq1" id="IFeq1"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math></dt>
<dd>
<table class="ifail"><tr><td class="ifail1">On&#160;entry,</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>1</m:mn></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IBOUND"><m:mi mathcolor="#EE0000" mathvariant="bold">IBOUND</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IBOUND"><m:mi mathcolor="#EE0000" mathvariant="bold">IBOUND</m:mi></m:maction><m:mo>&gt;</m:mo><m:mn>3</m:mn></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IBOUND"><m:mi mathcolor="#EE0000" mathvariant="bold">IBOUND</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>&#160;and <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BL"><m:mi mathcolor="#EE0000" mathvariant="bold">BL</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow><m:mo>&gt;</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BU"><m:mi mathcolor="#EE0000" mathvariant="bold">BU</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;for some <m:math><m:mi>j</m:mi></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IBOUND"><m:mi mathcolor="#EE0000" mathvariant="bold">IBOUND</m:mi></m:maction><m:mo>=</m:mo><m:mn>3</m:mn></m:math>&#160;and <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BL"><m:mi mathcolor="#EE0000" mathvariant="bold">BL</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow><m:mo>&gt;</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#BU"><m:mi mathcolor="#EE0000" mathvariant="bold">BU</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LIW"><m:mi mathcolor="#EE0000" mathvariant="bold">LIW</m:mi></m:maction><m:mo>&lt;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>+</m:mo><m:mn>2</m:mn></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LW"><m:mi mathcolor="#EE0000" mathvariant="bold">LW</m:mi></m:maction><m:mo>&lt;</m:mo><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>10</m:mn><m:mo>,</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>&#215;</m:mo><m:mfenced separators=""><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>+</m:mo><m:mn>7</m:mn></m:mfenced></m:mrow></m:mfenced></m:mrow></m:math>.</td></tr></table></dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq2" id="IFeq2"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>2</m:mn></m:math></dt>
<dd>
<div class="paramtext">There have been <m:math><m:mn>50</m:mn><m:mo>&#215;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>&#160;function evaluations,  yet the algorithm does not seem to be converging.  The calculations can be restarted from the final point held in <a class="arg" href="#X">X</a>.  The error may also indicate that <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;has no minimum.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq3" id="IFeq3"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>3</m:mn></m:math></dt>
<dd><div class="paramtext">
The conditions for a minimum have not all been met but a lower point could not be found and the algorithm has failed.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq4" id="IFeq4"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>4</m:mn></m:math></dt>
<dd>
<div class="paramtext">Not used.  (This value of the parameter is included so as to make the significance of <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFeq5"><m:mn mathcolor="#003399" mathvariant="bold">5</m:mn></m:maction></m:math>&#160;etc. consistent in the easy-to-use routines.)</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq5" id="IFeq5"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>5</m:mn></m:math></dt>
<dt class="multi-errorhead"><a name="IFeq6" id="IFeq6"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>6</m:mn></m:math></dt>
<dt class="multi-errorhead"><a name="IFeq7" id="IFeq7"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>7</m:mn></m:math></dt>
<dt class="multi-errorhead"><a name="IFeq8" id="IFeq8"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>8</m:mn></m:math></dt>
<dd>
<div class="paramtext">There is some doubt about whether the point <m:math><m:mi>x</m:mi></m:math>&#160;found by  E04LYF is a minimum.  The degree of confidence in the result decreases as <a class="arg" href="#IFAIL">IFAIL</a> increases.  Thus, when <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFeq5"><m:mn mathcolor="#003399" mathvariant="bold">5</m:mn></m:maction></m:math>&#160;it is probable that the final <m:math><m:mi>x</m:mi></m:math>&#160;gives a good estimate of the position of a minimum, but when <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFeq8"><m:mn mathcolor="#003399" mathvariant="bold">8</m:mn></m:maction></m:math>&#160;it is very unlikely that the routine has found a minimum.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq9" id="IFeq9"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>9</m:mn></m:math></dt>
<dd>
<div class="paramtext">In the search for a minimum, the modulus of one of the variables has become very large <m:math><m:mfenced separators=""><m:mo>&#8764;</m:mo><m:msup><m:mn>10</m:mn><m:mn>6</m:mn></m:msup></m:mfenced></m:math>.  This indicates that there is a mistake in user-supplied subroutines <a class="arg" href="#FUNCT2">FUNCT2</a> or <a class="arg" href="#HESS2">HESS2</a>, that your problem has no finite solution, or that the problem needs rescaling (see  <a class="sec" href="#fcomments">Section 8</a>).</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq10" id="IFeq10"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>10</m:mn></m:math></dt>
<dd><div class="paramtext">
It is very likely that you have made an error in forming the gradient.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq11" id="IFeq11"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>11</m:mn></m:math></dt>
<dd>
<div class="paramtext">It is very likely that you have made an error in forming the second derivatives.</div>
</dd>
</dl>
<div class="paramtext">If you are dissatisfied with the result (e.g., because <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFeq5"><m:mn mathcolor="#003399" mathvariant="bold">5</m:mn></m:maction></m:math>, <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFeq6"><m:mn mathcolor="#003399" mathvariant="bold">6</m:mn></m:maction></m:math>, <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFeq7"><m:mn mathcolor="#003399" mathvariant="bold">7</m:mn></m:maction></m:math>&#160;or <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFeq8"><m:mn mathcolor="#003399" mathvariant="bold">8</m:mn></m:maction></m:math>), 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.</div><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext">When a successful exit is made then, for a computer with a mantissa of <m:math><m:mi>t</m:mi></m:math>&#160;decimals, one would expect to get about <m:math><m:mi>t</m:mi><m:mo>/</m:mo><m:mn>2</m:mn><m:mo>-</m:mo><m:mn>1</m:mn></m:math>&#160;decimals accuracy in <m:math><m:mi>x</m:mi></m:math>, and about <m:math><m:mi>t</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:math>&#160;decimals accuracy in <m:math><m:mi>F</m:mi></m:math>, provided the problem is reasonably well scaled.</div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">The number of iterations required depends on the number of variables,  the behaviour of <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;and the distance of the starting point from the solution.  The number of operations performed in an iteration of E04LYF is roughly proportional to  <m:math><m:msup><m:mi>n</m:mi><m:mn>3</m:mn></m:msup><m:mo>+</m:mo><m:mrow><m:mi mathvariant="italic">O</m:mi><m:mfenced separators=""><m:msup><m:mi>n</m:mi><m:mn>2</m:mn></m:msup></m:mfenced></m:mrow></m:math>.  In addition, each iteration makes one call of <a class="arg" href="#HESS2">HESS2</a> and at least one call of <a class="arg" href="#FUNCT2">FUNCT2</a>.  So, unless  <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>, the gradient vector and the matrix of second derivatives can be evaluated very quickly, the run time will be dominated by the time spent in user-supplied subroutines <a class="arg" href="#FUNCT2">FUNCT2</a> and <a class="arg" href="#HESS2">HESS2</a>.</div><div class="paramtext">Ideally the problem should be scaled so that at the solution the value of <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;and the corresponding values of  <m:math><m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub><m:mo>,</m:mo><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:msub><m:mi>x</m:mi><m:mi>n</m:mi></m:msub></m:math>&#160;are each in the range <m:math><m:mfenced separators=""><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mo>,</m:mo><m:mrow><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:mfenced></m:math>, and so that at points a unit distance away from the solution, <m:math><m:mi>F</m:mi></m:math>&#160;is approximately a unit value greater than at the minimum.  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  E04LYF will take less computer time.</div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">A program to minimize

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>F</m:mi><m:mo>=</m:mo><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub><m:mo>+</m:mo><m:mn>10</m:mn><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mo>+</m:mo><m:mn>5</m:mn><m:mo>&#8290;</m:mo><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>3</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>4</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mo>+</m:mo><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub><m:mo>-</m:mo><m:mn>2</m:mn><m:msub><m:mi>x</m:mi><m:mn>3</m:mn></m:msub></m:mfenced>
<m:mn>4</m:mn></m:msup><m:mo>+</m:mo><m:mn>10</m:mn><m:mo>&#8290;</m:mo><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>4</m:mn></m:msub></m:mfenced>
<m:mn>4</m:mn></m:msup>
</m:math></td><td class="formula2"/></tr></table></div>

subject to

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mtable columnalign="right left">
 <m:mtr>
  <m:mtd><m:mn>1</m:mn></m:mtd>
  <m:mtd><m:mo>&#8804;</m:mo></m:mtd>
  <m:mtd><m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub></m:mtd>
  <m:mtd><m:mo>&#8804;</m:mo></m:mtd>
  <m:mtd><m:mn>3</m:mn></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>2</m:mn></m:mrow></m:mtd>
  <m:mtd><m:mo>&#8804;</m:mo></m:mtd>
  <m:mtd><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub></m:mtd>
  <m:mtd><m:mo>&#8804;</m:mo></m:mtd>
  <m:mtd><m:mn>0</m:mn></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:mn>1</m:mn></m:mtd>
  <m:mtd><m:mo>&#8804;</m:mo></m:mtd>
  <m:mtd><m:msub><m:mi>x</m:mi><m:mn>4</m:mn></m:msub></m:mtd>
  <m:mtd><m:mo>&#8804;</m:mo></m:mtd>
  <m:mtd><m:mn>3</m:mn><m:mtext>.</m:mtext></m:mtd>
 </m:mtr>
</m:mtable>
</m:math></td><td class="formula2"/></tr></table></div>

starting from the initial guess <m:math>
 <m:mfenced separators=""><m:mn>3</m:mn><m:mo>,</m:mo><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mo>,</m:mo><m:mn>0</m:mn><m:mo>,</m:mo><m:mn>1</m:mn></m:mfenced>
</m:math>.  (In practice,  it is worth trying to make user-supplied subroutines <a class="arg" href="#FUNCT2">FUNCT2</a> and <a class="arg" href="#HESS2">HESS2</a> as efficient as possible.  This has not been done in the example program for reasons of clarity.)</div><h3 class="standard"><a class="sec" name="examtext" id="examtext"/>9.1&#160;&#160;Program Text</h3>
<p><a class="verbatimref" href="../../examples/source/e04lyfe.f">Program Text (e04lyfe.f)</a></p><h3 class="standard"><a class="sec" name="examdata" id="examdata"/>9.2&#160;&#160;Program Data</h3>
<div class="paramtext">None.</div><h3 class="standard"><a class="sec" name="examresults" id="examresults"/>9.3&#160;&#160;Program Results</h3>
<p><a class="verbatimref" href="../../examples/baseresults/e04lyfe.r">Program Results (e04lyfe.r)</a></p>
<hr/><div><a class="rout" href="../../pdf/E04/e04lyf.pdf">E04LYF (PDF version)</a></div><div><a class="chap" href="e04conts.xml">E04 Chapter Contents</a></div><div><a class="chapint" href="e04intro.xml">E04 Chapter Introduction</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div>
<div><hr/><a class="genint" href="../FRONTMATTER/copyright.xml">&#169; The Numerical Algorithms Group Ltd, Oxford, UK. 2009</a></div></body></html>
