<?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>E04ZCF/E04ZCA : 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/e04zcf.pdf">E04ZCF/E04ZCA (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/>E04ZCF/E04ZCA</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="htmltoc" onclick="showLevel('tocspecification');"><span class="htmltocplus" id="tocspecificationplus">+</span><span class="htmltocminus" id="tocspecificationminus">&#8722;</span></span>
<a class="htmltoc" href="#specification">2&#160;&#160;<b>Specification</b></a>
<div class="htmltocitem" id="tocspecification">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#routFspec">2.1&#160;&#160;<b>Specification for E04ZCF</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#routAspec">2.2&#160;&#160;<b>Specification for E04ZCA</b></a>
</div>
</div>
</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">E04ZCF/E04ZCA checks that user-supplied subroutines for evaluating an objective function, constraint functions and their first derivatives,  produce derivative values which are consistent with the function and constraint values calculated.</div>
<div class="paramtext">E04ZCA is a version of E04ZCF that has additional parameters in order to make it safe for use in multithreaded applications (see <a class="sec" href="#parameters">Section 5</a>).</div><h2 class="standard"><a class="sec" name="specification" id="specification"/>2&#160;&#160;Specification</h2><h3 class="standard"><a class="sec" name="routFspec" id="routFspec"/>2.1&#160;&#160;Specification for E04ZCF</h3>
<table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;E04ZCF&#160;(</td><td class="tdfspec2"><a class="arg" href="#N">N</a>, <a class="arg" href="#NCNLN">NCNLN</a>, <a class="arg" href="#LDCJAC">LDCJAC</a>, <a class="arg" href="#CONFUN">CONFUN</a>, <a class="arg" href="#OBJFUN">OBJFUN</a>, <a class="arg" href="#C">C</a>, <a class="arg" href="#CJAC">CJAC</a>, <a class="arg" href="#OBJF">OBJF</a>, <a class="arg" href="#OBJGRD">OBJGRD</a>, <a class="arg" href="#X">X</a>, <a class="arg" href="#WORK">WORK</a>, <a class="arg" href="#LWORK">LWORK</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">N, NCNLN, LDCJAC, LWORK, IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">C(LDCJAC), CJAC(LDCJAC,N), OBJF, OBJGRD(N), X(N), WORK(LWORK)</td></tr><tr><td class="tdfspec1">EXTERNAL</td><td class="tdfspec2">CONFUN, OBJFUN</td></tr></table><h3 class="standard"><a class="sec" name="routAspec" id="routAspec"/>2.2&#160;&#160;Specification for E04ZCA</h3>
<table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;E04ZCA&#160;(</td><td class="tdfspec2"><a class="arg" href="#N">N</a>, <a class="arg" href="#NCNLN">NCNLN</a>, <a class="arg" href="#LDCJAC">LDCJAC</a>, <a class="arg" href="#CONFUN">CONFUN</a>, <a class="arg" href="#OBJFUN">OBJFUN</a>, <a class="arg" href="#C">C</a>, <a class="arg" href="#CJAC">CJAC</a>, <a class="arg" href="#OBJF">OBJF</a>, <a class="arg" href="#OBJGRD">OBJGRD</a>, <a class="arg" href="#X">X</a>, <a class="arg" href="#WORK">WORK</a>, <a class="arg" href="#LWORK">LWORK</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, NCNLN, LDCJAC, LWORK, IUSER(*), IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">C(LDCJAC), CJAC(LDCJAC,N), OBJF, OBJGRD(N), X(N), WORK(LWORK), RUSER(*)</td></tr><tr><td class="tdfspec1">EXTERNAL</td><td class="tdfspec2">CONFUN, OBJFUN</td></tr></table><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">Routines for minimizing a function of several variables subject to general equality and/or inequality constraints may require you to provide subroutines to evaluate the objective 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>, constraint functions  <m:math><m:msub><m:mi>c</m:mi><m:mi>i</m:mi></m:msub><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>, for <m:math><m:mi>i</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>m</m:mi></m:math>,  and their first derivatives.  E04ZCF/E04ZCA is designed to check the derivatives calculated by such user-supplied subroutines .  As well as the routines to be checked (<a class="arg" href="#CONFUN">CONFUN</a> and <a class="arg" href="#OBJFUN">OBJFUN</a>), you must supply a point  <m:math><m:mi>x</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: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:mi mathvariant="normal">T</m:mi></m:msup></m:math>&#160;at which the checks will be made.</div><div class="paramtext">To check the first derivatives of <m:math><m:mi>F</m:mi></m:math>, the routine  first calls <a class="arg" href="#OBJFUN">OBJFUN</a> to evaluate <m:math><m:mi>F</m:mi></m:math>&#160;and its first derivatives  <m:math><m:msub><m:mi>g</m:mi><m:mi>j</m:mi></m:msub><m:mo>=</m:mo><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>, 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>, at <m:math><m:mi>x</m:mi></m:math>.  The components of the user-supplied derivatives along two orthogonal directions (defined by unit vectors <m:math><m:msub><m:mi>p</m:mi><m:mn>1</m:mn></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>p</m:mi><m:mn>2</m:mn></m:msub></m:math>, say) are then calculated; these will be <m:math><m:msup><m:mi>g</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:msub><m:mi>p</m:mi><m:mn>1</m:mn></m:msub></m:math>&#160;and  <m:math><m:msup><m:mi>g</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:msub><m:mi>p</m:mi><m:mn>2</m:mn></m:msub></m:math>&#160;respectively.  The same components are also estimated by finite differences, giving quantities

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msub><m:mi>v</m:mi><m:mi>k</m:mi></m:msub><m:mo>=</m:mo><m:mfrac><m:mrow><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi><m:mo>+</m:mo><m:mi>h</m:mi><m:msub><m:mi>p</m:mi><m:mi>k</m:mi></m:msub></m:mfenced><m:mo>-</m:mo><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mrow><m:mi>h</m:mi></m:mfrac><m:mtext>, &#8195;</m:mtext><m:mi>k</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn>
</m:math></td><td class="formula2"/></tr></table></div>

