<?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>D02MVF : 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/D02/d02mvf.pdf">D02MVF (PDF version)</a></div><div><a class="chap" href="d02conts.xml">D02 Chapter Contents</a></div><div><a class="chapint" href="d02intro.xml">D02 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/>D02MVF</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">D02MVF is an integration method specific setup routine which must be called prior to linear algebra setup routines and integrators from the SPRINT suite of routines, if the DASSL implementation of Backward Differentiation Formulae (BDF) is to be used.  Note that this method is also available, independent from the SPRINT suite, using <a class="rout" href="../D02/d02nef.xml">D02NEF</a></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;D02MVF&#160;(</td><td class="tdfspec2"><a class="arg" href="#NEQMAX">NEQMAX</a>, <a class="arg" href="#SDYSAV">SDYSAV</a>, <a class="arg" href="#MAXORD">MAXORD</a>, <a class="arg" href="#CON">CON</a>, <a class="arg" href="#TCRIT">TCRIT</a>, <a class="arg" href="#HMIN">HMIN</a>, <a class="arg" href="#HMAX">HMAX</a>, <a class="arg" href="#H0">H0</a>, <a class="arg" href="#MAXSTP">MAXSTP</a>, <a class="arg" href="#MXHNIL">MXHNIL</a>, <a class="arg" href="#NORM">NORM</a>, <a class="arg" href="#RWORK">RWORK</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">NEQMAX, SDYSAV, MAXORD, MAXSTP, MXHNIL, IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">CON(3), TCRIT, HMIN, HMAX, H0, RWORK(50+4*NEQMAX)</td></tr><tr><td class="tdfspec1">CHARACTER*1</td><td class="tdfspec2">NORM</td></tr></table><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">An integrator setup routine must be called before the call to any linear algebra setup routine or integrator from the SPRINT suite of routines in this sub-chapter.  This setup routine, D02MVF, makes the choice of the DASSL integrator and permits you to define options appropriate to this choice.  Alternative choices of integrator from this suite are the BDF method and the BLEND method which can be chosen by initial calls to <a class="rout" href="../D02/d02nvf.xml">D02NVF</a> or <a class="rout" href="../D02/d02nwf.xml">D02NWF</a> respectively.</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2>
<div class="paramtext">See the <a class="chapint" href="../D02/d02mnintro.xml">D02M&#8211;N sub-chapter Introduction</a>.</div><h2 class="standard"><a class="sec" name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>
<dl><dt class="paramhead"><a name="NEQMAX" id="NEQMAX"/>1: &#160;&#160;&#8194; NEQMAX &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: a bound on the maximum number of differential equations to be solved.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NEQMAX"><m:mi mathcolor="#EE0000" mathvariant="bold">NEQMAX</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>1</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="SDYSAV" id="SDYSAV"/>2: &#160;&#160;&#8194; SDYSAV &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the second dimension of the array <a class="arg" href="../D02/d02nbf.xml#YSAV">YSAV</a> that will be supplied to the integrator, as declared in the (sub)program from which the integrator is called (e.g., see <a class="rout" href="../D02/d02nbf.xml">D02NBF</a>).</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#SDYSAV"><m:mi mathcolor="#EE0000" mathvariant="bold">SDYSAV</m:mi></m:maction><m:mo>&#8805;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#MAXORD"><m:mi mathcolor="#EE0000" mathvariant="bold">MAXORD</m:mi></m:maction><m:mo>+</m:mo><m:mn>3</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="MAXORD" id="MAXORD"/>3: &#160;&#160;&#8194; MAXORD &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the maximum order to be used for the BDF method. If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#MAXORD"><m:mi mathcolor="#EE0000" mathvariant="bold">MAXORD</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>&#160;then <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#MAXORD"><m:mi mathcolor="#EE0000" mathvariant="bold">MAXORD</m:mi></m:maction><m:mo>=</m:mo><m:mn>5</m:mn></m:math>&#160;is assumed.</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="#MAXORD"><m:mi mathcolor="#EE0000" mathvariant="bold">MAXORD</m:mi></m:maction><m:mo>&#8804;</m:mo><m:mn>5</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="CON" id="CON"/>4: &#160;&#160;&#8194; CON(<m:math><m:mn>3</m:mn></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><i>On entry</i>: values to be used to control step size choice during integration. If any <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow><m:mo>=</m:mo><m:mn>0.0</m:mn></m:math>&#160;on entry, it is replaced by its default value described below. In most cases this is the recommended setting.
<div class="paramtext"><m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>, 
<m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>2</m:mn></m:mfenced></m:mrow></m:math>, and 
<m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>3</m:mn></m:mfenced></m:mrow></m:math>&#160;are factors used to bound step size changes. If the current step size 
<m:math><m:mi>h</m:mi></m:math>&#160;fails, then the modulus of the next step size is bounded by 
<m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>l</m:mi></m:mfenced></m:mrow><m:mo>&#215;</m:mo><m:mfenced open="|" close="|" separators=""><m:mi>h</m:mi></m:mfenced></m:math>. The default value of 
<m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>&#160;is 
<m:math><m:mn>2.0</m:mn></m:math>. Note that the new step size may be used with a method of different order to the failed step. If the initial step size is 
<m:math><m:mi>h</m:mi></m:math>, then the modulus of the step size on the second step is bounded by 
<m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>3</m:mn></m:mfenced></m:mrow><m:mo>&#215;</m:mo><m:mfenced open="|" close="|" separators=""><m:mi>h</m:mi></m:mfenced></m:math>. At any other stage in the integration, if the current step size is 
<m:math><m:mi>h</m:mi></m:math>, then the modulus of the next step size is bounded by 
<m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>2</m:mn></m:mfenced></m:mrow><m:mo>&#215;</m:mo><m:mfenced open="|" close="|" separators=""><m:mi>h</m:mi></m:mfenced></m:math>. The default values are 
<m:math><m:mn>10.0</m:mn></m:math>&#160;for 
<m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>2</m:mn></m:mfenced></m:mrow></m:math>&#160;and 
<m:math><m:mn>1000.0</m:mn></m:math>&#160;for 
<m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>3</m:mn></m:mfenced></m:mrow></m:math>.</div>
</div><div class="paramtext"><i>Constraints</i>:
   <div class="paramtext"/><div class="paramtext">These constraints must be satisfied after any zero values have been replaced by default values.</div><ul class="listcons">
