
<?xml-stylesheet type="text/xsl" href="../styles/pmathml.xsl"?>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:dsi="http://www.w3.org/1999/xlink" xml:space="preserve"><head><title>
  NAG C Library, Mark 7 : 
  s19abc</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 href="../../pdf/S/s19abc.pdf">s19abc (pdf version)</a></div><div><a href="s_conts.xml">Chapter Contents</a></div><div><a href="s_intro.xml">Chapter Introduction</a></div>
<div><a href="../mark7.xml">NAG C Library Contents</a></div><hr/><h1 class="libdoc">NAG C Library Function Document<br/><br/>nag_kelvin_bei (s19abc)</h1>


<div class="htmltoc">
<h2><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">&#160;1&#160;<b>Purpose</b></a>
<div class="htmltocitem" id="tocpurpose"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#specification">&#160;2&#160;<b>Specification</b></a>
<div class="htmltocitem" id="tocspecification"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#description">&#160;3&#160;<b>Description</b></a>
<div class="htmltocitem" id="tocdescription"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#references">&#160;4&#160;<b>References</b></a>
<div class="htmltocitem" id="tocreferences"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#parameters">&#160;5&#160;<b>Parameters</b></a>
<div class="htmltocitem" id="tocparameters"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#errors">&#160;6&#160;<b>Error Indicators and Warnings</b></a>
<div class="htmltocitem" id="tocerrors"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#accuracy">&#160;7&#160;<b>Accuracy</b></a>
<div class="htmltocitem" id="tocaccuracy"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#fcomments">&#160;8&#160;<b>Further Comments</b></a>
<div class="htmltocitem" id="tocfcomments"/>
</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">&#160;9&#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">&#160;9.1&#160;<b>Program Text</b></a>
<div class="htmltocitem" id="tocexamtext"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examdata">&#160;9.2&#160;<b>Program Data</b></a>
<div class="htmltocitem" id="tocexamdata"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examresults">&#160;9.3&#160;<b>Program Results</b></a>
<div class="htmltocitem" id="tocexamresults"/>
</div>
</div>
</div>
</div>
</div>




<h2><a name="purpose" id="purpose"/>1&#160;&#160;Purpose</h2>

<div class="paramtext">nag_kelvin_bei (s19abc) returns a value for the Kelvin function <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mrow><mi>bei</mi><mo>&#8289;</mo><mi>x</mi></mrow>
</math>.</div>





<h2><a name="specification" id="specification"/>2&#160;&#160;Specification</h2>


<table class="cspec">
<tr><td class="tdcspec" colspan="2">#include &lt;nag.h&gt;<br/>
#include &lt;nags.h&gt;<br/><br/></td></tr>
<tr><td class="tdcspec">
void&#160;nag_kelvin_bei</td><td class="tdcspec">(double&#160;<a class="argref" href="#x">x</a>, NagError&#160;*<a class="argref" href="#fail">fail</a>)

   
</td></tr>
</table>





<h2><a name="description" id="description"/>3&#160;&#160;Description</h2>

<div class="paramtext">nag_kelvin_bei (s19abc) evaluates an approximation to the Kelvin function <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mrow><mi>bei</mi><mo>&#8289;</mo><mi>x</mi></mrow>
</math>.
</div>
<div class="paramtext">The function is based on several Chebyshev expansions.
</div>
<div class="paramtext">For large <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>x</mi>
</math>, there is a danger of the result being totally inaccurate, as the error amplification factor grows in an essentially exponential manner; therefore the function must fail.
</div>





<h2><a name="references" id="references"/>4&#160;&#160;References</h2>

<div class="paramtext">
<p><a name="ref126" id="ref126"/>Abramowitz M and Stegun I A (1972) <i>Handbook of Mathematical Functions</i> (3rd Edition) Dover Publications </p>
</div>





<h2><a name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>


<dl><dt class="paramhead"><a name="x" id="x"/>1:
 &#160;&#160;&#8194;
 <b>x</b> &#8211; double&#160;<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the argument <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>x</mi>
</math>&#160;of the function.</div>
</dd><dt class="paramhead"><a name="fail" id="fail"/>2:
 &#160;&#160;&#8194;
 <b>fail</b> &#8211; NagError&#160;*<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext">The NAG error parameter, see the <a class="secref" href="../genint/essint.xml">Essential Introduction</a>.</div>

</dd></dl>





<h2><a name="errors" id="errors"/>6&#160;&#160;Error Indicators and Warnings</h2>
 

<dl>


<dt class="errorhead"><a name="NE_REAL_ARG_GT" id="NE_REAL_ARG_GT"/><b>NE_REAL_ARG_GT</b></dt>
<dd style="margin-top: .2em;">
<div class="paramtext">On entry, <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mfenced open="|" close="|" separators="">
  <maction actiontype="link" dsi:href="#x" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">x</mi></maction>
 </mfenced>