where <m:math><m:mi>h</m:mi></m:math>&#160;is a small positive scalar.  If the relative difference between <m:math><m:msub><m:mi>v</m:mi><m:mn>1</m:mn></m:msub></m:math>&#160;and <m:math><m:msup><m:mi>g</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:msub><m:mi>p</m:mi><m:mn>1</m:mn></m:msub></m:math>&#160;or between  <m:math><m:msub><m:mi>v</m:mi><m:mn>2</m:mn></m:msub></m:math>&#160;and <m:math><m:msup><m:mi>g</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:msub><m:mi>p</m:mi><m:mn>2</m:mn></m:msub></m:math>&#160;is &#8216;judged&#8217; too large,  the error indicator <a class="arg" href="#IFAIL">IFAIL</a> (see <a class="sec" href="#errors">Section 6</a>) is set to <m:math><m:mn>2</m:mn></m:math>.</div><div class="paramtext">When <m:math><m:mi>n</m:mi><m:mo>=</m:mo><m:mn>1</m:mn></m:math>&#160;only <m:math><m:msub><m:mi>p</m:mi><m:mn>1</m:mn></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>v</m:mi><m:mn>1</m:mn></m:msub></m:math>&#160;are generated.</div><div class="paramtext">Similar checks are made of whether components of the first derivatives

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mfrac other="display">
  <m:mrow>
   <m:mo>&#8706;</m:mo>
   <m:msub>
    <m:mi>c</m:mi>
    <m:mi>i</m:mi>
   </m:msub>
  </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:mtext>, &#8195;</m:mtext>
 <m:mi>i</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>m</m:mi>
 <m:mtext>&#8203; and &#8203;</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>

(as calculated by <a class="arg" href="#CONFUN">CONFUN</a> at <m:math><m:mi>x</m:mi></m:math>) are consistent with difference approximations to the same quantities.</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2><div class="paramtext"><a name="ref079" id="ref079"/>Gill P E, Murray W and Wright M H (1981)  <i>Practical Optimization</i> Academic Press </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 in the objective and constraint functions.</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="NCNLN" id="NCNLN"/>2: &#160;&#160;&#8194; NCNLN &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the number <m:math><m:mi>m</m:mi></m:math>&#160;of constraint functions.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCNLN"><m:mi mathcolor="#EE0000" mathvariant="bold">NCNLN</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>0</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="LDCJAC" id="LDCJAC"/>3: &#160;&#160;&#8194; LDCJAC &#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="#C">C</a> and 
the first dimension of the array <a class="arg" href="#CJAC">CJAC</a> as declared in the (sub)program from which E04ZCF/E04ZCA is called.
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDCJAC"><m:mi mathcolor="#EE0000" mathvariant="bold">LDCJAC</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:mn>1</m:mn><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCNLN"><m:mi mathcolor="#EE0000" mathvariant="bold">NCNLN</m:mi></m:maction></m:mfenced></m:mrow></m:math>.
</div></dd><dt class="paramhead"><a name="CONFUN" id="CONFUN"/>4: &#160;&#160;&#8194; CONFUN &#8211; SUBROUTINE, supplied by the NAG Library or the user.<span class="pclass">External Procedure</span></dt><dd><div class="paramtext"><a class="arg" href="#CONFUN">CONFUN</a> must calculate the vector <m:math><m:mi>c</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;of nonlinear constraint functions and its Jacobian for a specified <m:math><m:mi>n</m:mi></m:math>-vector <m:math><m:mi>x</m:mi></m:math>.  If there are no nonlinear constraints (<m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CONFUN_NCNLN"><m:mi mathcolor="#EE0000" mathvariant="bold">NCNLN</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>), <a class="arg" href="#CONFUN">CONFUN</a> will not be called by E04ZCF/E04ZCA and <a class="arg" href="#CONFUN">CONFUN</a> may be the dummy routine E04VDM/E54VDM.  (E04VDM/E54VDM is included in the NAG Library.) If there are nonlinear constraints, E04ZCF/E04ZCA always calls <a class="arg" href="#CONFUN">CONFUN</a> and <a class="arg" href="#OBJFUN">OBJFUN</a> together, in that order.</div><div class="subprog">
<div class="paramtext">The specification of 
   <a class="arg" href="#CONFUN">CONFUN</a>
   for E04ZCF is:</div><table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;CONFUN&#160;(</td><td class="tdfspec2"><a class="arg" href="../E04/e04zcf.xml#CONFUN_MODE">MODE</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_NCNLN">NCNLN</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_N">N</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_LDCJAC">LDCJAC</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_X">X</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_C">C</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_CJAC">CJAC</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_NSTATE">NSTATE</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">MODE, NCNLN, N, LDCJAC, NSTATE</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">X(N), C(LDCJAC), CJAC(LDCJAC,N)</td></tr></table>
