2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 16:32:10 +00:00
Files
math/doc/html/math_toolkit/sf_gamma/igamma_inv.html
2024-08-06 13:18:32 +01:00

626 lines
38 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Incomplete Gamma Function Inverses</title>
<link rel="stylesheet" href="../../math.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Math Toolkit 4.2.1">
<link rel="up" href="../sf_gamma.html" title="Gamma Functions">
<link rel="prev" href="igamma.html" title="Incomplete Gamma Functions">
<link rel="next" href="gamma_derivatives.html" title="Derivative of the Incomplete Gamma Function">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<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>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="math_toolkit.sf_gamma.igamma_inv"></a><a class="link" href="igamma_inv.html" title="Incomplete Gamma Function Inverses">Incomplete Gamma Function
Inverses</a>
</h3></div></div></div>
<h5>
<a name="math_toolkit.sf_gamma.igamma_inv.h0"></a>
<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>
</h5>
<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>
</pre>
<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>
<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>
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
<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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
<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>
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
<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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
<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>
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
<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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
<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>
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
<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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
<span class="special">}}</span> <span class="comment">// namespaces</span>
</pre>
<h5>
<a name="math_toolkit.sf_gamma.igamma_inv.h1"></a>
<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>
</h5>
<p>
There are four <a href="http://mathworld.wolfram.com/IncompleteGammaFunction.html" target="_top">incomplete
gamma function</a> inverses which either compute <span class="emphasis"><em>x</em></span>
given <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>p</em></span> or <span class="emphasis"><em>q</em></span>,
or else compute <span class="emphasis"><em>a</em></span> given <span class="emphasis"><em>x</em></span> and either
<span class="emphasis"><em>p</em></span> or <span class="emphasis"><em>q</em></span>.
</p>
<p>
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
type calculation rules</em></span></a> when T1 and T2 are different types,
otherwise the return type is simply T1.
</p>
<p>
The final <a class="link" href="../../policy.html" title="Chapter 22. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
be used to control the behaviour of the function: how it handles errors,
what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter 22. Policies: Controlling Precision, Error Handling etc">policy
documentation for more details</a>.
</p>
<div class="tip"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../doc/src/images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top">
<p>
When people normally talk about the inverse of the incomplete gamma function,
they are talking about inverting on parameter <span class="emphasis"><em>x</em></span>. These
are implemented here as <code class="computeroutput"><span class="identifier">gamma_p_inv</span></code>
and <code class="computeroutput"><span class="identifier">gamma_q_inv</span></code>, and are
by far the most efficient of the inverses presented here.
</p>
<p>
The inverse on the <span class="emphasis"><em>a</em></span> parameter finds use in some statistical
applications but has to be computed by rather brute force numerical techniques
and is consequently several times slower. These are implemented here as
<code class="computeroutput"><span class="identifier">gamma_p_inva</span></code> and <code class="computeroutput"><span class="identifier">gamma_q_inva</span></code>.
</p>
</td></tr>
</table></div>
<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>
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
<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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
</pre>
<p>
Returns a value x such that: <code class="computeroutput"><span class="identifier">q</span>
<span class="special">=</span> <span class="identifier">gamma_q</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span>
<span class="identifier">x</span><span class="special">);</span></code>
</p>
<p>
Requires: <span class="emphasis"><em>a &gt; 0</em></span> and <span class="emphasis"><em>1 &gt;= p,q &gt;= 0</em></span>.
</p>
<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>
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
<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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
</pre>
<p>
Returns a value x such that: <code class="computeroutput"><span class="identifier">p</span>
<span class="special">=</span> <span class="identifier">gamma_p</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span>
<span class="identifier">x</span><span class="special">);</span></code>
</p>
<p>
Requires: <span class="emphasis"><em>a &gt; 0</em></span> and <span class="emphasis"><em>1 &gt;= p,q &gt;= 0</em></span>.
</p>
<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>
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
<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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
</pre>
<p>
Returns a value a such that: <code class="computeroutput"><span class="identifier">q</span>
<span class="special">=</span> <span class="identifier">gamma_q</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span>
<span class="identifier">x</span><span class="special">);</span></code>
</p>
<p>
Requires: <span class="emphasis"><em>x &gt; 0</em></span> and <span class="emphasis"><em>1 &gt;= p,q &gt;= 0</em></span>.
</p>
<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>
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
<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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
</pre>
<p>
Returns a value a such that: <code class="computeroutput"><span class="identifier">p</span>
<span class="special">=</span> <span class="identifier">gamma_p</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span>
<span class="identifier">x</span><span class="special">);</span></code>
</p>
<p>
Requires: <span class="emphasis"><em>x &gt; 0</em></span> and <span class="emphasis"><em>1 &gt;= p,q &gt;= 0</em></span>.
</p>
<h5>
<a name="math_toolkit.sf_gamma.igamma_inv.h2"></a>
<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>
</h5>
<p>
The accuracy of these functions doesn't vary much by platform or by the type
T. Given that these functions are computed by iterative methods, they are
deliberately "detuned" so as not to be too accurate: it is in any
case impossible for these function to be more accurate than the regular forward
incomplete gamma functions. In practice, the accuracy of these functions
is very similar to that of <a class="link" href="igamma.html" title="Incomplete Gamma Functions">gamma_p</a>
and <a class="link" href="igamma.html" title="Incomplete Gamma Functions">gamma_q</a> functions:
</p>
<div class="table">
<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>
<div class="table-contents"><table class="table" summary="Error rates for gamma_p_inv">
<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
</th>
<th>
<p>
GNU C++ version 7.1.0<br> linux<br> double
</p>
</th>
<th>
<p>
GNU C++ version 7.1.0<br> linux<br> long double
</p>
</th>
<th>
<p>
Sun compiler version 0x5150<br> Sun Solaris<br> long double
</p>
</th>
<th>
<p>
Microsoft Visual C++ version 14.1<br> Win32<br> double
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
incomplete gamma inverse(a, z) medium values
</p>
</td>
<td>
<p>
<span class="blue">Max = 0.993ε (Mean = 0.15ε)</span><br> <br>
(<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 4.88ε (Mean = 0.868ε))
</p>
</td>
<td>
<p>
<span class="blue">Max = 1.8ε (Mean = 0.406ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 1.89ε (Mean = 0.466ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 1.71ε (Mean = 0.34ε)</span>
</p>
</td>
</tr>
<tr>
<td>
<p>
incomplete gamma inverse(a, z) large values
</p>
</td>
<td>
<p>
<span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>Rmath
3.2.3:</em></span> Max = 0.816ε (Mean = 0.0874ε))
</p>
</td>
<td>
<p>
<span class="blue">Max = 0.509ε (Mean = 0.0447ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 0.509ε (Mean = 0.0447ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 0.924ε (Mean = 0.108ε)</span>
</p>
</td>
</tr>
<tr>
<td>
<p>
incomplete gamma inverse(a, z) small values
</p>
</td>
<td>
<p>
<span class="blue">Max = 441ε (Mean = 53.9ε)</span><br> <br>
(<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 547ε (Mean = 61.6ε))
</p>
</td>
<td>
<p>
<span class="blue">Max = 9.17e+03ε (Mean = 1.45e+03ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 1.09e+04ε (Mean = 1.3e+03ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 1.1e+03ε (Mean = 131ε)</span>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="table">
<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>
<div class="table-contents"><table class="table" summary="Error rates for gamma_q_inv">
<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
</th>
<th>
<p>
GNU C++ version 7.1.0<br> linux<br> double
</p>
</th>
<th>
<p>
GNU C++ version 7.1.0<br> linux<br> long double
</p>
</th>
<th>
<p>
Sun compiler version 0x5150<br> Sun Solaris<br> long double
</p>
</th>
<th>
<p>
Microsoft Visual C++ version 14.1<br> Win32<br> double
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
incomplete gamma inverse(a, z) medium values
</p>
</td>
<td>
<p>
<span class="blue">Max = 0.912ε (Mean = 0.154ε)</span><br> <br>
(<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 4.66ε (Mean = 0.792ε))
</p>
</td>
<td>
<p>
<span class="blue">Max = 6.2ε (Mean = 0.627ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 6.2ε (Mean = 0.683ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 2.88ε (Mean = 0.469ε)</span>
</p>
</td>
</tr>
<tr>
<td>
<p>
incomplete gamma inverse(a, z) large values
</p>
</td>
<td>
<p>
<span class="blue">Max = 0.894ε (Mean = 0.0915ε)</span><br>
<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 0.894ε (Mean = 0.106ε))
</p>
</td>
<td>
<p>
<span class="blue">Max = 0ε (Mean = 0ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 0ε (Mean = 0ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 0.814ε (Mean = 0.0856ε)</span>
</p>
</td>
</tr>
<tr>
<td>
<p>
incomplete gamma inverse(a, z) small values
</p>
</td>
<td>
<p>
<span class="blue">Max = 292ε (Mean = 36.4ε)</span><br> <br>
(<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 415ε (Mean = 48.7ε))
</p>
</td>
<td>
<p>
<span class="blue">Max = 8.28e+03ε (Mean = 1.09e+03ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 8.98e+03ε (Mean = 877ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 451ε (Mean = 64.7ε)</span>
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="table">
<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>
<div class="table-contents"><table class="table" summary="Error rates for gamma_p_inva">
<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
</th>
<th>
<p>
GNU C++ version 7.1.0<br> linux<br> double
</p>
</th>
<th>
<p>
GNU C++ version 7.1.0<br> linux<br> long double
</p>
</th>
<th>
<p>
Sun compiler version 0x5150<br> Sun Solaris<br> long double
</p>
</th>
<th>
<p>
Microsoft Visual C++ version 14.1<br> Win32<br> double
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
Incomplete gamma inverses.
</p>
</td>
<td>
<p>
<span class="blue">Max = 0ε (Mean = 0ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 7.87ε (Mean = 1.15ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 4.08ε (Mean = 1.12ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 4.92ε (Mean = 1.03ε)</span>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><div class="table">
<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>
<div class="table-contents"><table class="table" summary="Error rates for gamma_q_inva">
<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
</th>
<th>
<p>
GNU C++ version 7.1.0<br> linux<br> double
</p>
</th>
<th>
<p>
GNU C++ version 7.1.0<br> linux<br> long double
</p>
</th>
<th>
<p>
Sun compiler version 0x5150<br> Sun Solaris<br> long double
</p>
</th>
<th>
<p>
Microsoft Visual C++ version 14.1<br> Win32<br> double
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
Incomplete gamma inverses.
</p>
</td>
<td>
<p>
<span class="blue">Max = 0ε (Mean = 0ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 8.42ε (Mean = 1.3ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 7.86ε (Mean = 1.24ε)</span>
</p>
</td>
<td>
<p>
<span class="blue">Max = 5.05ε (Mean = 1.08ε)</span>
</p>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><h5>
<a name="math_toolkit.sf_gamma.igamma_inv.h3"></a>
<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>
</h5>
<p>
There are two sets of tests:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Basic sanity checks attempt to "round-trip" from <span class="emphasis"><em>a</em></span>
and <span class="emphasis"><em>x</em></span> to <span class="emphasis"><em>p</em></span> or <span class="emphasis"><em>q</em></span>
and back again. These tests have quite generous tolerances: in general
both the incomplete gamma, and its inverses, change so rapidly that round
tripping to more than a couple of significant digits isn't possible.
This is especially true when <span class="emphasis"><em>p</em></span> or <span class="emphasis"><em>q</em></span>
is very near one: in this case there isn't enough "information content"
in the input to the inverse function to get back where you started.
</li>
<li class="listitem">
Accuracy checks using high precision test values. These measure the accuracy
of the result, given exact input values.
</li>
</ul></div>
<h5>
<a name="math_toolkit.sf_gamma.igamma_inv.h4"></a>
<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>
</h5>
<p>
The functions <code class="computeroutput"><span class="identifier">gamma_p_inv</span></code>
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.
</p>
<p>
First an initial approximation is computed using the methodology described
in:
</p>
<p>
<a href="http://portal.acm.org/citation.cfm?id=23109&amp;coll=portal&amp;dl=ACM" target="_top">A.
R. Didonato and A. H. Morris, Computation of the Incomplete Gamma Function
Ratios and their Inverse, ACM Trans. Math. Software 12 (1986), 377-393.</a>
</p>
<p>
Finally, the last few bits are cleaned up using Halley iteration, the iteration
limit is set to 2/3 of the number of bits in T, which by experiment is sufficient
to ensure that the inverses are at least as accurate as the normal incomplete
gamma functions. In testing, no more than 3 iterations are required to produce
a result as accurate as the forward incomplete gamma function, and in many
cases only one iteration is required.
</p>
<p>
The functions <code class="computeroutput"><span class="identifier">gamma_p_inva</span></code>
and <code class="computeroutput"><span class="identifier">gamma_q_inva</span></code> also share
a common implementation but are handled separately from <code class="computeroutput"><span class="identifier">gamma_p_inv</span></code>
and <code class="computeroutput"><span class="identifier">gamma_q_inv</span></code>.
</p>
<p>
An initial approximation for <span class="emphasis"><em>a</em></span> is computed very crudely
so that <span class="emphasis"><em>gamma_p(a, x) ~ 0.5</em></span>, this value is then used
as a starting point for a generic derivative-free root finding algorithm.
As a consequence, these two functions are rather more expensive to compute
than the <code class="computeroutput"><span class="identifier">gamma_p_inv</span></code> or
<code class="computeroutput"><span class="identifier">gamma_q_inv</span></code> functions. Even
so, the root is usually found in fewer than 10 iterations.
</p>
</div>
<div class="copyright-footer">Copyright © 2006-2021 Nikhar Agrawal, Anton Bikineev, Matthew Borland,
Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert Holin, Bruno
Lalande, John Maddock, Evan Miller, Jeremy Murphy, Matthew Pulver, Johan Råde,
Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, Daryle
Walker and Xiaogang Zhang<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>
</div>
<hr>
<div class="spirit-nav">
<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>
</div>
</body>
</html>