<li class="listcons"><m:math><m:mn>0.0</m:mn><m:mo>&lt;</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow><m:mo>&lt;</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>2</m:mn></m:mfenced></m:mrow><m:mo>&lt;</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>3</m:mn></m:mfenced></m:mrow></m:math>;</li>
<li class="listcons"><m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>2</m:mn></m:mfenced></m:mrow><m:mo>&gt;</m:mo><m:mn>1.0</m:mn></m:math>;</li>
<li class="listcons"><m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#CON"><m:mi mathcolor="#EE0000" mathvariant="bold">CON</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>3</m:mn></m:mfenced></m:mrow><m:mo>&gt;</m:mo><m:mn>1.0</m:mn></m:math>.</li>
</ul></div>
<div class="paramtext"><i>On exit</i>: the values actually to be used by the integration routine.</div></dd><dt class="paramhead"><a name="TCRIT" id="TCRIT"/>5: &#160;&#160;&#8194; TCRIT &#8211; <span class="bitalic">double precision</span><span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: a point beyond which integration must not be attempted. The use of <a class="arg" href="#TCRIT">TCRIT</a> is described under the parameter <a class="arg" href="../D02/d02nbf.xml#ITASK">ITASK</a> in the specification for the integrator (e.g., see <a class="rout" href="../D02/d02nbf.xml">D02NBF</a>). A value, <m:math><m:mn>0.0</m:mn></m:math>&#160;say, must be specified even if <a class="arg" href="../D02/d02nbf.xml#ITASK">ITASK</a> subsequently specifies that <a class="arg" href="#TCRIT">TCRIT</a> will not be used.</div></dd><dt class="paramhead"><a name="HMIN" id="HMIN"/>6: &#160;&#160;&#8194; HMIN &#8211; <span class="bitalic">double precision</span><span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the minimum absolute step size to be allowed. Set <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#HMIN"><m:mi mathcolor="#EE0000" mathvariant="bold">HMIN</m:mi></m:maction><m:mo>=</m:mo><m:mn>0.0</m:mn></m:math>&#160;if this option is not required.</div></dd><dt class="paramhead"><a name="HMAX" id="HMAX"/>7: &#160;&#160;&#8194; HMAX &#8211; <span class="bitalic">double precision</span><span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the maximum absolute step size to be allowed. Set <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#HMAX"><m:mi mathcolor="#EE0000" mathvariant="bold">HMAX</m:mi></m:maction><m:mo>=</m:mo><m:mn>0.0</m:mn></m:math>&#160;if this option is not required.</div></dd><dt class="paramhead"><a name="H0" id="H0"/>8: &#160;&#160;&#8194; H0 &#8211; <span class="bitalic">double precision</span><span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the step size to be attempted on the first step. Set <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#H0"><m:mi mathcolor="#EE0000" mathvariant="bold">H0</m:mi></m:maction><m:mo>=</m:mo><m:mn>0.0</m:mn></m:math>&#160;if the initial step size is calculated internally.</div></dd><dt class="paramhead"><a name="MAXSTP" id="MAXSTP"/>9: &#160;&#160;&#8194; MAXSTP &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the maximum number of steps to be attempted during one call to the integrator after which it will return with <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="../D02/d02nbf.xml#IFeq2"><m:mn mathcolor="#003399" mathvariant="bold">2</m:mn></m:maction></m:math>&#160;(e.g., see <a class="rout" href="../D02/d02nbf.xml">D02NBF</a>). Set <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#MAXSTP"><m:mi mathcolor="#EE0000" mathvariant="bold">MAXSTP</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>&#160;if no limit is to be imposed.</div></dd><dt class="paramhead"><a name="MXHNIL" id="MXHNIL"/>10: &#8194; MXHNIL &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the maximum number of warnings printed (if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="../D02/d02nbf.xml#ITRACE"><m:mi mathcolor="#EE0000" mathvariant="bold">ITRACE</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>0</m:mn></m:math>, e.g., see <a class="rout" href="../D02/d02nbf.xml">D02NBF</a>) per problem when <m:math><m:mi>t</m:mi><m:mo>+</m:mo><m:mi>h</m:mi><m:mo>=</m:mo><m:mi>t</m:mi></m:math>&#160;on a step (<m:math><m:mi>h</m:mi><m:mo>=</m:mo><m:mtext>&#8203; current step size</m:mtext></m:math>). If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#MXHNIL"><m:mi mathcolor="#EE0000" mathvariant="bold">MXHNIL</m:mi></m:maction><m:mo>&#8804;</m:mo><m:mn>0</m:mn></m:math>, a default value of <m:math><m:mn>10</m:mn></m:math>&#160;is assumed.</div></dd><dt class="paramhead"><a name="NORM" id="NORM"/>11: &#8194; NORM &#8211; CHARACTER*1<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: indicates the type of norm to be used.

