3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Incomplete Gamma Function Inverses</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_gamma.html" title="Gamma Functions">
9 <link rel="prev" href="igamma.html" title="Incomplete Gamma Functions">
10 <link rel="next" href="gamma_derivatives.html" title="Derivative of the Incomplete Gamma Function">
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>
22 <div class="spirit-nav">
23 <a accesskey="p" href="igamma.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_gamma.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="gamma_derivatives.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h3 class="title">
27 <a name="math_toolkit.sf_gamma.igamma_inv"></a><a class="link" href="igamma_inv.html" title="Incomplete Gamma Function Inverses">Incomplete Gamma Function
29 </h3></div></div></div>
31 <a name="math_toolkit.sf_gamma.igamma_inv.h0"></a>
32 <span class="phrase"><a name="math_toolkit.sf_gamma.igamma_inv.synopsis"></a></span><a class="link" href="igamma_inv.html#math_toolkit.sf_gamma.igamma_inv.synopsis">Synopsis</a>
34 <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</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">gamma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
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>
38 <span class="keyword">template</span> <span class="special"><</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>
39 <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">gamma_q_inv</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">q</span><span class="special">);</span>
41 <span class="keyword">template</span> <span class="special"><</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> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></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">gamma_q_inv</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">q</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
44 <span class="keyword">template</span> <span class="special"><</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>
45 <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">gamma_p_inv</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">p</span><span class="special">);</span>
47 <span class="keyword">template</span> <span class="special"><</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> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></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">gamma_p_inv</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">p</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
50 <span class="keyword">template</span> <span class="special"><</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>
51 <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">gamma_q_inva</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">q</span><span class="special">);</span>
53 <span class="keyword">template</span> <span class="special"><</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> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
54 <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">gamma_q_inva</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">q</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
56 <span class="keyword">template</span> <span class="special"><</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>
57 <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">gamma_p_inva</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">p</span><span class="special">);</span>
59 <span class="keyword">template</span> <span class="special"><</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> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
60 <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">gamma_p_inva</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">p</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
62 <span class="special">}}</span> <span class="comment">// namespaces</span>
65 <a name="math_toolkit.sf_gamma.igamma_inv.h1"></a>
66 <span class="phrase"><a name="math_toolkit.sf_gamma.igamma_inv.description"></a></span><a class="link" href="igamma_inv.html#math_toolkit.sf_gamma.igamma_inv.description">Description</a>
69 There are four <a href="http://mathworld.wolfram.com/IncompleteGammaFunction.html" target="_top">incomplete
70 gamma function</a> inverses which either compute <span class="emphasis"><em>x</em></span>
71 given <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>p</em></span> or <span class="emphasis"><em>q</em></span>,
72 or else compute <span class="emphasis"><em>a</em></span> given <span class="emphasis"><em>x</em></span> and either
73 <span class="emphasis"><em>p</em></span> or <span class="emphasis"><em>q</em></span>.
76 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
77 type calculation rules</em></span></a> when T1 and T2 are different types,
78 otherwise the return type is simply T1.
81 The final <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
82 be used to control the behaviour of the function: how it handles errors,
83 what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">policy
84 documentation for more details</a>.
86 <div class="tip"><table border="0" summary="Tip">
88 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../doc/src/images/tip.png"></td>
89 <th align="left">Tip</th>
91 <tr><td align="left" valign="top">
93 When people normally talk about the inverse of the incomplete gamma function,
94 they are talking about inverting on parameter <span class="emphasis"><em>x</em></span>. These
95 are implemented here as <code class="computeroutput"><span class="identifier">gamma_p_inv</span></code>
96 and <code class="computeroutput"><span class="identifier">gamma_q_inv</span></code>, and are
97 by far the most efficient of the inverses presented here.
100 The inverse on the <span class="emphasis"><em>a</em></span> parameter finds use in some statistical
101 applications but has to be computed by rather brute force numerical techniques
102 and is consequently several times slower. These are implemented here as
103 <code class="computeroutput"><span class="identifier">gamma_p_inva</span></code> and <code class="computeroutput"><span class="identifier">gamma_q_inva</span></code>.
107 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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>
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">gamma_q_inv</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">q</span><span class="special">);</span>
110 <span class="keyword">template</span> <span class="special"><</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> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
111 <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">gamma_q_inv</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">q</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
114 Returns a value x such that: <code class="computeroutput"><span class="identifier">q</span>
115 <span class="special">=</span> <span class="identifier">gamma_q</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span>
116 <span class="identifier">x</span><span class="special">);</span></code>
119 Requires: <span class="emphasis"><em>a > 0</em></span> and <span class="emphasis"><em>1 >= p,q >= 0</em></span>.
121 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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>
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">gamma_p_inv</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">p</span><span class="special">);</span>
124 <span class="keyword">template</span> <span class="special"><</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> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
125 <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">gamma_p_inv</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">p</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
128 Returns a value x such that: <code class="computeroutput"><span class="identifier">p</span>
129 <span class="special">=</span> <span class="identifier">gamma_p</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span>
130 <span class="identifier">x</span><span class="special">);</span></code>
133 Requires: <span class="emphasis"><em>a > 0</em></span> and <span class="emphasis"><em>1 >= p,q >= 0</em></span>.
135 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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>
136 <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">gamma_q_inva</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">q</span><span class="special">);</span>
138 <span class="keyword">template</span> <span class="special"><</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> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
139 <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">gamma_q_inva</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">q</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
142 Returns a value a such that: <code class="computeroutput"><span class="identifier">q</span>
143 <span class="special">=</span> <span class="identifier">gamma_q</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span>
144 <span class="identifier">x</span><span class="special">);</span></code>
147 Requires: <span class="emphasis"><em>x > 0</em></span> and <span class="emphasis"><em>1 >= p,q >= 0</em></span>.
149 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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>
150 <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">gamma_p_inva</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">p</span><span class="special">);</span>
152 <span class="keyword">template</span> <span class="special"><</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> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
153 <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">gamma_p_inva</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">p</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
156 Returns a value a such that: <code class="computeroutput"><span class="identifier">p</span>
157 <span class="special">=</span> <span class="identifier">gamma_p</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span>
158 <span class="identifier">x</span><span class="special">);</span></code>
161 Requires: <span class="emphasis"><em>x > 0</em></span> and <span class="emphasis"><em>1 >= p,q >= 0</em></span>.
164 <a name="math_toolkit.sf_gamma.igamma_inv.h2"></a>
165 <span class="phrase"><a name="math_toolkit.sf_gamma.igamma_inv.accuracy"></a></span><a class="link" href="igamma_inv.html#math_toolkit.sf_gamma.igamma_inv.accuracy">Accuracy</a>
168 The accuracy of these functions doesn't vary much by platform or by the type
169 T. Given that these functions are computed by iterative methods, they are
170 deliberately "detuned" so as not to be too accurate: it is in any
171 case impossible for these function to be more accurate than the regular forward
172 incomplete gamma functions. In practice, the accuracy of these functions
173 is very similar to that of <a class="link" href="igamma.html" title="Incomplete Gamma Functions">gamma_p</a>
174 and <a class="link" href="igamma.html" title="Incomplete Gamma Functions">gamma_q</a> functions:
177 <a name="math_toolkit.sf_gamma.igamma_inv.table_gamma_p_inv"></a><p class="title"><b>Table 8.13. Error rates for gamma_p_inv</b></p>
178 <div class="table-contents"><table class="table" summary="Error rates for gamma_p_inv">
191 GNU C++ version 7.1.0<br> linux<br> double
196 GNU C++ version 7.1.0<br> linux<br> long double
201 Sun compiler version 0x5150<br> Sun Solaris<br> long double
206 Microsoft Visual C++ version 14.1<br> Win32<br> double
214 incomplete gamma inverse(a, z) medium values
219 <span class="blue">Max = 0.993ε (Mean = 0.15ε)</span><br> <br>
220 (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 4.88ε (Mean = 0.868ε))
225 <span class="blue">Max = 1.8ε (Mean = 0.406ε)</span>
230 <span class="blue">Max = 1.89ε (Mean = 0.466ε)</span>
235 <span class="blue">Max = 1.71ε (Mean = 0.34ε)</span>
242 incomplete gamma inverse(a, z) large values
247 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>Rmath
248 3.2.3:</em></span> Max = 0.816ε (Mean = 0.0874ε))
253 <span class="blue">Max = 0.509ε (Mean = 0.0447ε)</span>
258 <span class="blue">Max = 0.509ε (Mean = 0.0447ε)</span>
263 <span class="blue">Max = 0.924ε (Mean = 0.108ε)</span>
270 incomplete gamma inverse(a, z) small values
275 <span class="blue">Max = 441ε (Mean = 53.9ε)</span><br> <br>
276 (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 547ε (Mean = 61.6ε))
281 <span class="blue">Max = 9.17e+03ε (Mean = 1.45e+03ε)</span>
286 <span class="blue">Max = 1.09e+04ε (Mean = 1.3e+03ε)</span>
291 <span class="blue">Max = 1.1e+03ε (Mean = 131ε)</span>
298 <br class="table-break"><div class="table">
299 <a name="math_toolkit.sf_gamma.igamma_inv.table_gamma_q_inv"></a><p class="title"><b>Table 8.14. Error rates for gamma_q_inv</b></p>
300 <div class="table-contents"><table class="table" summary="Error rates for gamma_q_inv">
313 GNU C++ version 7.1.0<br> linux<br> double
318 GNU C++ version 7.1.0<br> linux<br> long double
323 Sun compiler version 0x5150<br> Sun Solaris<br> long double
328 Microsoft Visual C++ version 14.1<br> Win32<br> double
336 incomplete gamma inverse(a, z) medium values
341 <span class="blue">Max = 0.912ε (Mean = 0.154ε)</span><br> <br>
342 (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 4.66ε (Mean = 0.792ε))
347 <span class="blue">Max = 6.2ε (Mean = 0.627ε)</span>
352 <span class="blue">Max = 6.2ε (Mean = 0.683ε)</span>
357 <span class="blue">Max = 2.88ε (Mean = 0.469ε)</span>
364 incomplete gamma inverse(a, z) large values
369 <span class="blue">Max = 0.894ε (Mean = 0.0915ε)</span><br>
370 <br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 0.894ε (Mean = 0.106ε))
375 <span class="blue">Max = 0ε (Mean = 0ε)</span>
380 <span class="blue">Max = 0ε (Mean = 0ε)</span>
385 <span class="blue">Max = 0.814ε (Mean = 0.0856ε)</span>
392 incomplete gamma inverse(a, z) small values
397 <span class="blue">Max = 292ε (Mean = 36.4ε)</span><br> <br>
398 (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 415ε (Mean = 48.7ε))
403 <span class="blue">Max = 8.28e+03ε (Mean = 1.09e+03ε)</span>
408 <span class="blue">Max = 8.98e+03ε (Mean = 877ε)</span>
413 <span class="blue">Max = 451ε (Mean = 64.7ε)</span>
420 <br class="table-break"><div class="table">
421 <a name="math_toolkit.sf_gamma.igamma_inv.table_gamma_p_inva"></a><p class="title"><b>Table 8.15. Error rates for gamma_p_inva</b></p>
422 <div class="table-contents"><table class="table" summary="Error rates for gamma_p_inva">
435 GNU C++ version 7.1.0<br> linux<br> double
440 GNU C++ version 7.1.0<br> linux<br> long double
445 Sun compiler version 0x5150<br> Sun Solaris<br> long double
450 Microsoft Visual C++ version 14.1<br> Win32<br> double
457 Incomplete gamma inverses.
462 <span class="blue">Max = 0ε (Mean = 0ε)</span>
467 <span class="blue">Max = 7.87ε (Mean = 1.15ε)</span>
472 <span class="blue">Max = 4.08ε (Mean = 1.12ε)</span>
477 <span class="blue">Max = 4.92ε (Mean = 1.03ε)</span>
483 <br class="table-break"><div class="table">
484 <a name="math_toolkit.sf_gamma.igamma_inv.table_gamma_q_inva"></a><p class="title"><b>Table 8.16. Error rates for gamma_q_inva</b></p>
485 <div class="table-contents"><table class="table" summary="Error rates for gamma_q_inva">
498 GNU C++ version 7.1.0<br> linux<br> double
503 GNU C++ version 7.1.0<br> linux<br> long double
508 Sun compiler version 0x5150<br> Sun Solaris<br> long double
513 Microsoft Visual C++ version 14.1<br> Win32<br> double
520 Incomplete gamma inverses.
525 <span class="blue">Max = 0ε (Mean = 0ε)</span>
530 <span class="blue">Max = 8.42ε (Mean = 1.3ε)</span>
535 <span class="blue">Max = 7.86ε (Mean = 1.24ε)</span>
540 <span class="blue">Max = 5.05ε (Mean = 1.08ε)</span>
546 <br class="table-break"><h5>
547 <a name="math_toolkit.sf_gamma.igamma_inv.h3"></a>
548 <span class="phrase"><a name="math_toolkit.sf_gamma.igamma_inv.testing"></a></span><a class="link" href="igamma_inv.html#math_toolkit.sf_gamma.igamma_inv.testing">Testing</a>
551 There are two sets of tests:
553 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
554 <li class="listitem">
555 Basic sanity checks attempt to "round-trip" from <span class="emphasis"><em>a</em></span>
556 and <span class="emphasis"><em>x</em></span> to <span class="emphasis"><em>p</em></span> or <span class="emphasis"><em>q</em></span>
557 and back again. These tests have quite generous tolerances: in general
558 both the incomplete gamma, and its inverses, change so rapidly that round
559 tripping to more than a couple of significant digits isn't possible.
560 This is especially true when <span class="emphasis"><em>p</em></span> or <span class="emphasis"><em>q</em></span>
561 is very near one: in this case there isn't enough "information content"
562 in the input to the inverse function to get back where you started.
564 <li class="listitem">
565 Accuracy checks using high precision test values. These measure the accuracy
566 of the result, given exact input values.
570 <a name="math_toolkit.sf_gamma.igamma_inv.h4"></a>
571 <span class="phrase"><a name="math_toolkit.sf_gamma.igamma_inv.implementation"></a></span><a class="link" href="igamma_inv.html#math_toolkit.sf_gamma.igamma_inv.implementation">Implementation</a>
574 The functions <code class="computeroutput"><span class="identifier">gamma_p_inv</span></code>
575 and <a href="http://functions.wolfram.com/GammaBetaErf/InverseGammaRegularized/" target="_top"><code class="computeroutput"><span class="identifier">gamma_q_inv</span></code></a> share a common implementation.
578 First an initial approximation is computed using the methodology described
582 <a href="http://portal.acm.org/citation.cfm?id=23109&coll=portal&dl=ACM" target="_top">A.
583 R. Didonato and A. H. Morris, Computation of the Incomplete Gamma Function
584 Ratios and their Inverse, ACM Trans. Math. Software 12 (1986), 377-393.</a>
587 Finally, the last few bits are cleaned up using Halley iteration, the iteration
588 limit is set to 2/3 of the number of bits in T, which by experiment is sufficient
589 to ensure that the inverses are at least as accurate as the normal incomplete
590 gamma functions. In testing, no more than 3 iterations are required to produce
591 a result as accurate as the forward incomplete gamma function, and in many
592 cases only one iteration is required.
595 The functions <code class="computeroutput"><span class="identifier">gamma_p_inva</span></code>
596 and <code class="computeroutput"><span class="identifier">gamma_q_inva</span></code> also share
597 a common implementation but are handled separately from <code class="computeroutput"><span class="identifier">gamma_p_inv</span></code>
598 and <code class="computeroutput"><span class="identifier">gamma_q_inv</span></code>.
601 An initial approximation for <span class="emphasis"><em>a</em></span> is computed very crudely
602 so that <span class="emphasis"><em>gamma_p(a, x) ~ 0.5</em></span>, this value is then used
603 as a starting point for a generic derivative-free root finding algorithm.
604 As a consequence, these two functions are rather more expensive to compute
605 than the <code class="computeroutput"><span class="identifier">gamma_p_inv</span></code> or
606 <code class="computeroutput"><span class="identifier">gamma_q_inv</span></code> functions. Even
607 so, the root is usually found in fewer than 10 iterations.
610 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
611 <td align="left"></td>
612 <td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar
613 Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
614 Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
615 Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
616 Daryle Walker and Xiaogang Zhang<p>
617 Distributed under the Boost Software License, Version 1.0. (See accompanying
618 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>)
623 <div class="spirit-nav">
624 <a accesskey="p" href="igamma.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_gamma.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="gamma_derivatives.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>