<div class="paramtext">The specification of 
   <a class="arg" href="#CONFUN">CONFUN</a>
   for E04ZCA is:</div><table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;CONFUN&#160;(</td><td class="tdfspec2"><a class="arg" href="../E04/e04zcf.xml#CONFUN_MODE">MODE</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_NCNLN">NCNLN</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_N">N</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_LDCJAC">LDCJAC</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_X">X</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_C">C</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_CJAC">CJAC</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_NSTATE">NSTATE</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_IUSER">IUSER</a>, <a class="arg" href="../E04/e04zcf.xml#CONFUN_RUSER">RUSER</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">MODE, NCNLN, N, LDCJAC, NSTATE, IUSER(*)</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">X(N), C(LDCJAC), CJAC(LDCJAC,N), RUSER(*)</td></tr></table>
<dl><dt class="paramhead"><a name="CONFUN_MODE" id="CONFUN_MODE"/>1: &#160;&#160;&#8194; MODE &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><a class="arg" href="../E04/e04zcf.xml#CONFUN_MODE">MODE</a> is a flag that you may set within <a class="arg" href="#CONFUN">CONFUN</a> to indicate a failure in the evaluation of the nonlinear constraints.</div>
<div class="paramtext"><i>On entry</i>: is always non-negative.</div>
<div class="paramtext"><i>On exit</i>: if <a class="arg" href="../E04/e04zcf.xml#CONFUN_MODE">MODE</a> is negative on exit from <a class="arg" href="#CONFUN">CONFUN</a>, then execution of E04ZCF/E04ZCA will be terminated with <a class="arg" href="#IFAIL">IFAIL</a> containing the negative value of <a class="arg" href="../E04/e04zcf.xml#CONFUN_MODE">MODE</a>.</div></dd><dt class="paramhead"><a name="CONFUN_NCNLN" id="CONFUN_NCNLN"/>2: &#160;&#160;&#8194; NCNLN &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the number <m:math><m:mi>m</m:mi></m:math>&#160;of nonlinear constraints, as input to E04ZCF/E04ZCA.</div></dd><dt class="paramhead"><a name="CONFUN_N" id="CONFUN_N"/>3: &#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, as input to E04ZCF/E04ZCA.</div></dd><dt class="paramhead"><a name="CONFUN_LDCJAC" id="CONFUN_LDCJAC"/>4: &#160;&#160;&#8194; LDCJAC &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the first dimension of the array <a class="arg" href="../E04/e04zcf.xml#CONFUN_CJAC">CJAC</a> and the length of the array <a class="arg" href="../E04/e04zcf.xml#CONFUN_C">C</a>, as input to E04ZCF/E04ZCA.</div></dd><dt class="paramhead"><a name="CONFUN_X" id="CONFUN_X"/>5: &#160;&#160;&#8194; X(<a class="arg" href="../E04/e04zcf.xml#CONFUN_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 vector <m:math><m:mi>x</m:mi></m:math>&#160;of variables at which the constraint functions are to be evaluated.</div></dd><dt class="paramhead"><a name="CONFUN_C" id="CONFUN_C"/>6: &#160;&#160;&#8194; C(<a class="arg" href="../E04/e04zcf.xml#CONFUN_LDCJAC">LDCJAC</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 <a class="arg" href="../E04/e04zcf.xml#CONFUN_NCNLN">NCNLN</a> nonlinear constraint values, with the value of the <m:math><m:mi>j</m:mi></m:math>th nonlinear constraint in <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CONFUN_C"><m:mi mathcolor="#EE0000" mathvariant="bold">C</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>.</div></dd><dt class="paramhead"><a name="CONFUN_CJAC" id="CONFUN_CJAC"/>7: &#160;&#160;&#8194; CJAC(<a class="arg" href="../E04/e04zcf.xml#CONFUN_LDCJAC">LDCJAC</a>,<a class="arg" href="../E04/e04zcf.xml#CONFUN_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 Jacobian of the nonlinear constraint functions with the <m:math><m:mi>i</m:mi></m:math>th row of <a class="arg" href="../E04/e04zcf.xml#CONFUN_CJAC">CJAC</a> containing the gradient of the <m:math><m:mi>i</m:mi></m:math>th nonlinear constraint, i.e., <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CONFUN_CJAC"><m:mi mathcolor="#EE0000" mathvariant="bold">CJAC</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;must contain the partial derivative of <m:math><m:msub><m:mi>c</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;with respect to <m:math><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:math>.  If <a class="arg" href="../E04/e04zcf.xml#CONFUN_CJAC">CJAC</a> contains any constant elements, a saving in computation can be made by setting them once only, when <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CONFUN_NSTATE"><m:mi mathcolor="#EE0000" mathvariant="bold">NSTATE</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>.</div></dd><dt class="paramhead"><a name="CONFUN_NSTATE" id="CONFUN_NSTATE"/>8: &#160;&#160;&#8194; NSTATE &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: will be <m:math><m:mn>1</m:mn></m:math>&#160;on the first call to <a class="arg" href="#CONFUN">CONFUN</a> by E04ZCF/E04ZCA, and is <m:math><m:mn>0</m:mn></m:math>&#160;for the two subsequent calls.  Thus, if you wish, <a class="arg" href="../E04/e04zcf.xml#CONFUN_NSTATE">NSTATE</a> may be tested within <a class="arg" href="#CONFUN">CONFUN</a> in order to perform certain calculations once only.  For example, you may read data or initialize COMMON block global variables when <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CONFUN_NSTATE"><m:mi mathcolor="#EE0000" mathvariant="bold">NSTATE</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>.  In addition, the constant elements of <a class="arg" href="../E04/e04zcf.xml#CONFUN_CJAC">CJAC</a> can be set in <a class="arg" href="#CONFUN">CONFUN</a> when <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CONFUN_NSTATE"><m:mi mathcolor="#EE0000" mathvariant="bold">NSTATE</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>, and need not be defined on subsequent calls.</div></dd><dd class="note"><b>Note:</b> <span class="italic"> the following are additional parameters for specific use with E04ZCA.  Users of E04ZCF therefore need not read the remainder of this description</span>.</dd><dt class="paramhead"><a name="CONFUN_IUSER" id="CONFUN_IUSER"/>9: &#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="CONFUN_RUSER" id="CONFUN_RUSER"/>10: &#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="#CONFUN">CONFUN</a> is called from E04ZCA with the parameters <a class="arg" href="../E04/e04zcf.xml#CONFUN_IUSER">IUSER</a> and <a class="arg" href="../E04/e04zcf.xml#CONFUN_RUSER">RUSER</a> as supplied to E04ZCA.  You are free to use the arrays <a class="arg" href="../E04/e04zcf.xml#CONFUN_IUSER">IUSER</a> and <a class="arg" href="../E04/e04zcf.xml#CONFUN_RUSER">RUSER</a> to supply information to <a class="arg" href="#CONFUN">CONFUN</a>.</div></dd></dl>
</div>
<div class="paramtext"><a class="arg" href="#CONFUN">CONFUN</a> must be declared as EXTERNAL in the (sub)program from which E04ZCF/E04ZCA 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="OBJFUN" id="OBJFUN"/>5: &#160;&#160;&#8194; OBJFUN &#8211; SUBROUTINE, supplied by the user.<span class="pclass">External Procedure</span></dt><dd><div class="paramtext"><a class="arg" href="#OBJFUN">OBJFUN</a> must calculate the objective function <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;and its gradient for a specified <m:math><m:mi>n</m:mi></m:math>-element vector <m:math><m:mi>x</m:mi></m:math>.</div><div class="subprog">
<div class="paramtext">The specification of 
   <a class="arg" href="#OBJFUN">OBJFUN</a>
   for E04ZCF is:</div><table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;OBJFUN&#160;(</td><td class="tdfspec2"><a class="arg" href="../E04/e04zcf.xml#OBJFUN_MODE">MODE</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_N">N</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_X">X</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_OBJF">OBJF</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_OBJGRD">OBJGRD</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_NSTATE">NSTATE</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">MODE, N, NSTATE</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">X(N), OBJF, OBJGRD(N)</td></tr></table>