<dl>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NORM"><m:mi mathcolor="#EE0000" mathvariant="bold">NORM</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'M'</m:mtext></m:math></dt>
<dd>Maximum norm.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NORM"><m:mi mathcolor="#EE0000" mathvariant="bold">NORM</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'A'</m:mtext></m:math></dt>
<dd>Averaged L2 norm.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NORM"><m:mi mathcolor="#EE0000" mathvariant="bold">NORM</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'D'</m:mtext></m:math></dt>
<dd>Is the same as 'A'.</dd></dl>
<div class="paramtext">If <m:math><m:mi mathvariant="italic">vnorm</m:mi></m:math>&#160;denotes the norm of the vector <m:math><m:mi>v</m:mi></m:math>&#160;of length <m:math><m:mi>n</m:mi></m:math>, then for the averaged L2 norm 
<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block"> <m:mi mathvariant="italic">vnorm</m:mi><m:mi>B</m:mi><m:mo>=</m:mo><m:msqrt><m:mfrac other="small"><m:mn>1</m:mn><m:mi>n</m:mi></m:mfrac><m:munderover><m:mo>&#8721;</m:mo><m:mrow><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn></m:mrow><m:mi>n</m:mi></m:munderover> <m:msup> <m:mfenced separators=""><m:mfrac><m:msub><m:mi>v</m:mi><m:mi>i</m:mi></m:msub><m:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub></m:mfrac></m:mfenced> <m:mn>2</m:mn></m:msup></m:msqrt><m:mtext>,</m:mtext> </m:math></td><td class="formula2"/></tr></table></div>
 while for the maximum norm 
