igamc

sherpa.utils.igamc(a, x)[source] [edit on github]

Calculate the complement of the regularized incomplete Gamma function (upper).

The function is defined using the regularized incomplete Gamma function - igam(a,x) - and the Gamma function - gamma(a) - as:

igamc(a,x) = 1 - igam(a,x)
           = 1 / gamma(a) Int_x^Inf e^(-t) t^(a-1) dt
Parameters:
  • a (scalar or array) – a > 0
  • x (scalar or array) – x > 0
Returns:

val – The incomplete Gamma function of the input.

Return type:

scalar or array

See also

gamma(), igam()

Notes

In this implementation, which is provided by the Cephes Math Library [1], both arguments must be positive. The integral is evaluated by either a power series or continued fraction expansion, depending on the relative values of a and x. Using IEEE arithmetic, the relative errors are

domain domain # trials peak rms
0.5,100 0,100 200000 1.9e-14 1.7e-15
0.01,0.5 0,100 200000 1.4e-13 1.6e-15

References

[1]Cephes Math Library Release 2.0: April, 1987. Copyright 1985, 1987 by Stephen L. Moshier. Direct inquiries to 30 Frost Street, Cambridge, MA 02140.

Examples

>>> igamc(1, 2)
0.1353352832366127
>>> igamc([1,1], [2,3])
array([ 0.13533528,  0.04978707])