</math>&#160;must not be greater than <math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced open="&#9001;" close="&#9002;" separators=""><mtext mathvariant="italic">value</mtext></mfenced></math>: <math xmlns="http://www.w3.org/1998/Math/MathML">
 <maction actiontype="link" dsi:href="#x" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">x</mi></maction><mo>=</mo><mfenced open="&#9001;" close="&#9002;" separators=""><mtext mathvariant="italic">value</mtext></mfenced>
</math>.  <br/>
<math xmlns="http://www.w3.org/1998/Math/MathML">
 <mfenced open="|" close="|" separators="">
  <maction actiontype="link" dsi:href="#x" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">x</mi></maction>
 </mfenced>
</math>&#160;is too large for an accurate result to be returned and the function returns zero.
</div>
</dd>


</dl>






<h2><a name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>

<div class="paramtext">Since the function is oscillatory, the absolute error rather than the relative error is important.  Let <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>E</mi>
</math>&#160;be the absolute error in the function, and <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>&#948;</mi>
</math>&#160;be the relative error in the argument.  If <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>&#948;</mi>
</math>&#160;is somewhat larger than the <span class="bitalic">machine precision</span> , then we have <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>E</mi>
 <mo>&#8771;</mo>
 <mfenced open="|" close="|" separators="">
  <mi>x</mi>
  <mfenced separators="">
   <mo>-</mo>
   <mrow>
     <msub>
      <mi>ber</mi>
      <mn>1</mn>
     </msub>
    <mo>&#8289;</mo><mi>x</mi></mrow>
   <mo>+</mo>
   <mrow>
     <msub>
      <mi>bei</mi>
      <mn>1</mn>
     </msub>
    <mo>&#8289;</mo><mi>x</mi></mrow>
  </mfenced>
  <mo>/</mo>
  <msqrt>
   <mn>2</mn>
  </msqrt>
 </mfenced>
 <mi>&#948;</mi>
</math>&#160;(provided <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>E</mi>
</math>&#160;is within machine bounds).
</div>
<div class="paramtext">For small <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>x</mi>
</math>&#160;the error amplification is insignificant and thus the absolute error is effectively bounded by the <span class="bitalic">machine precision</span>.
</div>
<div class="paramtext">For medium and large <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>x</mi>
</math>, the error behaviour is oscillatory and its amplitude grows like <math xmlns="http://www.w3.org/1998/Math/MathML">
 <msqrt>
  <mrow>
   <mi>x</mi>
   <mo>/</mo>
   <mn>2</mn>
   <mi>&#960;</mi>
  </mrow>
 </msqrt>
 <msup>
  <mi>e</mi>
  <mrow>
   <mi>x</mi>
   <mo>/</mo>
   <msqrt>
    <mn>2</mn>
   </msqrt>
  </mrow>
 </msup>
</math>.  Therefore it is impossible to calculate the functions with any accuracy when <math xmlns="http://www.w3.org/1998/Math/MathML">
 <msqrt>
  <mi>x</mi>
 </msqrt>
 <msup>
  <mi>e</mi>
  <mrow>
   <mi>x</mi>
   <mo>/</mo>
   <msqrt>
    <mn>2</mn>
   </msqrt>
  </mrow>
 </msup>
 <mo>&gt;</mo>
 <msqrt>
  <mrow><mn>2</mn><mi>&#960;</mi></mrow>
 </msqrt>
 <mo>/</mo>
 <mi>&#948;</mi>
</math>.  Note that this value of <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>x</mi>
</math>&#160;is much smaller than the minimum value of <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>x</mi>
</math>&#160;for which the function overflows.
</div>





<h2><a name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>

<div class="paramtext">None.</div>





<h2><a name="example" id="example"/>9&#160;&#160;Example</h2>

<div class="paramtext">The following program reads values of the argument <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>x</mi>
</math>&#160;from a file, evaluates the function at each value of <math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>x</mi>
</math>&#160;and prints the results.</div>



<h3><a name="examtext" id="examtext"/>9.1&#160;&#160;Program Text</h3>
 
<div><a href="../../examples/source/s19abce.c">Program Text (s19abce.c)</a></div>





<h3><a name="examdata" id="examdata"/>9.2&#160;&#160;Program Data</h3>

<div><a href="../../examples/data/s19abce.d">Program Data (s19abce.d)</a></div>





<h3><a name="examresults" id="examresults"/>9.3&#160;&#160;Program Results</h3>

<div><a href="../../examples/baseresults/s19abce.r">Program Results (s19abce.r)</a></div>


<hr/><div><a href="../../pdf/S/s19abc.pdf">s19abc (pdf version)</a></div><div><a href="s_conts.xml">Chapter Contents</a></div><div><a href="s_intro.xml">Chapter Introduction</a></div>
<div><a href="../mark7.xml">NAG C Library Contents</a></div>
<div><hr/>
  &#169; The Numerical Algorithms Group Ltd, Oxford, UK. 2004
  </div></body></html>