<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block"> <m:mi mathvariant="italic">vnorm</m:mi><m:mo>=</m:mo><m:munder><m:mi mathvariant="normal">max</m:mi><m:mrow><m:mn>1</m:mn><m:mo>&#8804;</m:mo><m:mi>i</m:mi><m:mo>&#8804;</m:mo><m:mi>n</m:mi></m:mrow></m:munder><m:mspace width="0.25em"/> <m:mfenced open="|" close="|" separators=""><m:mfrac><m:msub><m:mi>v</m:mi><m:mi>i</m:mi></m:msub><m:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub></m:mfrac></m:mfenced> <m:mtext>.</m:mtext> </m:math></td><td class="formula2"/></tr></table></div>
</div>
<div class="paramtext">If you wish to weight the maximum norm or the L2 norm, then <a class="arg" href="../D02/d02nbf.xml#RTOL">RTOL</a> and <a class="arg" href="../D02/d02nbf.xml#ATOL">ATOL</a> should be scaled appropriately on input to the integrator (see under <a class="arg" href="../D02/d02nbf.xml#ITOL">ITOL</a> in the specification of the integrator for the formulation of the weight vector <m:math><m:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;from <a class="arg" href="../D02/d02nbf.xml#RTOL">RTOL</a> and <a class="arg" href="../D02/d02nbf.xml#ATOL">ATOL</a>, e.g., see <a class="rout" href="../D02/d02nbf.xml">D02NBF</a>).</div>
<div class="paramtext">Only the first character to the actual parameter <a class="arg" href="#NORM">NORM</a> is passed to D02MVF; hence it is permissible for the actual argument to be more descriptive, e.g., &#8216;Maximum&#8217;, &#8216;Average L2&#8217; or &#8216;Default&#8217; in a call to D02MVF.</div>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NORM"><m:mi mathcolor="#EE0000" mathvariant="bold">NORM</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'M'</m:mtext></m:math>, <m:math><m:mtext>'A'</m:mtext></m:math>&#160;or <m:math><m:mtext>'D'</m:mtext></m:math>.
</div></dd><dt class="paramhead"><a name="RWORK" id="RWORK"/>12: &#8194; RWORK(<m:math><m:mn>50</m:mn><m:mo>+</m:mo><m:mn>4</m:mn><m:mo>&#215;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#NEQMAX"><m:mi mathcolor="#EE0000" mathvariant="bold">NEQMAX</m:mi></m:maction></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Communication Array</span></dt><dd>
<div class="paramtext">This must be the same workspace array as the array <a class="arg" href="#RWORK">RWORK</a> supplied to the integrator. It is used to pass information from the setup routine to the integrator and therefore the contents of this array must not be changed before calling the integrator.</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"><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, if you are not familiar with this parameter, the recommended value is <m:math><m:mn>0</m:mn></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 mathvariant="bold">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">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="#NEQMAX"><m:mi mathcolor="#EE0000" mathvariant="bold">NEQMAX</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="#SDYSAV"><m:mi mathcolor="#EE0000" mathvariant="bold">SDYSAV</m:mi></m:maction><m:mo>&lt;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#MAXORD"><m:mi mathcolor="#EE0000" mathvariant="bold">MAXORD</m:mi></m:maction><m:mo>+</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="#MAXORD"><m:mi mathcolor="#EE0000" mathvariant="bold">MAXORD</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="#MAXORD"><m:mi mathcolor="#EE0000" mathvariant="bold">MAXORD</m:mi></m:maction><m:mo>&gt;</m:mo><m:mn>5</m:mn></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90">invalid value for element of the array <a class="arg" href="#CON">CON</a>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NORM"><m:mi mathcolor="#EE0000" mathvariant="bold">NORM</m:mi></m:maction><m:mo>&#8800;</m:mo><m:mtext>'M'</m:mtext></m:math>, <m:math><m:mtext>'A'</m:mtext></m:math>&#160;or <m:math><m:mtext>'D'</m:mtext></m:math>.</td></tr></table>
</dd>
</dl><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext">Not applicable.</div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">None.</div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">This example solves the plane pendulum problem defined by the equations:

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mtable>
  <m:mtr>
   <m:mtd columnalign="right"><m:msup><m:mi>x</m:mi><m:mo>&#8242;</m:mo></m:msup></m:mtd>
   <m:mtd><m:mo>=</m:mo></m:mtd>
   <m:mtd columnalign="left"><m:mi>u</m:mi></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd columnalign="right"><m:msup><m:mi>y</m:mi><m:mo>&#8242;</m:mo></m:msup></m:mtd>
   <m:mtd><m:mo>=</m:mo></m:mtd>
   <m:mtd columnalign="left"><m:mi>v</m:mi></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd columnalign="right"><m:msup><m:mi>u</m:mi><m:mo>&#8242;</m:mo></m:msup></m:mtd>
   <m:mtd><m:mo>=</m:mo></m:mtd>
   <m:mtd columnalign="left"><m:mo>-</m:mo><m:mi>&#955;</m:mi><m:mi>x</m:mi></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd columnalign="right"><m:msup><m:mi>v</m:mi><m:mo>&#8242;</m:mo></m:msup></m:mtd>
   <m:mtd><m:mo>=</m:mo></m:mtd>
   <m:mtd columnalign="left"><m:mo>-</m:mo><m:mi>&#955;</m:mi><m:mi>y</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd columnalign="right"><m:msup><m:mi>x</m:mi><m:mn>2</m:mn></m:msup><m:mo>+</m:mo><m:msup><m:mi>y</m:mi><m:mn>2</m:mn></m:msup></m:mtd>
   <m:mtd><m:mo>=</m:mo></m:mtd>
   <m:mtd columnalign="left"><m:mn>1</m:mn></m:mtd>
  </m:mtr>
 </m:mtable>