<div class="paramtext">The specification of 
   <a class="arg" href="#OBJFUN">OBJFUN</a>
   for E04ZCA is:</div><table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;OBJFUN&#160;(</td><td class="tdfspec2"><a class="arg" href="../E04/e04zcf.xml#OBJFUN_MODE">MODE</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_N">N</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_X">X</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_OBJF">OBJF</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_OBJGRD">OBJGRD</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_NSTATE">NSTATE</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_IUSER">IUSER</a>, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_RUSER">RUSER</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">MODE, N, NSTATE, IUSER(*)</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">X(N), OBJF, OBJGRD(N), RUSER(*)</td></tr></table>
<dl><dt class="paramhead"><a name="OBJFUN_MODE" id="OBJFUN_MODE"/>1: &#160;&#160;&#8194; MODE &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><a class="arg" href="../E04/e04zcf.xml#OBJFUN_MODE">MODE</a> is a flag that you may set within <a class="arg" href="#OBJFUN">OBJFUN</a> to indicate a failure in the evaluation of the objective function.</div>
<div class="paramtext"><i>On entry</i>: is always non-negative.</div>
<div class="paramtext"><i>On exit</i>: if <a class="arg" href="../E04/e04zcf.xml#OBJFUN_MODE">MODE</a> is negative on exit from <a class="arg" href="#OBJFUN">OBJFUN</a>, then execution of E04ZCF/E04ZCA will be terminated with <a class="arg" href="#IFAIL">IFAIL</a> set to <a class="arg" href="../E04/e04zcf.xml#OBJFUN_MODE">MODE</a>.</div></dd><dt class="paramhead"><a name="OBJFUN_N" id="OBJFUN_N"/>2: &#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 as input to E04ZCF/E04ZCA.</div></dd><dt class="paramhead"><a name="OBJFUN_X" id="OBJFUN_X"/>3: &#160;&#160;&#8194; X(<a class="arg" href="../E04/e04zcf.xml#OBJFUN_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 vector <m:math><m:mi>x</m:mi></m:math>&#160;of variables at which the objective function is to be evaluated.</div></dd><dt class="paramhead"><a name="OBJFUN_OBJF" id="OBJFUN_OBJF"/>4: &#160;&#160;&#8194; OBJF &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: must be set to the value of the objective function.</div></dd><dt class="paramhead"><a name="OBJFUN_OBJGRD" id="OBJFUN_OBJGRD"/>5: &#160;&#160;&#8194; OBJGRD(<a class="arg" href="../E04/e04zcf.xml#OBJFUN_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 gradient vector of the objective function, with <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#OBJFUN_OBJGRD"><m:mi mathcolor="#EE0000" mathvariant="bold">OBJGRD</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;containing the partial derivative of <m:math><m:mi>F</m:mi></m:math>&#160;with respect to <m:math><m:msub><m:mi>x</m:mi><m:mi>j</m:mi></m:msub></m:math>.</div></dd><dt class="paramhead"><a name="OBJFUN_NSTATE" id="OBJFUN_NSTATE"/>6: &#160;&#160;&#8194; NSTATE &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: will be <m:math><m:mn>1</m:mn></m:math>&#160;on the first call to <a class="arg" href="#OBJFUN">OBJFUN</a> by E04ZCF/E04ZCA, and is <m:math><m:mn>0</m:mn></m:math>&#160;on the two subsequent calls.  Thus, if you wish, <a class="arg" href="../E04/e04zcf.xml#OBJFUN_NSTATE">NSTATE</a> may be tested in order to perform certain calculations only on the first call of <a class="arg" href="#OBJFUN">OBJFUN</a>, e.g., read data or initialize COMMON blocksglobal variables.  Note that if there are any nonlinear constraints, <a class="arg" href="#CONFUN">CONFUN</a> and <a class="arg" href="#OBJFUN">OBJFUN</a> are called together, in that order.</div></dd><dd class="note"><b>Note:</b> <span class="italic"> the following are additional parameters for specific use with E04ZCA.  Users of E04ZCF therefore need not read the remainder of this description</span>.</dd><dt class="paramhead"><a name="OBJFUN_IUSER" id="OBJFUN_IUSER"/>7: &#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="OBJFUN_RUSER" id="OBJFUN_RUSER"/>8: &#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="#OBJFUN">OBJFUN</a> is called from E04ZCA with the parameters <a class="arg" href="../E04/e04zcf.xml#OBJFUN_IUSER">IUSER</a> and <a class="arg" href="../E04/e04zcf.xml#OBJFUN_RUSER">RUSER</a> as supplied to E04ZCA.  You are free to use the arrays <a class="arg" href="../E04/e04zcf.xml#OBJFUN_IUSER">IUSER</a> and <a class="arg" href="../E04/e04zcf.xml#OBJFUN_RUSER">RUSER</a> to supply information to <a class="arg" href="#OBJFUN">OBJFUN</a>.</div></dd></dl>
</div>
<div class="paramtext"><a class="arg" href="#OBJFUN">OBJFUN</a> must be declared as EXTERNAL in the (sub)program from which E04ZCF/E04ZCA 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="C" id="C"/>6: &#160;&#160;&#8194; C(<a class="arg" href="#LDCJAC">LDCJAC</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: unless you set <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CONFUN_MODE"><m:mi mathcolor="#EE0000" mathvariant="bold">MODE</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>&#160;in the first call of <a class="arg" href="#CONFUN">CONFUN</a>, <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#C"><m:mi mathcolor="#EE0000" mathvariant="bold">C</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow></m:math>&#160;contains the value of <m:math><m:msub><m:mi>c</m:mi><m:mi>i</m:mi></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;at the point given in <a class="arg" href="#X">X</a>, for <m:math><m:mi>i</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>m</m:mi></m:math>.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCNLN"><m:mi mathcolor="#EE0000" mathvariant="bold">NCNLN</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>, <a class="arg" href="#C">C</a> is not referenced.</div>
</div></dd><dt class="paramhead"><a name="CJAC" id="CJAC"/>7: &#160;&#160;&#8194; CJAC(<a class="arg" href="#LDCJAC">LDCJAC</a>,<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>: unless you set <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CONFUN_MODE"><m:mi mathcolor="#EE0000" mathvariant="bold">MODE</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>&#160;in the first call of <a class="arg" href="#CONFUN">CONFUN</a>, <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CJAC"><m:mi mathcolor="#EE0000" mathvariant="bold">CJAC</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;contains the value of the derivative <m:math>
 <m:mfrac other="display">
  <m:mrow><m:mo>&#8706;</m:mo><m:msub><m:mi>c</m:mi><m:mi>i</m:mi></m:msub></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 given in <a class="arg" href="#X">X</a>, as calculated by <a class="arg" href="#CONFUN">CONFUN</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>&#160;and <m:math><m:mi>i</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>m</m:mi></m:math>.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCNLN"><m:mi mathcolor="#EE0000" mathvariant="bold">NCNLN</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>, <a class="arg" href="#CJAC">CJAC</a> is not referenced.</div>
