# $$\text{P}$$¶

You can use the $$\text{P}$$ function to calculate the regularized or normalized lower incomplete gamma function.

You can use the \pgamma backslash command to insert this function.

The following variants of this function are available:

• $$\text{complex } \text{P} \left ( \text{<s>}, \text{<z>} \right )$$

The values $$\text{<s>}$$ and $$\text{<z>}$$ can be any basic type. The $$P$$ function is defined over the range $$\Re \left ( z \right ) \geq 0$$ and $$\Re \left ( s \right ) > 0$$. The $$\text{P}$$ function will generate a run-time error or report NaN for values outside of this range.

Note that run-time type conversion allows the result of this function to be assigned to any basic type provided the returned value is compatible with that type. Aion will also select one of several optimized versions depending on the supplied parameter values.

The $$\text{P}$$ function is defined as:

$\text{P} \left ( s, z \right ) = \frac{ \gamma \left ( s, z \right ) } { \Gamma \left ( s \right ) }$

The function calculates the regularlized lower gamma by one of three methods:

For part of the range, the function uses the power series expansion

$\text{P} \left ( s, z \right ) = z ^ s e ^ {-x} \sum_{k=0}^{\infty} \frac{z ^ k}{\Gamma \left ( s + k + 1 \right ) }$

noting that $$\Gamma \left ( s + 1 \right ) = s \Gamma \left ( s \right )$$. For values of $$s > 70$$ and $$z \ne 0$$, the function uses a modified version of the expression above using the natural log of the gamma function.

The $$\text{P}$$ function will also use the upper incomplete gamma function in cases where doing so can provide better accuracy with a reasonable number of terms.

The examples below show how you can use the $$\text{P}$$ function:

$e = \frac{1}{1 - \text{P} \left ( 1, 1 \right ) }$
$\text{ e = 2.7182818284590450908 }$