GAMI 3CW "09 March 2006" "mathcw-1.00"

Table of contents


NAME

gamif, gami, gamil, gamiw, gamiq, gamill, gamidf, gamid, gamidl, gamidll - ordinary incomplete gamma function

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <mathcw.h>

extern float gamif (float a, float x);

extern double gami (double a, double x);

extern long double gamil (long double a, long double x);

extern __float80 gamiw (__float80 a, __float80 x);

extern __float128 gamiq (__float128 a, __float128 x);

extern long_long_double gamill (long_long_double a, long_long_double x);

extern decimal_float gamidf (decimal_float a, decimal_float x);

extern decimal_double gamid (decimal_double a, decimal_double x);

extern decimal_long_double gamidl (decimal_long_double a, decimal_long_double x);

extern decimal_long_long_double gamidll (decimal_long_long_double a, decimal_long_long_double x);

NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.


DESCRIPTION

Compute an auxiliary function related to the ordinary incomplete gamma function of the arguments.

The ordinary and complementary incomplete gamma functions are defined by

gamma(a,x) = integral(t = 0 to x) t**(a-1) exp(-t) dt,
GAMMA(a,x) = integral(t = x to Infinity) t**(a-1) exp(-t) dt,
where x is in [0, +Infinity], a is in [-Infinity, +Infinity]. They are related to the generalization of the factorial function, the complete gamma function
GAMMA(a) = integral(t = 0 to Infinity) t**(a-1) exp(-t) dt,
like this:
gamma(a,x) + GAMMA(a,x) = GAMMA(a).

Mathematical notation conventionally uses a lowercase Greek letter for the ordinary incomplete function, and an uppercase Greek letter for both the complementary incomplete function, and the complete function. The number of arguments distinguishes between the two.

The C programming language family uses tgamma(a) (true gamma) for the complete function, and lgamma(a) for the logarithm of the absolute value of the complete function.

For arguments of large magnitude, and for a near zero, the gamma functions are subject to floating-point overflow and underflow, so it is conventional to work with scaled functions defined by

g(a,x) = gamma(a,x) / GAMMA(a),
G(a,x) = GAMMA(a,x) / GAMMA(a)    (a > 0)
G(a,x) = x**(-a) * exp(x) * GAMMA(a,x) / GAMMA(a)    (a <= 0)
For a > 0, but not for zero or negative a, these functions are positive and satisfy
g(a,x) + G(a,x) = 1,
so both lie in [0,1].

gami(a,x) computes g(a,x), gamic(a,x) computes G(a,x), and gamib(result,a,x) computes both the ordinary and complementary incomplete gamma functions, since the two are often needed together. Computationally, the single-result functions are just convenient wrappers around calls to gamib().


SPECIAL VALUES

The following limits of the scaled functions hold:
G(a, 0) = 1    g(a, 0) = 0    if a > 0,
G(a, 0) = Infinity    g(a, 0) = 1    if a = 0,
G(a, 0) = 1/a    g(a, 0) = Infinity    if a < 0,
The case where both arguments are zero is indeterminate, and the stated values are what the code produces. In addition, since the complete gamma function is infinite at negative integer arguments, the ordinary incomplete gamma function and the scaled function g(a, x), are as well. However, G(a, x) is well-defined when its first argument is a negative integer.

RETURN VALUES

If either argument is a NaN, return that NaN. If x is negative, return a quiet NaN. If x is Infinity, return 1. Otherwise, return the value of g(a,x).

ERRORS

If x is negative, set errno to EDOM. If either argument is a NaN, set errno to EDOM.

SEE ALSO

chisq(3CW), erf(3CW), erfc(3CW), exp(3CW), gamib(3CW), gamic(3CW), ichisq(3CW), lgamma(3CW), pow(3CW), tgamma(3CW).