</div></dd><dt class="paramhead"><a name="OBJF" id="OBJF"/>8: &#160;&#160;&#8194; OBJF &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: unless you set <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#OBJFUN_MODE"><m:mi mathcolor="#EE0000" mathvariant="bold">MODE</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>&#160;in the first call of <a class="arg" href="#OBJFUN">OBJFUN</a>, <a class="arg" href="#OBJF">OBJF</a> contains the value of the objective function <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;at the point given in <a class="arg" href="#X">X</a>.</div></dd><dt class="paramhead"><a name="OBJGRD" id="OBJGRD"/>9: &#160;&#160;&#8194; OBJGRD(<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>: unless you set <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#OBJFUN_MODE"><m:mi mathcolor="#EE0000" mathvariant="bold">MODE</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>&#160;in the first call of <a class="arg" href="#OBJFUN">OBJFUN</a>, <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#OBJGRD"><m:mi mathcolor="#EE0000" mathvariant="bold">OBJGRD</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;contains the value of the 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 given in <a class="arg" href="#X">X</a>, as calculated by <a class="arg" href="#OBJFUN">OBJFUN</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>.</div></dd><dt class="paramhead"><a name="X" id="X"/>10: &#8194; X(<a class="arg" href="#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>: <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>, 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>, must be set to the co-ordinates of a suitable point <m:math><m:mi>x</m:mi></m:math>&#160;to check the derivatives calculated by <a class="arg" href="#CONFUN">CONFUN</a> and <a class="arg" href="#OBJFUN">OBJFUN</a>.  &#8216;Obvious&#8217; settings such as <m:math><m:mn>0</m:mn></m:math>&#160;or <m:math><m:mn>1</m:mn></m:math>, should not be used since, at such points, incorrect terms may take correct values (particularly zero), so that errors could go undetected.  Similarly, it is preferable that no two elements of <m:math><m:mi>x</m:mi></m:math>&#160;should be equal.</div></dd><dt class="paramhead"><a name="WORK" id="WORK"/>11: &#8194; WORK(<a class="arg" href="#LWORK">LWORK</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Workspace</span></dt><dt class="multi-paramhead"><a name="LWORK" id="LWORK"/>12: &#8194; LWORK &#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="#WORK">WORK</a> as declared in the (sub)program from which E04ZCF/E04ZCA is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LWORK"><m:mi mathcolor="#EE0000" mathvariant="bold">LWORK</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>4</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:mo>+</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCNLN"><m:mi mathcolor="#EE0000" mathvariant="bold">NCNLN</m:mi></m:maction><m:mo>+</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>&#215;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDCJAC"><m:mi mathcolor="#EE0000" mathvariant="bold">LDCJAC</m:mi></m:maction></m:math>.
</div></dd><dt class="paramhead"><a name="IFAIL" id="IFAIL"/>13: &#8194; IFAIL &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><b>Note:</b> <span class="italic">for E04ZCA, <a class="arg" href="#IFAIL">IFAIL</a> does not occur in this position in the parameter list.  See the additional parameters described below</span>.</div><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><dd class="note"><b>Note:</b> <span class="italic"> the following are additional parameters for specific use with E04ZCA.  Users of E04ZCF therefore need not read the remainder of this description</span>.</dd><dt class="paramhead"><a name="IUSER" id="IUSER"/>13: &#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 E04ZCA, but is passed directly to <a class="arg" href="#CONFUN">CONFUN</a> and <a class="arg" href="#OBJFUN">OBJFUN</a> and may be used to pass information to that routine.</div></dd><dt class="paramhead"><a name="RUSER" id="RUSER"/>14: &#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 E04ZCA, but is passed directly to <a class="arg" href="#CONFUN">CONFUN</a> and <a class="arg" href="#OBJFUN">OBJFUN</a> and may be used to pass information to that routine.</div></dd><dt class="paramhead"><a name="IFAIL2" id="IFAIL2"/>15: &#8194; IFAIL &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><b>Note:</b> see the parameter description for <a class="arg" href="#IFAIL">IFAIL</a> above.</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> E04ZCF/E04ZCA 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="IFlt0" id="IFlt0"/><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>&lt;</m:mo><m:mn>0</m:mn></m:math></dt>
<dd>
<div class="paramtext">A negative value of <a class="arg" href="#IFAIL">IFAIL</a> indicates an exit from E04ZCF/E04ZCA because you have set <a class="arg" href="../E04/e04zcf.xml#OBJFUN_MODE">MODE</a> negative in <a class="arg" href="#OBJFUN">OBJFUN</a> or <a class="arg" href="#CONFUN">CONFUN</a>.  The value of <a class="arg" href="#IFAIL">IFAIL</a> will be the same as your setting of <a class="arg" href="../E04/e04zcf.xml#OBJFUN_MODE">MODE</a>.  The checks on <a class="arg" href="#OBJFUN">OBJFUN</a> and <a class="arg" href="#CONFUN">CONFUN</a> will not have been completed.</div>
</dd>
</dl><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="#NCNLN"><m:mi mathcolor="#EE0000" mathvariant="bold">NCNLN</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="#LDCJAC"><m:mi mathcolor="#EE0000" mathvariant="bold">LDCJAC</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>1</m:mn><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCNLN"><m:mi mathcolor="#EE0000" mathvariant="bold">NCNLN</m:mi></m:maction></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="#LWORK"><m:mi mathcolor="#EE0000" mathvariant="bold">LWORK</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>4</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:mo>+</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCNLN"><m:mi mathcolor="#EE0000" mathvariant="bold">NCNLN</m:mi></m:maction><m:mo>+</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>&#215;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDCJAC"><m:mi mathcolor="#EE0000" mathvariant="bold">LDCJAC</m:mi></m:maction></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">You should check carefully the derivation and programming of expressions for the derivatives of <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>, because it is very unlikely that  <a class="arg" href="#OBJFUN">OBJFUN</a> is calculating them correctly.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq2a" id="IFeq2a"/><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:mo>+</m:mo><m:mi>i</m:mi></m:math>, for <m:math><m:mi>i</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:maction actiontype="link" dsi:type="simple" dsi:href="#NCNLN"><m:mi mathcolor="#EE0000" mathvariant="bold">NCNLN</m:mi></m:maction></m:math>&#160;</dt>
<dd>
<div class="paramtext">You should check carefully the derivation and programming of expressions for the derivatives of <m:math><m:msub><m:mi>c</m:mi><m:mi>i</m:mi></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>, because it is very unlikely that <a class="arg" href="#CONFUN">CONFUN</a> is calculating them correctly.  See also <a class="sec" href="#accuracy">Section 7</a>.</div>
</dd>
</dl><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext"><a class="arg" href="#IFAIL">IFAIL</a> is set to <m:math><m:mn>2</m:mn></m:math>&#160;if

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msup>
<m:mfenced separators=""><m:msub><m:mi>v</m:mi><m:mi>k</m:mi></m:msub><m:mo>-</m:mo><m:msup><m:mi>g</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:msub><m:mi>p</m:mi><m:mi>k</m:mi></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mo>&#8805;</m:mo><m:mi>h</m:mi><m:mo>&#215;</m:mo><m:mfenced separators=""><m:msup>
<m:mfenced separators=""><m:msup><m:mi>g</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:msub><m:mi>p</m:mi><m:mi>k</m:mi></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mo>+</m:mo><m:mn>1</m:mn></m:mfenced>
</m:math></td><td class="formula2"/></tr></table></div>

