Evaluates the incomplete gamma function.
function gammainc ( x : numeric, a : numeric ) return_val [dimsizes(x)] : float or double
An array of any dimensionality containing the upper limit of integration. x must be (0,1) inclusive, and can only be of type float or double.a
The shape parameter of the incomplete gamma. It must be the same dimensionality as x.
The value returned will be the same type and dimensionality as x.
gammainc calculates the cumulative incomplete gamma function. It is often used to determine probabilities. Specifically:
The integral from 0 to X of (1/GAM(A))*EXP(-T)*T**(A-1) DTwhere GAM(A) is the complete gamma function of A:
GAM(A) = integral from 0 to infinity of EXP(-T)*T**(A-1) DTThe code used (subroutine cumgam) is from DCDFLIB (Double precision Cumulative Distribution Function LIBrary). This returns the same answers as the Numerical Recipes [Cambridge Univ. Press, 1986] function gammp.
a = 10. x = 10. alpha = gammainc(x,a) print("gammainc(x,a)="+alpha)
Assume a calculation has been made where the degrees-of-freedom (df=20) and a chi-square value (chi2) has been determined. A significance level may be determined via:
prob = gammainc( 0.5*chi2, df*0.5 )
Assume two one-dimensional arrays (bin1, bin2) contain binned data. Further assume bin1 is based upon observations while bin2 is based upon theory: