regularizedGammaP

Computes the lower regularized incomplete gamma function P(a, x).

This gives the probability that a gamma-distributed random variable with shape parameter a is less than or equal to x. It is used internally to compute CDF values for chi-squared, gamma, and Poisson distributions, as well as the error function. Uses a series expansion when x is less than a + 1, and a continued fraction otherwise.

Example:

regularizedGammaP(1.0, 1.0) // 0.6321... (1 - e^(-1))
regularizedGammaP(1.0, 0.0) // 0.0

Return

the value of P(a, x), in the range 0, 1.

Parameters

a

the shape parameter. Must be positive.

x

the upper integration limit. Returns 0.0 for non-positive values.

Throws

if the iterative computation does not converge.