]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/doc/html/math_toolkit/sf_gamma/gamma_ratios.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / doc / html / math_toolkit / sf_gamma / gamma_ratios.html
CommitLineData
7c673cae
FG
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4<title>Ratios of Gamma Functions</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="polygamma.html" title="Polygamma">
10<link rel="next" href="igamma.html" title="Incomplete Gamma Functions">
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="polygamma.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="igamma.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.gamma_ratios"></a><a class="link" href="gamma_ratios.html" title="Ratios of Gamma Functions">Ratios of Gamma Functions</a>
28</h3></div></div></div>
29<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">gamma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
30</pre>
31<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>
32
33<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">&gt;</span>
34<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">tgamma_ratio</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>
35
36<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> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
37<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">tgamma_ratio</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="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
38
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">&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">tgamma_delta_ratio</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">delta</span><span class="special">);</span>
41
42<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">Policy</span><span class="special">&gt;</span>
43<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">tgamma_delta_ratio</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">delta</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
44
45<span class="special">}}</span> <span class="comment">// namespaces</span>
46</pre>
47<h5>
48<a name="math_toolkit.sf_gamma.gamma_ratios.h0"></a>
49 <span class="phrase"><a name="math_toolkit.sf_gamma.gamma_ratios.description"></a></span><a class="link" href="gamma_ratios.html#math_toolkit.sf_gamma.gamma_ratios.description">Description</a>
50 </h5>
51<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">&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">tgamma_ratio</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>
53
54<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> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
55<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">tgamma_ratio</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="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
56</pre>
57<p>
58 Returns the ratio of gamma functions:
59 </p>
60<p>
61 <span class="inlinemediaobject"><img src="../../../equations/gamma_ratio0.svg"></span>
62 </p>
63<p>
64 The final <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
65 be used to control the behaviour of the function: how it handles errors,
66 what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">policy
67 documentation for more details</a>.
68 </p>
69<p>
70 Internally this just calls <code class="computeroutput"><span class="identifier">tgamma_delta_ratio</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span>
71 <span class="identifier">b</span><span class="special">-</span><span class="identifier">a</span><span class="special">)</span></code>.
72 </p>
73<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">&gt;</span>
74<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">tgamma_delta_ratio</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">delta</span><span class="special">);</span>
75
76<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> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
77<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">tgamma_delta_ratio</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">delta</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
78</pre>
79<p>
80 Returns the ratio of gamma functions:
81 </p>
82<p>
83 <span class="inlinemediaobject"><img src="../../../equations/gamma_ratio1.svg"></span>
84 </p>
85<p>
86 The final <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
87 be used to control the behaviour of the function: how it handles errors,
88 what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">policy
89 documentation for more details</a>.
90 </p>
91<p>
92 Note that the result is calculated accurately even when <span class="emphasis"><em>delta</em></span>
93 is small compared to <span class="emphasis"><em>a</em></span>: indeed even if <span class="emphasis"><em>a+delta
94 ~ a</em></span>. The function is typically used when <span class="emphasis"><em>a</em></span>
95 is large and <span class="emphasis"><em>delta</em></span> is very small.
96 </p>
97<p>
98 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
99 type calculation rules</em></span></a> when T1 and T2 are different types,
100 otherwise the result type is simple T1.
101 </p>
102<p>
103 <span class="inlinemediaobject"><img src="../../../graphs/tgamma_delta_ratio.svg" align="middle"></span>
104 </p>
105<h5>
106<a name="math_toolkit.sf_gamma.gamma_ratios.h1"></a>
107 <span class="phrase"><a name="math_toolkit.sf_gamma.gamma_ratios.accuracy"></a></span><a class="link" href="gamma_ratios.html#math_toolkit.sf_gamma.gamma_ratios.accuracy">Accuracy</a>
108 </h5>
109<p>
110 The following table shows the peak errors (in units of epsilon) found on
111 various platforms with various floating point types. Unless otherwise specified
112 any floating point type that is narrower than the one shown will have <a class="link" href="../relative_error.html#math_toolkit.relative_error.zero_error">effectively zero error</a>.
113 </p>
114<div class="table">
115<a name="math_toolkit.sf_gamma.gamma_ratios.table_tgamma_delta_ratio"></a><p class="title"><b>Table&#160;6.7.&#160;Error rates for tgamma_delta_ratio</b></p>
116<div class="table-contents"><table class="table" summary="Error rates for tgamma_delta_ratio">
117<colgroup>
118<col>
119<col>
120<col>
121<col>
122<col>
123</colgroup>
124<thead><tr>
125<th>
126 </th>
127<th>
128 <p>
129 Microsoft Visual C++ version 12.0<br> Win32<br> double
130 </p>
131 </th>
132<th>
133 <p>
134 GNU C++ version 5.1.0<br> linux<br> double
135 </p>
136 </th>
137<th>
138 <p>
139 GNU C++ version 5.1.0<br> linux<br> long double
140 </p>
141 </th>
142<th>
143 <p>
144 Sun compiler version 0x5130<br> Sun Solaris<br> long double
145 </p>
146 </th>
147</tr></thead>
148<tbody>
149<tr>
150<td>
151 <p>
152 tgamma + small delta ratios
153 </p>
154 </td>
155<td>
156 <p>
157 <span class="blue">Max = 10.1&#949; (Mean = 1.25&#949;)</span>
158 </p>
159 </td>
160<td>
161 <p>
162 <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span>
163 </p>
164 </td>
165<td>
166 <p>
167 <span class="blue">Max = 5.56&#949; (Mean = 0.969&#949;)</span>
168 </p>
169 </td>
170<td>
171 <p>
172 <span class="blue">Max = 15.4&#949; (Mean = 2.09&#949;)</span>
173 </p>
174 </td>
175</tr>
176<tr>
177<td>
178 <p>
179 tgamma + small delta ratios (negative delta)
180 </p>
181 </td>
182<td>
183 <p>
184 <span class="blue">Max = 8.04&#949; (Mean = 1.31&#949;)</span>
185 </p>
186 </td>
187<td>
188 <p>
189 <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span>
190 </p>
191 </td>
192<td>
193 <p>
194 <span class="blue">Max = 8.67&#949; (Mean = 1.29&#949;)</span>
195 </p>
196 </td>
197<td>
198 <p>
199 <span class="blue">Max = 18.3&#949; (Mean = 2.03&#949;)</span>
200 </p>
201 </td>
202</tr>
203<tr>
204<td>
205 <p>
206 tgamma + small integer ratios
207 </p>
208 </td>
209<td>
210 <p>
211 <span class="blue">Max = 2.74&#949; (Mean = 0.736&#949;)</span>
212 </p>
213 </td>
214<td>
215 <p>
216 <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span>
217 </p>
218 </td>
219<td>
220 <p>
221 <span class="blue">Max = 1.96&#949; (Mean = 0.677&#949;)</span>
222 </p>
223 </td>
224<td>
225 <p>
226 <span class="blue">Max = 1.96&#949; (Mean = 0.677&#949;)</span>
227 </p>
228 </td>
229</tr>
230<tr>
231<td>
232 <p>
233 tgamma + small integer ratios (negative delta)
234 </p>
235 </td>
236<td>
237 <p>
238 <span class="blue">Max = 2.15&#949; (Mean = 0.685&#949;)</span>
239 </p>
240 </td>
241<td>
242 <p>
243 <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span>
244 </p>
245 </td>
246<td>
247 <p>
248 <span class="blue">Max = 1.62&#949; (Mean = 0.451&#949;)</span>
249 </p>
250 </td>
251<td>
252 <p>
253 <span class="blue">Max = 1.62&#949; (Mean = 0.451&#949;)</span>
254 </p>
255 </td>
256</tr>
257<tr>
258<td>
259 <p>
260 integer tgamma ratios
261 </p>
262 </td>
263<td>
264 <p>
265 <span class="blue">Max = 0.968&#949; (Mean = 0.386&#949;)</span>
266 </p>
267 </td>
268<td>
269 <p>
270 <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span>
271 </p>
272 </td>
273<td>
274 <p>
275 <span class="blue">Max = 0.997&#949; (Mean = 0.4&#949;)</span>
276 </p>
277 </td>
278<td>
279 <p>
280 <span class="blue">Max = 0.997&#949; (Mean = 0.4&#949;)</span>
281 </p>
282 </td>
283</tr>
284<tr>
285<td>
286 <p>
287 integer tgamma ratios (negative delta)
288 </p>
289 </td>
290<td>
291 <p>
292 <span class="blue">Max = 0.974&#949; (Mean = 0.184&#949;)</span>
293 </p>
294 </td>
295<td>
296 <p>
297 <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span>
298 </p>
299 </td>
300<td>
301 <p>
302 <span class="blue">Max = 0.853&#949; (Mean = 0.176&#949;)</span>
303 </p>
304 </td>
305<td>
306 <p>
307 <span class="blue">Max = 0.853&#949; (Mean = 0.176&#949;)</span>
308 </p>
309 </td>
310</tr>
311</tbody>
312</table></div>
313</div>
314<br class="table-break"><div class="table">
315<a name="math_toolkit.sf_gamma.gamma_ratios.table_tgamma_ratio"></a><p class="title"><b>Table&#160;6.8.&#160;Error rates for tgamma_ratio</b></p>
316<div class="table-contents"><table class="table" summary="Error rates for tgamma_ratio">
317<colgroup>
318<col>
319<col>
320<col>
321<col>
322<col>
323</colgroup>
324<thead><tr>
325<th>
326 </th>
327<th>
328 <p>
329 Microsoft Visual C++ version 12.0<br> Win32<br> double
330 </p>
331 </th>
332<th>
333 <p>
334 GNU C++ version 5.1.0<br> linux<br> double
335 </p>
336 </th>
337<th>
338 <p>
339 GNU C++ version 5.1.0<br> linux<br> long double
340 </p>
341 </th>
342<th>
343 <p>
344 Sun compiler version 0x5130<br> Sun Solaris<br> long double
345 </p>
346 </th>
347</tr></thead>
348<tbody><tr>
349<td>
350 <p>
351 tgamma ratios
352 </p>
353 </td>
354<td>
355 <p>
356 <span class="blue">Max = 3.66&#949; (Mean = 1.27&#949;)</span>
357 </p>
358 </td>
359<td>
360 <p>
361 <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span>
362 </p>
363 </td>
364<td>
365 <p>
366 <span class="blue">Max = 3.09&#949; (Mean = 1.15&#949;)</span>
367 </p>
368 </td>
369<td>
370 <p>
371 <span class="blue">Max = 174&#949; (Mean = 61.2&#949;)</span>
372 </p>
373 </td>
374</tr></tbody>
375</table></div>
376</div>
377<br class="table-break"><h5>
378<a name="math_toolkit.sf_gamma.gamma_ratios.h2"></a>
379 <span class="phrase"><a name="math_toolkit.sf_gamma.gamma_ratios.testing"></a></span><a class="link" href="gamma_ratios.html#math_toolkit.sf_gamma.gamma_ratios.testing">Testing</a>
380 </h5>
381<p>
382 Accuracy tests use data generated at very high precision (with <a href="http://shoup.net/ntl/doc/RR.txt" target="_top">NTL
383 RR class</a> set at 1000-bit precision: about 300 decimal digits) and
384 a deliberately naive calculation of &#915;(x)/&#915;(y).
385 </p>
386<h5>
387<a name="math_toolkit.sf_gamma.gamma_ratios.h3"></a>
388 <span class="phrase"><a name="math_toolkit.sf_gamma.gamma_ratios.implementation"></a></span><a class="link" href="gamma_ratios.html#math_toolkit.sf_gamma.gamma_ratios.implementation">Implementation</a>
389 </h5>
390<p>
391 The implementation of these functions is very similar to that of <a class="link" href="../sf_beta/beta_function.html" title="Beta">beta</a>,
392 and is based on combining similar power terms to improve accuracy and avoid
393 spurious overflow/underflow.
394 </p>
395<p>
396 In addition there are optimisations for the situation where <span class="emphasis"><em>delta</em></span>
397 is a small integer: in which case this function is basically the reciprocal
398 of a rising factorial, or where both arguments are smallish integers: in
399 which case table lookup of factorials can be used to calculate the ratio.
400 </p>
401</div>
402<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
403<td align="left"></td>
404<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
405 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
406 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
407 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
408 Distributed under the Boost Software License, Version 1.0. (See accompanying
409 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>)
410 </p>
411</div></td>
412</tr></table>
413<hr>
414<div class="spirit-nav">
415<a accesskey="p" href="polygamma.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="igamma.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
416</div>
417</body>
418</html>