Chapter 15: Utilities > gamma_incomplete

gamma_incomplete

Evaluates the incomplete gamma function γ(ax).

Synopsis

#include <imsls.h>

float imsls_f_gamma_incomplete (float a, float x)

The type double procedure is imsls_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 nonnega­tive.

Return Value

The value of the incomplete gamma function γ(ax).

Description

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

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

Figure 15- 3   Contour Plot of γ(a, x)

Example

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

#include <stdio.h>

#include <imsls.h>

 

int main()

{

    float       x = 3.0;

    float       a = 1.0;

    float       ans;

 

    ans = imsls_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

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

IMSLS_NO_CONV_200_CF_TERMS           The function did not converge in 200 terms of the con­tinued fraction.


RW_logo.jpg
Contact Support