ibeta_function.html 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Incomplete Beta Functions</title>
  5. <link rel="stylesheet" href="../../math.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
  7. <link rel="home" href="../../index.html" title="Math Toolkit 2.11.0">
  8. <link rel="up" href="../sf_beta.html" title="Beta Functions">
  9. <link rel="prev" href="beta_function.html" title="Beta">
  10. <link rel="next" href="ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr>
  14. <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
  15. <td align="center"><a href="../../../../../../index.html">Home</a></td>
  16. <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
  17. <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
  18. <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
  19. <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
  20. </tr></table>
  21. <hr>
  22. <div class="spirit-nav">
  23. <a accesskey="p" href="beta_function.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_beta.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="ibeta_inv_function.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="section">
  26. <div class="titlepage"><div><div><h3 class="title">
  27. <a name="math_toolkit.sf_beta.ibeta_function"></a><a class="link" href="ibeta_function.html" title="Incomplete Beta Functions">Incomplete Beta
  28. Functions</a>
  29. </h3></div></div></div>
  30. <h5>
  31. <a name="math_toolkit.sf_beta.ibeta_function.h0"></a>
  32. <span class="phrase"><a name="math_toolkit.sf_beta.ibeta_function.synopsis"></a></span><a class="link" href="ibeta_function.html#math_toolkit.sf_beta.ibeta_function.synopsis">Synopsis</a>
  33. </h5>
  34. <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">beta</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
  35. </pre>
  36. <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span><span class="special">{</span>
  37. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
  38. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibeta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span>
  39. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
  40. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibeta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
  41. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
  42. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibetac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span>
  43. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
  44. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibetac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
  45. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
  46. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">beta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span>
  47. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
  48. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">beta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
  49. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
  50. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">betac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span>
  51. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
  52. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">betac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
  53. <span class="special">}}</span> <span class="comment">// namespaces</span>
  54. </pre>
  55. <h5>
  56. <a name="math_toolkit.sf_beta.ibeta_function.h1"></a>
  57. <span class="phrase"><a name="math_toolkit.sf_beta.ibeta_function.description"></a></span><a class="link" href="ibeta_function.html#math_toolkit.sf_beta.ibeta_function.description">Description</a>
  58. </h5>
  59. <p>
  60. There are four <a href="http://en.wikipedia.org/wiki/Incomplete_beta_function" target="_top">incomplete
  61. beta functions</a> : two are normalised versions (also known as <span class="emphasis"><em>regularized</em></span>
  62. beta functions) that return values in the range [0, 1], and two are non-normalised
  63. and return values in the range [0, <a class="link" href="beta_function.html" title="Beta">beta</a>(a,
  64. b)]. Users interested in statistical applications should use the normalised
  65. (or <a href="http://mathworld.wolfram.com/RegularizedBetaFunction.html" target="_top">regularized</a>
  66. ) versions (ibeta and ibetac).
  67. </p>
  68. <p>
  69. All of these functions require <span class="emphasis"><em>0 &lt;= x &lt;= 1</em></span>.
  70. </p>
  71. <p>
  72. The normalized functions <a class="link" href="ibeta_function.html" title="Incomplete Beta Functions">ibeta</a>
  73. and <a class="link" href="ibeta_function.html" title="Incomplete Beta Functions">ibetac</a> require
  74. <span class="emphasis"><em>a,b &gt;= 0</em></span>, and in addition that not both <span class="emphasis"><em>a</em></span>
  75. and <span class="emphasis"><em>b</em></span> are zero.
  76. </p>
  77. <p>
  78. The functions <a class="link" href="beta_function.html" title="Beta">beta</a>
  79. and <a class="link" href="ibeta_function.html" title="Incomplete Beta Functions">betac</a> require
  80. <span class="emphasis"><em>a,b &gt; 0</em></span>.
  81. </p>
  82. <p>
  83. The return type of these functions is computed using the <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>result
  84. type calculation rules</em></span></a> when T1, T2 and T3 are different
  85. types.
  86. </p>
  87. <p>
  88. The final <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
  89. be used to control the behaviour of the function: how it handles errors,
  90. what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">policy
  91. documentation for more details</a>.
  92. </p>
  93. <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
  94. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibeta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span>
  95. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
  96. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibeta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
  97. </pre>
  98. <p>
  99. Returns the normalised incomplete beta function of a, b and x:
  100. </p>
  101. <div class="blockquote"><blockquote class="blockquote"><p>
  102. <span class="inlinemediaobject"><img src="../../../equations/ibeta3.svg"></span>
  103. </p></blockquote></div>
  104. <div class="blockquote"><blockquote class="blockquote"><p>
  105. <span class="inlinemediaobject"><img src="../../../graphs/ibeta.svg" align="middle"></span>
  106. </p></blockquote></div>
  107. <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
  108. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibetac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span>
  109. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
  110. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ibetac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
  111. </pre>
  112. <p>
  113. Returns the normalised complement of the incomplete beta function of a, b
  114. and x:
  115. </p>
  116. <div class="blockquote"><blockquote class="blockquote"><p>
  117. <span class="inlinemediaobject"><img src="../../../equations/ibeta4.svg"></span>
  118. </p></blockquote></div>
  119. <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
  120. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">beta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span>
  121. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
  122. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">beta</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
  123. </pre>
  124. <p>
  125. Returns the full (non-normalised) incomplete beta function of a, b and x:
  126. </p>
  127. <div class="blockquote"><blockquote class="blockquote"><p>
  128. <span class="inlinemediaobject"><img src="../../../equations/ibeta1.svg"></span>
  129. </p></blockquote></div>
  130. <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
  131. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">betac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">);</span>
  132. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
  133. <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">betac</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
  134. </pre>
  135. <p>
  136. Returns the full (non-normalised) complement of the incomplete beta function
  137. of a, b and x:
  138. </p>
  139. <div class="blockquote"><blockquote class="blockquote"><p>
  140. <span class="inlinemediaobject"><img src="../../../equations/ibeta2.svg"></span>
  141. </p></blockquote></div>
  142. <h5>
  143. <a name="math_toolkit.sf_beta.ibeta_function.h2"></a>
  144. <span class="phrase"><a name="math_toolkit.sf_beta.ibeta_function.accuracy"></a></span><a class="link" href="ibeta_function.html#math_toolkit.sf_beta.ibeta_function.accuracy">Accuracy</a>
  145. </h5>
  146. <p>
  147. The following tables give peak and mean relative errors in over various domains
  148. of a, b and x, along with comparisons to the <a href="http://www.gnu.org/software/gsl/" target="_top">GSL-1.9</a>
  149. and <a href="http://www.netlib.org/cephes/" target="_top">Cephes</a> libraries.
  150. Note that only results for the widest floating-point type on the system are
  151. given as narrower types have <a class="link" href="../relative_error.html#math_toolkit.relative_error.zero_error">effectively
  152. zero error</a>.
  153. </p>
  154. <p>
  155. Note that the results for 80 and 128-bit long doubles are noticeably higher
  156. than for doubles: this is because the wider exponent range of these types
  157. allow more extreme test cases to be tested. For example expected results
  158. that are zero at double precision, may be finite but exceptionally small
  159. with the wider exponent range of the long double types.
  160. </p>
  161. <div class="table">
  162. <a name="math_toolkit.sf_beta.ibeta_function.table_ibeta"></a><p class="title"><b>Table&#160;8.18.&#160;Error rates for ibeta</b></p>
  163. <div class="table-contents"><table class="table" summary="Error rates for ibeta">
  164. <colgroup>
  165. <col>
  166. <col>
  167. <col>
  168. <col>
  169. <col>
  170. </colgroup>
  171. <thead><tr>
  172. <th>
  173. </th>
  174. <th>
  175. <p>
  176. GNU C++ version 7.1.0<br> linux<br> double
  177. </p>
  178. </th>
  179. <th>
  180. <p>
  181. GNU C++ version 7.1.0<br> linux<br> long double
  182. </p>
  183. </th>
  184. <th>
  185. <p>
  186. Sun compiler version 0x5150<br> Sun Solaris<br> long double
  187. </p>
  188. </th>
  189. <th>
  190. <p>
  191. Microsoft Visual C++ version 14.1<br> Win32<br> double
  192. </p>
  193. </th>
  194. </tr></thead>
  195. <tbody>
  196. <tr>
  197. <td>
  198. <p>
  199. Incomplete Beta Function: Small Values
  200. </p>
  201. </td>
  202. <td>
  203. <p>
  204. <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span><br> <br> (<span class="emphasis"><em>GSL
  205. 2.1:</em></span> Max = 682&#949; (Mean = 32.6&#949;))<br> (<span class="emphasis"><em>Rmath
  206. 3.2.3:</em></span> Max = 22.9&#949; (Mean = 3.35&#949;))
  207. </p>
  208. </td>
  209. <td>
  210. <p>
  211. <span class="blue">Max = 8.97&#949; (Mean = 2.09&#949;)</span>
  212. </p>
  213. </td>
  214. <td>
  215. <p>
  216. <span class="blue">Max = 21.3&#949; (Mean = 2.75&#949;)</span>
  217. </p>
  218. </td>
  219. <td>
  220. <p>
  221. <span class="blue">Max = 8.4&#949; (Mean = 1.93&#949;)</span>
  222. </p>
  223. </td>
  224. </tr>
  225. <tr>
  226. <td>
  227. <p>
  228. Incomplete Beta Function: Medium Values
  229. </p>
  230. </td>
  231. <td>
  232. <p>
  233. <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span><br> <br> (<span class="emphasis"><em>GSL
  234. 2.1:</em></span> Max = 690&#949; (Mean = 151&#949;))<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
  235. Max = 232&#949; (Mean = 27.9&#949;))
  236. </p>
  237. </td>
  238. <td>
  239. <p>
  240. <span class="blue">Max = 50&#949; (Mean = 12.1&#949;)</span>
  241. </p>
  242. </td>
  243. <td>
  244. <p>
  245. <span class="blue">Max = 124&#949; (Mean = 18.4&#949;)</span>
  246. </p>
  247. </td>
  248. <td>
  249. <p>
  250. <span class="blue">Max = 106&#949; (Mean = 16.3&#949;)</span>
  251. </p>
  252. </td>
  253. </tr>
  254. <tr>
  255. <td>
  256. <p>
  257. Incomplete Beta Function: Large and Diverse Values
  258. </p>
  259. </td>
  260. <td>
  261. <p>
  262. <span class="blue">Max = 1.26&#949; (Mean = 0.063&#949;)</span><br> <br>
  263. (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 3.9e+05&#949; (Mean = 1.82e+04&#949;)
  264. <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_ibeta_GSL_2_1_Incomplete_Beta_Function_Large_and_Diverse_Values">And
  265. other failures.</a>)<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
  266. Max = 574&#949; (Mean = 49.4&#949;))
  267. </p>
  268. </td>
  269. <td>
  270. <p>
  271. <span class="blue">Max = 1.96e+04&#949; (Mean = 997&#949;)</span>
  272. </p>
  273. </td>
  274. <td>
  275. <p>
  276. <span class="blue">Max = 4.98e+04&#949; (Mean = 2.07e+03&#949;)</span>
  277. </p>
  278. </td>
  279. <td>
  280. <p>
  281. <span class="blue">Max = 1.32e+03&#949; (Mean = 68.5&#949;)</span>
  282. </p>
  283. </td>
  284. </tr>
  285. <tr>
  286. <td>
  287. <p>
  288. Incomplete Beta Function: Small Integer Values
  289. </p>
  290. </td>
  291. <td>
  292. <p>
  293. <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span><br> <br> (<span class="emphasis"><em>GSL
  294. 2.1:</em></span> Max = 254&#949; (Mean = 50.9&#949;))<br> (<span class="emphasis"><em>Rmath
  295. 3.2.3:</em></span> Max = 62.2&#949; (Mean = 8.95&#949;))
  296. </p>
  297. </td>
  298. <td>
  299. <p>
  300. <span class="blue">Max = 4.45&#949; (Mean = 0.814&#949;)</span>
  301. </p>
  302. </td>
  303. <td>
  304. <p>
  305. <span class="blue">Max = 44.5&#949; (Mean = 10.1&#949;)</span>
  306. </p>
  307. </td>
  308. <td>
  309. <p>
  310. <span class="blue">Max = 3.85&#949; (Mean = 0.791&#949;)</span>
  311. </p>
  312. </td>
  313. </tr>
  314. </tbody>
  315. </table></div>
  316. </div>
  317. <br class="table-break"><div class="table">
  318. <a name="math_toolkit.sf_beta.ibeta_function.table_ibetac"></a><p class="title"><b>Table&#160;8.19.&#160;Error rates for ibetac</b></p>
  319. <div class="table-contents"><table class="table" summary="Error rates for ibetac">
  320. <colgroup>
  321. <col>
  322. <col>
  323. <col>
  324. <col>
  325. <col>
  326. </colgroup>
  327. <thead><tr>
  328. <th>
  329. </th>
  330. <th>
  331. <p>
  332. GNU C++ version 7.1.0<br> linux<br> double
  333. </p>
  334. </th>
  335. <th>
  336. <p>
  337. GNU C++ version 7.1.0<br> linux<br> long double
  338. </p>
  339. </th>
  340. <th>
  341. <p>
  342. Sun compiler version 0x5150<br> Sun Solaris<br> long double
  343. </p>
  344. </th>
  345. <th>
  346. <p>
  347. Microsoft Visual C++ version 14.1<br> Win32<br> double
  348. </p>
  349. </th>
  350. </tr></thead>
  351. <tbody>
  352. <tr>
  353. <td>
  354. <p>
  355. Incomplete Beta Function: Small Values
  356. </p>
  357. </td>
  358. <td>
  359. <p>
  360. <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span><br> <br> (<span class="emphasis"><em>Rmath
  361. 3.2.3:</em></span> Max = 22.4&#949; (Mean = 3.67&#949;))
  362. </p>
  363. </td>
  364. <td>
  365. <p>
  366. <span class="blue">Max = 10.6&#949; (Mean = 2.22&#949;)</span>
  367. </p>
  368. </td>
  369. <td>
  370. <p>
  371. <span class="blue">Max = 13.8&#949; (Mean = 2.68&#949;)</span>
  372. </p>
  373. </td>
  374. <td>
  375. <p>
  376. <span class="blue">Max = 6.94&#949; (Mean = 1.71&#949;)</span>
  377. </p>
  378. </td>
  379. </tr>
  380. <tr>
  381. <td>
  382. <p>
  383. Incomplete Beta Function: Medium Values
  384. </p>
  385. </td>
  386. <td>
  387. <p>
  388. <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span><br> <br> (<span class="emphasis"><em>Rmath
  389. 3.2.3:</em></span> Max = 204&#949; (Mean = 25.8&#949;))
  390. </p>
  391. </td>
  392. <td>
  393. <p>
  394. <span class="blue">Max = 73.9&#949; (Mean = 11.2&#949;)</span>
  395. </p>
  396. </td>
  397. <td>
  398. <p>
  399. <span class="blue">Max = 132&#949; (Mean = 19.8&#949;)</span>
  400. </p>
  401. </td>
  402. <td>
  403. <p>
  404. <span class="blue">Max = 56.7&#949; (Mean = 14.3&#949;)</span>
  405. </p>
  406. </td>
  407. </tr>
  408. <tr>
  409. <td>
  410. <p>
  411. Incomplete Beta Function: Large and Diverse Values
  412. </p>
  413. </td>
  414. <td>
  415. <p>
  416. <span class="blue">Max = 0.981&#949; (Mean = 0.0573&#949;)</span><br>
  417. <br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 889&#949; (Mean = 68.4&#949;))
  418. </p>
  419. </td>
  420. <td>
  421. <p>
  422. <span class="blue">Max = 3.45e+04&#949; (Mean = 1.32e+03&#949;)</span>
  423. </p>
  424. </td>
  425. <td>
  426. <p>
  427. <span class="blue">Max = 6.31e+04&#949; (Mean = 2.04e+03&#949;)</span>
  428. </p>
  429. </td>
  430. <td>
  431. <p>
  432. <span class="blue">Max = 1.88e+03&#949; (Mean = 82.7&#949;)</span>
  433. </p>
  434. </td>
  435. </tr>
  436. <tr>
  437. <td>
  438. <p>
  439. Incomplete Beta Function: Small Integer Values
  440. </p>
  441. </td>
  442. <td>
  443. <p>
  444. <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span><br> <br> (<span class="emphasis"><em>Rmath
  445. 3.2.3:</em></span> Max = 84.6&#949; (Mean = 18&#949;))
  446. </p>
  447. </td>
  448. <td>
  449. <p>
  450. <span class="blue">Max = 5.34&#949; (Mean = 1.11&#949;)</span>
  451. </p>
  452. </td>
  453. <td>
  454. <p>
  455. <span class="blue">Max = 107&#949; (Mean = 17.1&#949;)</span>
  456. </p>
  457. </td>
  458. <td>
  459. <p>
  460. <span class="blue">Max = 6.37&#949; (Mean = 1.03&#949;)</span>
  461. </p>
  462. </td>
  463. </tr>
  464. </tbody>
  465. </table></div>
  466. </div>
  467. <br class="table-break"><div class="table">
  468. <a name="math_toolkit.sf_beta.ibeta_function.table_beta_incomplete_"></a><p class="title"><b>Table&#160;8.20.&#160;Error rates for beta (incomplete)</b></p>
  469. <div class="table-contents"><table class="table" summary="Error rates for beta (incomplete)">
  470. <colgroup>
  471. <col>
  472. <col>
  473. <col>
  474. <col>
  475. <col>
  476. </colgroup>
  477. <thead><tr>
  478. <th>
  479. </th>
  480. <th>
  481. <p>
  482. GNU C++ version 7.1.0<br> linux<br> double
  483. </p>
  484. </th>
  485. <th>
  486. <p>
  487. GNU C++ version 7.1.0<br> linux<br> long double
  488. </p>
  489. </th>
  490. <th>
  491. <p>
  492. Sun compiler version 0x5150<br> Sun Solaris<br> long double
  493. </p>
  494. </th>
  495. <th>
  496. <p>
  497. Microsoft Visual C++ version 14.1<br> Win32<br> double
  498. </p>
  499. </th>
  500. </tr></thead>
  501. <tbody>
  502. <tr>
  503. <td>
  504. <p>
  505. Incomplete Beta Function: Small Values
  506. </p>
  507. </td>
  508. <td>
  509. <p>
  510. <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span>
  511. </p>
  512. </td>
  513. <td>
  514. <p>
  515. <span class="blue">Max = 11.1&#949; (Mean = 2.32&#949;)</span>
  516. </p>
  517. </td>
  518. <td>
  519. <p>
  520. <span class="blue">Max = 18.7&#949; (Mean = 3.19&#949;)</span>
  521. </p>
  522. </td>
  523. <td>
  524. <p>
  525. <span class="blue">Max = 9.94&#949; (Mean = 2.17&#949;)</span>
  526. </p>
  527. </td>
  528. </tr>
  529. <tr>
  530. <td>
  531. <p>
  532. Incomplete Beta Function: Medium Values
  533. </p>
  534. </td>
  535. <td>
  536. <p>
  537. <span class="blue">Max = 0.568&#949; (Mean = 0.0254&#949;)</span>
  538. </p>
  539. </td>
  540. <td>
  541. <p>
  542. <span class="blue">Max = 69.2&#949; (Mean = 13.4&#949;)</span>
  543. </p>
  544. </td>
  545. <td>
  546. <p>
  547. <span class="blue">Max = 174&#949; (Mean = 25&#949;)</span>
  548. </p>
  549. </td>
  550. <td>
  551. <p>
  552. <span class="blue">Max = 90&#949; (Mean = 12.7&#949;)</span>
  553. </p>
  554. </td>
  555. </tr>
  556. <tr>
  557. <td>
  558. <p>
  559. Incomplete Beta Function: Large and Diverse Values
  560. </p>
  561. </td>
  562. <td>
  563. <p>
  564. <span class="blue">Max = 0.999&#949; (Mean = 0.0325&#949;)</span>
  565. </p>
  566. </td>
  567. <td>
  568. <p>
  569. <span class="blue">Max = 6.84e+04&#949; (Mean = 2.76e+03&#949;)</span>
  570. </p>
  571. </td>
  572. <td>
  573. <p>
  574. <span class="blue">Max = 6.86e+04&#949; (Mean = 2.79e+03&#949;)</span>
  575. </p>
  576. </td>
  577. <td>
  578. <p>
  579. <span class="blue">Max = 633&#949; (Mean = 29.7&#949;)</span>
  580. </p>
  581. </td>
  582. </tr>
  583. <tr>
  584. <td>
  585. <p>
  586. Incomplete Beta Function: Small Integer Values
  587. </p>
  588. </td>
  589. <td>
  590. <p>
  591. <span class="blue">Max = 0.786&#949; (Mean = 0.0323&#949;)</span>
  592. </p>
  593. </td>
  594. <td>
  595. <p>
  596. <span class="blue">Max = 11.6&#949; (Mean = 3.6&#949;)</span>
  597. </p>
  598. </td>
  599. <td>
  600. <p>
  601. <span class="blue">Max = 51.8&#949; (Mean = 11&#949;)</span>
  602. </p>
  603. </td>
  604. <td>
  605. <p>
  606. <span class="blue">Max = 26&#949; (Mean = 6.28&#949;)</span>
  607. </p>
  608. </td>
  609. </tr>
  610. </tbody>
  611. </table></div>
  612. </div>
  613. <br class="table-break"><div class="table">
  614. <a name="math_toolkit.sf_beta.ibeta_function.table_betac"></a><p class="title"><b>Table&#160;8.21.&#160;Error rates for betac</b></p>
  615. <div class="table-contents"><table class="table" summary="Error rates for betac">
  616. <colgroup>
  617. <col>
  618. <col>
  619. <col>
  620. <col>
  621. <col>
  622. </colgroup>
  623. <thead><tr>
  624. <th>
  625. </th>
  626. <th>
  627. <p>
  628. GNU C++ version 7.1.0<br> linux<br> double
  629. </p>
  630. </th>
  631. <th>
  632. <p>
  633. GNU C++ version 7.1.0<br> linux<br> long double
  634. </p>
  635. </th>
  636. <th>
  637. <p>
  638. Sun compiler version 0x5150<br> Sun Solaris<br> long double
  639. </p>
  640. </th>
  641. <th>
  642. <p>
  643. Microsoft Visual C++ version 14.1<br> Win32<br> double
  644. </p>
  645. </th>
  646. </tr></thead>
  647. <tbody>
  648. <tr>
  649. <td>
  650. <p>
  651. Incomplete Beta Function: Small Values
  652. </p>
  653. </td>
  654. <td>
  655. <p>
  656. <span class="blue">Max = 0.676&#949; (Mean = 0.0302&#949;)</span>
  657. </p>
  658. </td>
  659. <td>
  660. <p>
  661. <span class="blue">Max = 9.92&#949; (Mean = 2.3&#949;)</span>
  662. </p>
  663. </td>
  664. <td>
  665. <p>
  666. <span class="blue">Max = 11.2&#949; (Mean = 2.94&#949;)</span>
  667. </p>
  668. </td>
  669. <td>
  670. <p>
  671. <span class="blue">Max = 8.94&#949; (Mean = 2.06&#949;)</span>
  672. </p>
  673. </td>
  674. </tr>
  675. <tr>
  676. <td>
  677. <p>
  678. Incomplete Beta Function: Medium Values
  679. </p>
  680. </td>
  681. <td>
  682. <p>
  683. <span class="blue">Max = 0.949&#949; (Mean = 0.098&#949;)</span>
  684. </p>
  685. </td>
  686. <td>
  687. <p>
  688. <span class="blue">Max = 63.5&#949; (Mean = 13.5&#949;)</span>
  689. </p>
  690. </td>
  691. <td>
  692. <p>
  693. <span class="blue">Max = 97.6&#949; (Mean = 24.3&#949;)</span>
  694. </p>
  695. </td>
  696. <td>
  697. <p>
  698. <span class="blue">Max = 90.6&#949; (Mean = 14.8&#949;)</span>
  699. </p>
  700. </td>
  701. </tr>
  702. <tr>
  703. <td>
  704. <p>
  705. Incomplete Beta Function: Large and Diverse Values
  706. </p>
  707. </td>
  708. <td>
  709. <p>
  710. <span class="blue">Max = 1.12&#949; (Mean = 0.0458&#949;)</span>
  711. </p>
  712. </td>
  713. <td>
  714. <p>
  715. <span class="blue">Max = 1.05e+05&#949; (Mean = 5.45e+03&#949;)</span>
  716. </p>
  717. </td>
  718. <td>
  719. <p>
  720. <span class="blue">Max = 1.04e+05&#949; (Mean = 5.46e+03&#949;)</span>
  721. </p>
  722. </td>
  723. <td>
  724. <p>
  725. <span class="blue">Max = 3.72e+03&#949; (Mean = 113&#949;)</span>
  726. </p>
  727. </td>
  728. </tr>
  729. <tr>
  730. <td>
  731. <p>
  732. Incomplete Beta Function: Small Integer Values
  733. </p>
  734. </td>
  735. <td>
  736. <p>
  737. <span class="blue">Max = 0.586&#949; (Mean = 0.0314&#949;)</span>
  738. </p>
  739. </td>
  740. <td>
  741. <p>
  742. <span class="blue">Max = 11.1&#949; (Mean = 3.65&#949;)</span>
  743. </p>
  744. </td>
  745. <td>
  746. <p>
  747. <span class="blue">Max = 103&#949; (Mean = 17.4&#949;)</span>
  748. </p>
  749. </td>
  750. <td>
  751. <p>
  752. <span class="blue">Max = 26.2&#949; (Mean = 6.36&#949;)</span>
  753. </p>
  754. </td>
  755. </tr>
  756. </tbody>
  757. </table></div>
  758. </div>
  759. <br class="table-break"><h5>
  760. <a name="math_toolkit.sf_beta.ibeta_function.h3"></a>
  761. <span class="phrase"><a name="math_toolkit.sf_beta.ibeta_function.testing"></a></span><a class="link" href="ibeta_function.html#math_toolkit.sf_beta.ibeta_function.testing">Testing</a>
  762. </h5>
  763. <p>
  764. There are two sets of tests: spot tests compare values taken from <a href="http://functions.wolfram.com/webMathematica/FunctionEvaluation.jsp?name=BetaRegularized" target="_top">Mathworld's
  765. online function evaluator</a> with this implementation: they provide
  766. a basic "sanity check" for the implementation, with one spot-test
  767. in each implementation-domain (see implementation notes below).
  768. </p>
  769. <p>
  770. Accuracy tests use data generated at very high precision (with <a href="http://shoup.net/ntl/doc/RR.txt" target="_top">NTL
  771. RR class</a> set at 1000-bit precision), using the "textbook"
  772. continued fraction representation (refer to the first continued fraction
  773. in the implementation discussion below). Note that this continued fraction
  774. is <span class="emphasis"><em>not</em></span> used in the implementation, and therefore we
  775. have test data that is fully independent of the code.
  776. </p>
  777. <h5>
  778. <a name="math_toolkit.sf_beta.ibeta_function.h4"></a>
  779. <span class="phrase"><a name="math_toolkit.sf_beta.ibeta_function.implementation"></a></span><a class="link" href="ibeta_function.html#math_toolkit.sf_beta.ibeta_function.implementation">Implementation</a>
  780. </h5>
  781. <p>
  782. This implementation is closely based upon <a href="http://portal.acm.org/citation.cfm?doid=131766.131776" target="_top">"Algorithm
  783. 708; Significant digit computation of the incomplete beta function ratios",
  784. DiDonato and Morris, ACM, 1992.</a>
  785. </p>
  786. <p>
  787. All four of these functions share a common implementation: this is passed
  788. both x and y, and can return either p or q where these are related by:
  789. </p>
  790. <div class="blockquote"><blockquote class="blockquote"><p>
  791. <span class="inlinemediaobject"><img src="../../../equations/ibeta_inv5.svg"></span>
  792. </p></blockquote></div>
  793. <p>
  794. so at any point we can swap a for b, x for y and p for q if this results
  795. in a more favourable position. Generally such swaps are performed so that
  796. we always compute a value less than 0.9: when required this can then be subtracted
  797. from 1 without undue cancellation error.
  798. </p>
  799. <p>
  800. The following continued fraction representation is found in many textbooks
  801. but is not used in this implementation - it's both slower and less accurate
  802. than the alternatives - however it is used to generate test data:
  803. </p>
  804. <div class="blockquote"><blockquote class="blockquote"><p>
  805. <span class="inlinemediaobject"><img src="../../../equations/ibeta5.svg"></span>
  806. </p></blockquote></div>
  807. <p>
  808. The following continued fraction is due to <a href="http://portal.acm.org/citation.cfm?doid=131766.131776" target="_top">Didonato
  809. and Morris</a>, and is used in this implementation when a and b are both
  810. greater than 1:
  811. </p>
  812. <div class="blockquote"><blockquote class="blockquote"><p>
  813. <span class="inlinemediaobject"><img src="../../../equations/ibeta6.svg"></span>
  814. </p></blockquote></div>
  815. <p>
  816. For smallish b and x then a series representation can be used:
  817. </p>
  818. <div class="blockquote"><blockquote class="blockquote"><p>
  819. <span class="inlinemediaobject"><img src="../../../equations/ibeta7.svg"></span>
  820. </p></blockquote></div>
  821. <p>
  822. When b &lt;&lt; a then the transition from 0 to 1 occurs very close to x
  823. = 1 and some care has to be taken over the method of computation, in that
  824. case the following series representation is used:
  825. </p>
  826. <div class="blockquote"><blockquote class="blockquote"><p>
  827. <span class="inlinemediaobject"><img src="../../../equations/ibeta8.svg"></span>
  828. </p></blockquote></div>
  829. <p>
  830. Where Q(a,x) is an <a href="http://functions.wolfram.com/GammaBetaErf/Gamma2/" target="_top">incomplete
  831. gamma function</a>. Note that this method relies on keeping a table of
  832. all the p<sub>n </sub> previously computed, which does limit the precision of the method,
  833. depending upon the size of the table used.
  834. </p>
  835. <p>
  836. When <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>b</em></span> are both small integers,
  837. then we can relate the incomplete beta to the binomial distribution and use
  838. the following finite sum:
  839. </p>
  840. <div class="blockquote"><blockquote class="blockquote"><p>
  841. <span class="inlinemediaobject"><img src="../../../equations/ibeta12.svg"></span>
  842. </p></blockquote></div>
  843. <p>
  844. Finally we can sidestep difficult areas, or move to an area with a more efficient
  845. means of computation, by using the duplication formulae:
  846. </p>
  847. <div class="blockquote"><blockquote class="blockquote"><p>
  848. <span class="inlinemediaobject"><img src="../../../equations/ibeta10.svg"></span>
  849. </p></blockquote></div>
  850. <div class="blockquote"><blockquote class="blockquote"><p>
  851. <span class="inlinemediaobject"><img src="../../../equations/ibeta11.svg"></span>
  852. </p></blockquote></div>
  853. <p>
  854. The domains of a, b and x for which the various methods are used are identical
  855. to those described in the <a href="http://portal.acm.org/citation.cfm?doid=131766.131776" target="_top">Didonato
  856. and Morris TOMS 708 paper</a>.
  857. </p>
  858. </div>
  859. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  860. <td align="left"></td>
  861. <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2019 Nikhar
  862. Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
  863. Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
  864. R&#229;de, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
  865. Daryle Walker and Xiaogang Zhang<p>
  866. Distributed under the Boost Software License, Version 1.0. (See accompanying
  867. file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
  868. </p>
  869. </div></td>
  870. </tr></table>
  871. <hr>
  872. <div class="spirit-nav">
  873. <a accesskey="p" href="beta_function.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_beta.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="ibeta_inv_function.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
  874. </div>
  875. </body>
  876. </html>