gamma_incomplete

Evaluates the incomplete gamma function γ(a, x).

Synopsis

#include <imsl.h>

float imsl_f_gamma_incomplete (float a, float x)

The type double function is imsl_d_gamma_incomplete.

Required Arguments

float a (Input)
Parameter of the incomplete gamma function is to be evaluated. It must be positive.

float x (Input)
Point at which the incomplete gamma function is to be evaluated. It must be nonnegative.

Return Value

The value of the incomplete gamma function γ(a, x).

Description

The incomplete gamma function, γ(a, x), is defined to be

 

The incomplete gamma function is defined only for a > 0. Although γ (a, x) is well defined for x > -∞, this algorithm does not calculate γ(a, x) for negative x. For large a and sufficiently large xγ(a, x) may overflow. γ(a, x) is bounded by Γ (a), and users may find this bound a useful guide in determining legal values for a.

 

Figure 1,  Plot of γ(a, x)

Example

Evaluate the incomplete gamma function at a = 1 and x = 3.

 

#include <stdio.h>

#include <imsl.h>

 

int main()

{ float x = 3.0;

 

float a = 1.0;

float ans;

 

ans = imsl_f_gamma_incomplete(a, x);

printf("incomplete gamma(%f,%f) = %f\n", a, x, ans);

}

Output

 

incomplete gamma(1.000000,3.000000) = 0.950213

Fatal Errors

IMSL_NO_CONV_200_TS_TERMS

The function did not converge in 200 terms of Taylor series.

IMSL_NO_CONV_200_CF_TERMS

The function did not converge in 200 terms of the continued fraction.