]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <head> | |
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.77.1"> | |
7 | <link rel="home" href="../../index.html" title="Math Toolkit 2.5.1"> | |
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"> | |
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="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> | |
24 | </div> | |
25 | <div class="section"> | |
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 | |
28 | Inverses</a> | |
29 | </h3></div></div></div> | |
30 | <h5> | |
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> | |
33 | </h5> | |
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> | |
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 | ||
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> | |
40 | ||
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 15. 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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
43 | ||
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> | |
46 | ||
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 15. 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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
49 | ||
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> | |
52 | ||
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 15. 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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
55 | ||
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> | |
58 | ||
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 15. 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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
61 | ||
62 | <span class="special">}}</span> <span class="comment">// namespaces</span> | |
63 | </pre> | |
64 | <h5> | |
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> | |
67 | </h5> | |
68 | <p> | |
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>. | |
74 | </p> | |
75 | <p> | |
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. | |
79 | </p> | |
80 | <p> | |
81 | The final <a class="link" href="../../policy.html" title="Chapter 15. 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 15. Policies: Controlling Precision, Error Handling etc">policy | |
84 | documentation for more details</a>. | |
85 | </p> | |
86 | <div class="tip"><table border="0" summary="Tip"> | |
87 | <tr> | |
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> | |
90 | </tr> | |
91 | <tr><td align="left" valign="top"> | |
92 | <p> | |
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 gamma_p_inv and gamma_q_inv, and are by far the | |
96 | most efficient of the inverses presented here. | |
97 | </p> | |
98 | <p> | |
99 | The inverse on the <span class="emphasis"><em>a</em></span> parameter finds use in some statistical | |
100 | applications but has to be computed by rather brute force numerical techniques | |
101 | and is consequently several times slower. These are implemented here as | |
102 | gamma_p_inva and gamma_q_inva. | |
103 | </p> | |
104 | </td></tr> | |
105 | </table></div> | |
106 | <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> | |
107 | <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> | |
108 | ||
109 | <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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></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">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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
111 | </pre> | |
112 | <p> | |
113 | Returns a value x such that: <code class="computeroutput"><span class="identifier">q</span> | |
114 | <span class="special">=</span> <span class="identifier">gamma_q</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> | |
115 | <span class="identifier">x</span><span class="special">);</span></code> | |
116 | </p> | |
117 | <p> | |
118 | Requires: <span class="emphasis"><em>a > 0</em></span> and <span class="emphasis"><em>1 >= p,q >= 0</em></span>. | |
119 | </p> | |
120 | <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> | |
121 | <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> | |
122 | ||
123 | <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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> | |
124 | <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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
125 | </pre> | |
126 | <p> | |
127 | Returns a value x such that: <code class="computeroutput"><span class="identifier">p</span> | |
128 | <span class="special">=</span> <span class="identifier">gamma_p</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> | |
129 | <span class="identifier">x</span><span class="special">);</span></code> | |
130 | </p> | |
131 | <p> | |
132 | Requires: <span class="emphasis"><em>a > 0</em></span> and <span class="emphasis"><em>1 >= p,q >= 0</em></span>. | |
133 | </p> | |
134 | <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> | |
135 | <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> | |
136 | ||
137 | <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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> | |
138 | <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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
139 | </pre> | |
140 | <p> | |
141 | Returns a value a such that: <code class="computeroutput"><span class="identifier">q</span> | |
142 | <span class="special">=</span> <span class="identifier">gamma_q</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> | |
143 | <span class="identifier">x</span><span class="special">);</span></code> | |
144 | </p> | |
145 | <p> | |
146 | Requires: <span class="emphasis"><em>x > 0</em></span> and <span class="emphasis"><em>1 >= p,q >= 0</em></span>. | |
147 | </p> | |
148 | <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> | |
149 | <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> | |
150 | ||
151 | <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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> | |
152 | <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 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
153 | </pre> | |
154 | <p> | |
155 | Returns a value a such that: <code class="computeroutput"><span class="identifier">p</span> | |
156 | <span class="special">=</span> <span class="identifier">gamma_p</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> | |
157 | <span class="identifier">x</span><span class="special">);</span></code> | |
158 | </p> | |
159 | <p> | |
160 | Requires: <span class="emphasis"><em>x > 0</em></span> and <span class="emphasis"><em>1 >= p,q >= 0</em></span>. | |
161 | </p> | |
162 | <h5> | |
163 | <a name="math_toolkit.sf_gamma.igamma_inv.h2"></a> | |
164 | <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> | |
165 | </h5> | |
166 | <p> | |
167 | The accuracy of these functions doesn't vary much by platform or by the type | |
168 | T. Given that these functions are computed by iterative methods, they are | |
169 | deliberately "detuned" so as not to be too accurate: it is in any | |
170 | case impossible for these function to be more accurate than the regular forward | |
171 | incomplete gamma functions. In practice, the accuracy of these functions | |
172 | is very similar to that of <a class="link" href="igamma.html" title="Incomplete Gamma Functions">gamma_p</a> | |
173 | and <a class="link" href="igamma.html" title="Incomplete Gamma Functions">gamma_q</a> functions: | |
174 | </p> | |
175 | <div class="table"> | |
176 | <a name="math_toolkit.sf_gamma.igamma_inv.table_gamma_p_inv"></a><p class="title"><b>Table 6.13. Error rates for gamma_p_inv</b></p> | |
177 | <div class="table-contents"><table class="table" summary="Error rates for gamma_p_inv"> | |
178 | <colgroup> | |
179 | <col> | |
180 | <col> | |
181 | <col> | |
182 | <col> | |
183 | <col> | |
184 | </colgroup> | |
185 | <thead><tr> | |
186 | <th> | |
187 | </th> | |
188 | <th> | |
189 | <p> | |
190 | Microsoft Visual C++ version 12.0<br> Win32<br> double | |
191 | </p> | |
192 | </th> | |
193 | <th> | |
194 | <p> | |
195 | GNU C++ version 5.1.0<br> linux<br> double | |
196 | </p> | |
197 | </th> | |
198 | <th> | |
199 | <p> | |
200 | GNU C++ version 5.1.0<br> linux<br> long double | |
201 | </p> | |
202 | </th> | |
203 | <th> | |
204 | <p> | |
205 | Sun compiler version 0x5130<br> Sun Solaris<br> long double | |
206 | </p> | |
207 | </th> | |
208 | </tr></thead> | |
209 | <tbody> | |
210 | <tr> | |
211 | <td> | |
212 | <p> | |
213 | incomplete gamma inverse(a, z) medium values | |
214 | </p> | |
215 | </td> | |
216 | <td> | |
217 | <p> | |
218 | <span class="blue">Max = 1.01ε (Mean = 0.307ε)</span> | |
219 | </p> | |
220 | </td> | |
221 | <td> | |
222 | <p> | |
223 | <span class="blue">Max = 0.993ε (Mean = 0.15ε)</span><br> <br> | |
224 | (<span class="emphasis"><em>Rmath 3.0.2:</em></span> Max = 4.88ε (Mean = 0.868ε)) | |
225 | </p> | |
226 | </td> | |
227 | <td> | |
228 | <p> | |
229 | <span class="blue">Max = 1.62ε (Mean = 0.365ε)</span> | |
230 | </p> | |
231 | </td> | |
232 | <td> | |
233 | <p> | |
234 | <span class="blue">Max = 1.86ε (Mean = 0.405ε)</span> | |
235 | </p> | |
236 | </td> | |
237 | </tr> | |
238 | <tr> | |
239 | <td> | |
240 | <p> | |
241 | incomplete gamma inverse(a, z) large values | |
242 | </p> | |
243 | </td> | |
244 | <td> | |
245 | <p> | |
246 | <span class="blue">Max = 0.924ε (Mean = 0.118ε)</span> | |
247 | </p> | |
248 | </td> | |
249 | <td> | |
250 | <p> | |
251 | <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>Rmath | |
252 | 3.0.2:</em></span> Max = 0.816ε (Mean = 0.0874ε)) | |
253 | </p> | |
254 | </td> | |
255 | <td> | |
256 | <p> | |
257 | <span class="blue">Max = 0.509ε (Mean = 0.0447ε)</span> | |
258 | </p> | |
259 | </td> | |
260 | <td> | |
261 | <p> | |
262 | <span class="blue">Max = 0.509ε (Mean = 0.0447ε)</span> | |
263 | </p> | |
264 | </td> | |
265 | </tr> | |
266 | <tr> | |
267 | <td> | |
268 | <p> | |
269 | incomplete gamma inverse(a, z) small values | |
270 | </p> | |
271 | </td> | |
272 | <td> | |
273 | <p> | |
274 | <span class="blue">Max = 1.1e+003ε (Mean = 108ε)</span> | |
275 | </p> | |
276 | </td> | |
277 | <td> | |
278 | <p> | |
279 | <span class="blue">Max = 441ε (Mean = 53.9ε)</span><br> <br> | |
280 | (<span class="emphasis"><em>Rmath 3.0.2:</em></span> Max = 547ε (Mean = 61.6ε)) | |
281 | </p> | |
282 | </td> | |
283 | <td> | |
284 | <p> | |
285 | <span class="blue">Max = 9.17e+03ε (Mean = 1.32e+03ε)</span> | |
286 | </p> | |
287 | </td> | |
288 | <td> | |
289 | <p> | |
290 | <span class="blue">Max = 1.09e+04ε (Mean = 1.46e+03ε)</span> | |
291 | </p> | |
292 | </td> | |
293 | </tr> | |
294 | </tbody> | |
295 | </table></div> | |
296 | </div> | |
297 | <br class="table-break"><div class="table"> | |
298 | <a name="math_toolkit.sf_gamma.igamma_inv.table_gamma_q_inv"></a><p class="title"><b>Table 6.14. Error rates for gamma_q_inv</b></p> | |
299 | <div class="table-contents"><table class="table" summary="Error rates for gamma_q_inv"> | |
300 | <colgroup> | |
301 | <col> | |
302 | <col> | |
303 | <col> | |
304 | <col> | |
305 | <col> | |
306 | </colgroup> | |
307 | <thead><tr> | |
308 | <th> | |
309 | </th> | |
310 | <th> | |
311 | <p> | |
312 | Microsoft Visual C++ version 12.0<br> Win32<br> double | |
313 | </p> | |
314 | </th> | |
315 | <th> | |
316 | <p> | |
317 | GNU C++ version 5.1.0<br> linux<br> double | |
318 | </p> | |
319 | </th> | |
320 | <th> | |
321 | <p> | |
322 | GNU C++ version 5.1.0<br> linux<br> long double | |
323 | </p> | |
324 | </th> | |
325 | <th> | |
326 | <p> | |
327 | Sun compiler version 0x5130<br> Sun Solaris<br> long double | |
328 | </p> | |
329 | </th> | |
330 | </tr></thead> | |
331 | <tbody> | |
332 | <tr> | |
333 | <td> | |
334 | <p> | |
335 | incomplete gamma inverse(a, z) medium values | |
336 | </p> | |
337 | </td> | |
338 | <td> | |
339 | <p> | |
340 | <span class="blue">Max = 3.46ε (Mean = 0.475ε)</span> | |
341 | </p> | |
342 | </td> | |
343 | <td> | |
344 | <p> | |
345 | <span class="blue">Max = 0.912ε (Mean = 0.154ε)</span><br> <br> | |
346 | (<span class="emphasis"><em>Rmath 3.0.2:</em></span> Max = 4.66ε (Mean = 0.792ε)) | |
347 | </p> | |
348 | </td> | |
349 | <td> | |
350 | <p> | |
351 | <span class="blue">Max = 6.2ε (Mean = 0.659ε)</span> | |
352 | </p> | |
353 | </td> | |
354 | <td> | |
355 | <p> | |
356 | <span class="blue">Max = 6.2ε (Mean = 0.661ε)</span> | |
357 | </p> | |
358 | </td> | |
359 | </tr> | |
360 | <tr> | |
361 | <td> | |
362 | <p> | |
363 | incomplete gamma inverse(a, z) large values | |
364 | </p> | |
365 | </td> | |
366 | <td> | |
367 | <p> | |
368 | <span class="blue">Max = 0.814ε (Mean = 0.0856ε)</span> | |
369 | </p> | |
370 | </td> | |
371 | <td> | |
372 | <p> | |
373 | <span class="blue">Max = 0.894ε (Mean = 0.0915ε)</span><br> | |
374 | <br> (<span class="emphasis"><em>Rmath 3.0.2:</em></span> Max = 0.894ε (Mean = 0.106ε)) | |
375 | </p> | |
376 | </td> | |
377 | <td> | |
378 | <p> | |
379 | <span class="blue">Max = 0ε (Mean = 0ε)</span> | |
380 | </p> | |
381 | </td> | |
382 | <td> | |
383 | <p> | |
384 | <span class="blue">Max = 0ε (Mean = 0ε)</span> | |
385 | </p> | |
386 | </td> | |
387 | </tr> | |
388 | <tr> | |
389 | <td> | |
390 | <p> | |
391 | incomplete gamma inverse(a, z) small values | |
392 | </p> | |
393 | </td> | |
394 | <td> | |
395 | <p> | |
396 | <span class="blue">Max = 451ε (Mean = 65ε)</span> | |
397 | </p> | |
398 | </td> | |
399 | <td> | |
400 | <p> | |
401 | <span class="blue">Max = 292ε (Mean = 36.4ε)</span><br> <br> | |
402 | (<span class="emphasis"><em>Rmath 3.0.2:</em></span> Max = 415ε (Mean = 48.7ε)) | |
403 | </p> | |
404 | </td> | |
405 | <td> | |
406 | <p> | |
407 | <span class="blue">Max = 8.28e+03ε (Mean = 963ε)</span> | |
408 | </p> | |
409 | </td> | |
410 | <td> | |
411 | <p> | |
412 | <span class="blue">Max = 8.98e+03ε (Mean = 877ε)</span> | |
413 | </p> | |
414 | </td> | |
415 | </tr> | |
416 | </tbody> | |
417 | </table></div> | |
418 | </div> | |
419 | <br class="table-break"><div class="table"> | |
420 | <a name="math_toolkit.sf_gamma.igamma_inv.table_gamma_p_inva"></a><p class="title"><b>Table 6.15. Error rates for gamma_p_inva</b></p> | |
421 | <div class="table-contents"><table class="table" summary="Error rates for gamma_p_inva"> | |
422 | <colgroup> | |
423 | <col> | |
424 | <col> | |
425 | <col> | |
426 | <col> | |
427 | <col> | |
428 | </colgroup> | |
429 | <thead><tr> | |
430 | <th> | |
431 | </th> | |
432 | <th> | |
433 | <p> | |
434 | Microsoft Visual C++ version 12.0<br> Win32<br> double | |
435 | </p> | |
436 | </th> | |
437 | <th> | |
438 | <p> | |
439 | GNU C++ version 5.1.0<br> linux<br> double | |
440 | </p> | |
441 | </th> | |
442 | <th> | |
443 | <p> | |
444 | GNU C++ version 5.1.0<br> linux<br> long double | |
445 | </p> | |
446 | </th> | |
447 | <th> | |
448 | <p> | |
449 | Sun compiler version 0x5130<br> Sun Solaris<br> long double | |
450 | </p> | |
451 | </th> | |
452 | </tr></thead> | |
453 | <tbody><tr> | |
454 | <td> | |
455 | <p> | |
456 | Incomplete gamma inverses. | |
457 | </p> | |
458 | </td> | |
459 | <td> | |
460 | <p> | |
461 | <span class="blue">Max = 3.52ε (Mean = 0.997ε)</span> | |
462 | </p> | |
463 | </td> | |
464 | <td> | |
465 | <p> | |
466 | <span class="blue">Max = 0ε (Mean = 0ε)</span> | |
467 | </p> | |
468 | </td> | |
469 | <td> | |
470 | <p> | |
471 | <span class="blue">Max = 6.44ε (Mean = 1.1ε)</span> | |
472 | </p> | |
473 | </td> | |
474 | <td> | |
475 | <p> | |
476 | <span class="blue">Max = 4.08ε (Mean = 1.12ε)</span> | |
477 | </p> | |
478 | </td> | |
479 | </tr></tbody> | |
480 | </table></div> | |
481 | </div> | |
482 | <br class="table-break"><div class="table"> | |
483 | <a name="math_toolkit.sf_gamma.igamma_inv.table_gamma_q_inva"></a><p class="title"><b>Table 6.16. Error rates for gamma_q_inva</b></p> | |
484 | <div class="table-contents"><table class="table" summary="Error rates for gamma_q_inva"> | |
485 | <colgroup> | |
486 | <col> | |
487 | <col> | |
488 | <col> | |
489 | <col> | |
490 | <col> | |
491 | </colgroup> | |
492 | <thead><tr> | |
493 | <th> | |
494 | </th> | |
495 | <th> | |
496 | <p> | |
497 | Microsoft Visual C++ version 12.0<br> Win32<br> double | |
498 | </p> | |
499 | </th> | |
500 | <th> | |
501 | <p> | |
502 | GNU C++ version 5.1.0<br> linux<br> double | |
503 | </p> | |
504 | </th> | |
505 | <th> | |
506 | <p> | |
507 | GNU C++ version 5.1.0<br> linux<br> long double | |
508 | </p> | |
509 | </th> | |
510 | <th> | |
511 | <p> | |
512 | Sun compiler version 0x5130<br> Sun Solaris<br> long double | |
513 | </p> | |
514 | </th> | |
515 | </tr></thead> | |
516 | <tbody><tr> | |
517 | <td> | |
518 | <p> | |
519 | Incomplete gamma inverses. | |
520 | </p> | |
521 | </td> | |
522 | <td> | |
523 | <p> | |
524 | <span class="blue">Max = 5.64ε (Mean = 1.09ε)</span> | |
525 | </p> | |
526 | </td> | |
527 | <td> | |
528 | <p> | |
529 | <span class="blue">Max = 0ε (Mean = 0ε)</span> | |
530 | </p> | |
531 | </td> | |
532 | <td> | |
533 | <p> | |
534 | <span class="blue">Max = 6.91ε (Mean = 1.17ε)</span> | |
535 | </p> | |
536 | </td> | |
537 | <td> | |
538 | <p> | |
539 | <span class="blue">Max = 7.86ε (Mean = 1.25ε)</span> | |
540 | </p> | |
541 | </td> | |
542 | </tr></tbody> | |
543 | </table></div> | |
544 | </div> | |
545 | <br class="table-break"><h5> | |
546 | <a name="math_toolkit.sf_gamma.igamma_inv.h3"></a> | |
547 | <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> | |
548 | </h5> | |
549 | <p> | |
550 | There are two sets of tests: | |
551 | </p> | |
552 | <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> | |
553 | <li class="listitem"> | |
554 | Basic sanity checks attempt to "round-trip" from <span class="emphasis"><em>a</em></span> | |
555 | and <span class="emphasis"><em>x</em></span> to <span class="emphasis"><em>p</em></span> or <span class="emphasis"><em>q</em></span> | |
556 | and back again. These tests have quite generous tolerances: in general | |
557 | both the incomplete gamma, and its inverses, change so rapidly that round | |
558 | tripping to more than a couple of significant digits isn't possible. | |
559 | This is especially true when <span class="emphasis"><em>p</em></span> or <span class="emphasis"><em>q</em></span> | |
560 | is very near one: in this case there isn't enough "information content" | |
561 | in the input to the inverse function to get back where you started. | |
562 | </li> | |
563 | <li class="listitem"> | |
564 | Accuracy checks using high precision test values. These measure the accuracy | |
565 | of the result, given exact input values. | |
566 | </li> | |
567 | </ul></div> | |
568 | <h5> | |
569 | <a name="math_toolkit.sf_gamma.igamma_inv.h4"></a> | |
570 | <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> | |
571 | </h5> | |
572 | <p> | |
573 | The functions gamma_p_inv and <a href="http://functions.wolfram.com/GammaBetaErf/InverseGammaRegularized/" target="_top">gamma_q_inv</a> | |
574 | share a common implementation. | |
575 | </p> | |
576 | <p> | |
577 | First an initial approximation is computed using the methodology described | |
578 | in: | |
579 | </p> | |
580 | <p> | |
581 | <a href="http://portal.acm.org/citation.cfm?id=23109&coll=portal&dl=ACM" target="_top">A. | |
582 | R. Didonato and A. H. Morris, Computation of the Incomplete Gamma Function | |
583 | Ratios and their Inverse, ACM Trans. Math. Software 12 (1986), 377-393.</a> | |
584 | </p> | |
585 | <p> | |
586 | Finally, the last few bits are cleaned up using Halley iteration, the iteration | |
587 | limit is set to 2/3 of the number of bits in T, which by experiment is sufficient | |
588 | to ensure that the inverses are at least as accurate as the normal incomplete | |
589 | gamma functions. In testing, no more than 3 iterations are required to produce | |
590 | a result as accurate as the forward incomplete gamma function, and in many | |
591 | cases only one iteration is required. | |
592 | </p> | |
593 | <p> | |
594 | The functions gamma_p_inva and gamma_q_inva also share a common implementation | |
595 | but are handled separately from gamma_p_inv and gamma_q_inv. | |
596 | </p> | |
597 | <p> | |
598 | An initial approximation for <span class="emphasis"><em>a</em></span> is computed very crudely | |
599 | so that <span class="emphasis"><em>gamma_p(a, x) ~ 0.5</em></span>, this value is then used | |
600 | as a starting point for a generic derivative-free root finding algorithm. | |
601 | As a consequence, these two functions are rather more expensive to compute | |
602 | than the gamma_p_inv or gamma_q_inv functions. Even so, the root is usually | |
603 | found in fewer than 10 iterations. | |
604 | </p> | |
605 | </div> | |
606 | <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> | |
607 | <td align="left"></td> | |
608 | <td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal, | |
609 | Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert | |
610 | Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani, | |
611 | Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p> | |
612 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
613 | 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>) | |
614 | </p> | |
615 | </div></td> | |
616 | </tr></table> | |
617 | <hr> | |
618 | <div class="spirit-nav"> | |
619 | <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> | |
620 | </div> | |
621 | </body> | |
622 | </html> |