for <m:math><m:mi>k</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>2</m:mn></m:math>.  (See <a class="sec" href="#description">Section 3</a> for definitions of the quantities involved.)  The scalar <m:math><m:mi>h</m:mi></m:math>&#160;is set equal to <m:math><m:msqrt><m:mi>&#949;</m:mi></m:msqrt></m:math>, where <m:math><m:mi>&#949;</m:mi></m:math>&#160;is the <span class="bitalic">machine precision</span> (see <a class="rout" href="../X02/x02ajf.xml">X02AJF</a>).</div><div class="paramtext"><a class="arg" href="#IFAIL">IFAIL</a> is set to <m:math><m:mn>2</m:mn><m:mo>+</m:mo><m:mi>i</m:mi></m:math>&#160;if a relation analogous to that given above holds for <m:math><m:msub><m:mi>c</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;and its calculated derivatives.</div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">The user-supplied subroutines <a class="arg" href="#CONFUN">CONFUN</a> and <a class="arg" href="#OBJFUN">OBJFUN</a> are both called three times unless <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCNLN"><m:mi mathcolor="#EE0000" mathvariant="bold">NCNLN</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>, in which case <a class="arg" href="#CONFUN">CONFUN</a> is not called.</div><div class="paramtext">Before using E04ZCF/E04ZCA to check the calculation of first derivatives, you should be confident that <a class="arg" href="#CONFUN">CONFUN</a> and <a class="arg" href="#OBJFUN">OBJFUN</a> are calculating <m:math><m:mi>F</m:mi></m:math>&#160;and the <m:math><m:msub><m:mi>c</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;correctly.  The usual way of checking the calculation of these function values is to compare values of <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;and the <m:math><m:msub><m:mi>c</m:mi><m:mi>i</m:mi></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;calculated by <a class="arg" href="#OBJFUN">OBJFUN</a> and <a class="arg" href="#CONFUN">CONFUN</a> at nontrivial points <m:math><m:mi>x</m:mi></m:math>&#160;with values calculated independently.  (&#8216;Non-trivial&#8217; means that,  as when setting <m:math><m:mi>x</m:mi></m:math>&#160;before calling E04ZCF/E04ZCA,  co-ordinates such as <m:math><m:mn>0</m:mn></m:math>&#160;or <m:math><m:mn>1</m:mn></m:math>&#160;should be avoided.)</div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">This example has nine variables, finite bounds on six of the variables, four general linear constraints, and <m:math><m:mn>15</m:mn></m:math>&#160;nonlinear constraints.</div><div class="paramtext">The objective function is

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced><m:mo>=</m:mo><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub><m:msub><m:mi>x</m:mi><m:mn>6</m:mn></m:msub><m:mo>+</m:mo><m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub><m:msub><m:mi>x</m:mi><m:mn>7</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>3</m:mn></m:msub><m:msub><m:mi>x</m:mi><m:mn>7</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>5</m:mn></m:msub><m:msub><m:mi>x</m:mi><m:mn>8</m:mn></m:msub><m:mo>+</m:mo><m:msub><m:mi>x</m:mi><m:mn>4</m:mn></m:msub><m:msub><m:mi>x</m:mi><m:mn>9</m:mn></m:msub><m:mo>+</m:mo><m:msub><m:mi>x</m:mi><m:mn>3</m:mn></m:msub><m:msub><m:mi>x</m:mi><m:mn>8</m:mn></m:msub>
</m:math></td><td class="formula2"/></tr></table></div>

