## Friday, 29 March 2013

### The normalised incomplete gamma function and its inverse.

The Scientific calculator has the two types of normalised incomplete gamma function (in addition to the single-parameter Gamma function $\Gamma(x)$ itself) - the lower and upper functions, denoted by $P(a,x)$ and $Q(a,x)$ respectively. These are accessible using the fourth segment, as shown below:-

The functions take in two arguments, so you need to enter a number (the $a$ parameter), then press the relevant function button, followed by another number ($x$), then press the equal button to obtain the result.

The (complete) Gamma function is:-
$\Gamma(a)=\int_0^\infty t^{a-1}e^{-t}dt$

The equation for the Lower Normalised Incomplete Gamma function is:-
$P(a,x)=\frac{1}{\Gamma(a)}\int_0^xt^{a-1}e^{-t}dt$

while that for the Upper Normalised Incomplete Gamma function is:-
$Q(a,x)=\frac{1}{\Gamma(a)}\int_x^{\infty}t^{a-1}e^{-t}dt$

Note that $P(a,x) + Q(a,x) = 1$.

The Lower Normalised Incomplete Gamma function is the CDF of the Gamma probability density function $\Gamma(\alpha,\beta)$, with $\beta$ set to 1, so we can use the landscape mode CDF/inverse-CDF calculator to find its inverse with respect to $x$.

Thus, to invert the lower function (i.e. to find $x$), enter the $\alpha$ parameter, put the input in the probability field, put 1 into the $\beta$ parameter, and set the lower limit to 0. The result will populate the Upper Limit, once the calculate button is pressed. For a worked example, finding $x$ such that $P(3,x) = 0.5$ (i.e. $\alpha = 3$), see screenshot below (the result is approx. 2.6741):-

As the underlying algorithm is quite numerically intensive for yielding high precision results, there will be a delay of a few seconds.

To invert the upper normalised function, simply subtract its value from 1 and enter the result into the probability field.

As a side note, you can use the Gamma function to evaluate the Beta function
($B(a,b)=\int_0^1t^{(a-1)}(1-t)^{(b-1)}dt$) as follows:-

$B(a,b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}$