# gammainc: Incomplete Gamma Function In pracma: Practical Numerical Math Functions

## Description

Lower and upper incomplete gamma function.

## Usage

 1 2 3 gammainc(x, a) incgam(x, a)

## Arguments

 x positive real number. a real number.

## Details

gammainc computes the lower and upper incomplete gamma function, including the regularized gamma function. The lower and upper incomplete gamma functions are defined as

γ(x, a) = \int_0^x e^{-t} \, t^{a-1} \, dt

and

Γ(x, a) = \int_x^{∞} e^{-t} \, t^{a-1} \, dt

while the regularized incomplete gamma function is γ(x, a)/Γ(a).

incgam (a name used in Pari/GP) computes the upper incomplete gamma function alone, applying the R function pgamma. The accuracy is thus much higher. It works for a >= -1, for even smaller values a recursion will give the result.

## Value

gammainc returns a list with the values of the lower, the upper, and regularized lower incomplete gamma function. incgam only returns the value of the incomplete upper gamma function.

## Note

Directly converting Fortran code is often easier than translating Matlab code generated with f2matlab.

## References

Zhang, Sh., and J. Jin (1996). Computation of Special Functions. Wiley-Interscience, New York.

## Examples

 1 2 3 4 5 gammainc( 1.5, 2) gammainc(-1.5, 2) incgam(3, 1.2) incgam(3, 0.5); incgam(3, -0.5)

### Example output

lowinc    uppinc    reginc
0.4421746 0.5578254 0.4421746
lowinc    uppinc    reginc
3.240845 -2.240845  3.240845
[1] 0.06542143
[1] 0.02535651
[1] 0.006776136

pracma documentation built on Dec. 11, 2018, 3 a.m.