and the <m:math><m:mn>15</m:mn></m:math>&#160;nonlinear constraint functions are

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mtable columnalign="left center left">
 <m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>1</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:msubsup><m:mi>x</m:mi><m:mn>1</m:mn><m:mn>2</m:mn></m:msubsup><m:mo>+</m:mo><m:msubsup><m:mi>x</m:mi><m:mn>6</m:mn><m:mn>2</m:mn></m:msubsup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>2</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>1</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>7</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>6</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>3</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><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>1</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mo>+</m:mo><m:msubsup><m:mi>x</m:mi><m:mn>6</m:mn><m:mn>2</m:mn></m:msubsup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>4</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><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>2</m:mn></m:msup><m:mo>+</m:mo><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>6</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>8</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>5</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><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>5</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>6</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>9</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>6</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:msubsup><m:mi>x</m:mi><m:mn>2</m:mn><m:mn>2</m:mn></m:msubsup><m:mo>+</m:mo><m:msubsup><m:mi>x</m:mi><m:mn>7</m:mn><m:mn>2</m:mn></m:msubsup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>7</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><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>2</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mo>+</m:mo><m:msubsup><m:mi>x</m:mi><m:mn>7</m:mn><m:mn>2</m:mn></m:msubsup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>8</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>4</m:mn></m:msub><m:mo>-</m:mo><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:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>8</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>7</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>9</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>5</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>7</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>9</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>10</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:msubsup><m:mi>x</m:mi><m:mn>3</m:mn><m:mn>2</m:mn></m:msubsup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>11</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>4</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>3</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mo>+</m:mo><m:msubsup><m:mi>x</m:mi><m:mn>8</m:mn><m:mn>2</m:mn></m:msubsup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>12</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>5</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>3</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mo>+</m:mo><m:msubsup><m:mi>x</m:mi><m:mn>9</m:mn><m:mn>2</m:mn></m:msubsup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>13</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:msubsup><m:mi>x</m:mi><m:mn>4</m:mn><m:mn>2</m:mn></m:msubsup><m:mo>+</m:mo><m:msubsup><m:mi>x</m:mi><m:mn>8</m:mn><m:mn>2</m:mn></m:msubsup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>14</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>4</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>5</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>9</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mn>8</m:mn></m:msub></m:mfenced>
<m:mn>2</m:mn></m:msup><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>c</m:mi><m:mn>15</m:mn></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:msubsup><m:mi>x</m:mi><m:mn>5</m:mn><m:mn>2</m:mn></m:msubsup><m:mo>+</m:mo><m:msubsup><m:mi>x</m:mi><m:mn>9</m:mn><m:mn>2</m:mn></m:msubsup><m:mtext>.</m:mtext></m:mtd>
 </m:mtr>
</m:mtable>
</m:math></td><td class="formula2"/></tr></table></div>

The example checks the gradients at two separate points.</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/e04zcfe.f">Program Text (e04zcfe.f)</a></p><p><a class="verbatimref" href="../../examples/source/e04zcae.f">Program Text (e04zcae.f)</a></p><h3 class="standard"><a class="sec" name="examdata" id="examdata"/>9.2&#160;&#160;Program Data</h3>
<p><a class="verbatimref" href="../../examples/data/e04zcfe.d">Program&#160;Data (e04zcfe.d)</a></p><p><a class="verbatimref" href="../../examples/data/e04zcae.d">Program&#160;Data (e04zcae.d)</a></p><h3 class="standard"><a class="sec" name="examresults" id="examresults"/>9.3&#160;&#160;Program Results</h3>
<p><a class="verbatimref" href="../../examples/baseresults/e04zcfe.r">Program Results (e04zcfe.r)</a></p><p><a class="verbatimref" href="../../examples/baseresults/e04zcae.r">Program Results (e04zcae.r)</a></p>
<hr/><div><a class="rout" href="../../pdf/E04/e04zcf.pdf">E04ZCF/E04ZCA (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>