</m:math></td><td class="formula2"/></tr></table></div></div><div class="paramtext">The additional algebraic constraint <m:math><m:mi>x</m:mi><m:mi>u</m:mi><m:mo>+</m:mo><m:mi>y</m:mi><m:mi>v</m:mi><m:mo>=</m:mo><m:mn>0</m:mn></m:math>&#160;can be derived, and after appropriate substitution and manipulation to avoid a singular Jacobian solves the equations:

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mtable>
  <m:mtr>
   <m:mtd columnalign="right"><m:msubsup><m:mi>y</m:mi><m:mn>1</m:mn><m:mo>&#8242;</m:mo></m:msubsup></m:mtd>
   <m:mtd><m:mo>=</m:mo></m:mtd>
   <m:mtd columnalign="left"><m:msub><m:mi>y</m:mi><m:mn>3</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>y</m:mi><m:mn>6</m:mn></m:msub><m:msub><m:mi>y</m:mi><m:mn>1</m:mn></m:msub></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd columnalign="right"><m:msubsup><m:mi>y</m:mi><m:mn>2</m:mn><m:mo>&#8242;</m:mo></m:msubsup></m:mtd>
   <m:mtd><m:mo>=</m:mo></m:mtd>
   <m:mtd columnalign="left"><m:msub><m:mi>y</m:mi><m:mn>4</m:mn></m:msub><m:mo>-</m:mo><m:msub><m:mi>y</m:mi><m:mn>6</m:mn></m:msub><m:msub><m:mi>y</m:mi><m:mn>2</m:mn></m:msub></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd columnalign="right"><m:msubsup><m:mi>y</m:mi><m:mn>3</m:mn><m:mo>&#8242;</m:mo></m:msubsup></m:mtd>
   <m:mtd><m:mo>=</m:mo></m:mtd>
   <m:mtd columnalign="left"><m:mo>-</m:mo><m:msub><m:mi>y</m:mi><m:mn>5</m:mn></m:msub><m:msub><m:mi>y</m:mi><m:mn>1</m:mn></m:msub></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd columnalign="right"><m:msubsup><m:mi>y</m:mi><m:mn>4</m:mn><m:mo>&#8242;</m:mo></m:msubsup></m:mtd>
   <m:mtd><m:mo>=</m:mo></m:mtd>
   <m:mtd columnalign="left"><m:mo>-</m:mo><m:msub><m:mi>y</m:mi><m:mn>5</m:mn></m:msub><m:msub><m:mi>y</m:mi><m:mn>2</m:mn></m:msub><m:mo>-</m:mo><m:mn>1</m:mn></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd columnalign="right"><m:mn>0</m:mn></m:mtd>
   <m:mtd><m:mo>=</m:mo></m:mtd>
   <m:mtd columnalign="left"><m:msub><m:mi>y</m:mi><m:mn>1</m:mn></m:msub><m:msub><m:mi>y</m:mi><m:mn>3</m:mn></m:msub><m:mo>+</m:mo><m:msub><m:mi>y</m:mi><m:mn>2</m:mn></m:msub><m:msub><m:mi>y</m:mi><m:mn>4</m:mn></m:msub></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd columnalign="right"><m:mn>0</m:mn></m:mtd>
   <m:mtd><m:mo>=</m:mo></m:mtd>
   <m:mtd columnalign="left"><m:msubsup><m:mi>y</m:mi><m:mn>1</m:mn><m:mn>2</m:mn></m:msubsup><m:mo>+</m:mo><m:msubsup><m:mi>y</m:mi><m:mn>2</m:mn><m:mn>2</m:mn></m:msubsup><m:mo>-</m:mo><m:mn>1</m:mn></m:mtd>
  </m:mtr>
 </m:mtable>
</m:math></td><td class="formula2"/></tr></table></div>

with given initial conditions and derivatives.</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/d02mvfe.f">Program Text (d02mvfe.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/d02mvfe.r">Program Results (d02mvfe.r)</a></p><div class="figure"><a name="d02mvf-plot" id="d02mvf-plot"/><img src="../figures/d02mvf-plot.png" alt="Example Program Plot for d02mvf-plot"/></div>
<hr/><div><a class="rout" href="../../pdf/D02/d02mvf.pdf">D02MVF (PDF version)</a></div><div><a class="chap" href="d02conts.xml">D02 Chapter Contents</a></div><div><a class="chapint" href="d02intro.xml">D02 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>
