The IGAMMA function computes the incomplete gamma function.

IGAMMA uses either a power series representation or a continued fractions method. If Z is less than or equal to A+1, a power series representation is used. If Z is greater than A+1, a continued fractions method is used.

This routine is written in the IDL language. Its source code can be found in the file in the lib subdirectory of the IDL distribution.

This routine can also be used with the GAMMA function to calculate the following other variations of the incomplete gamma function.

  • equation, which can be calculated with IGAMMA and GAMMA:
  igmaVariant1 = IGAMMA(A, Z)*GAMMA(A)
  • , which can be calculated with IGAMMA and GAMMA:
  igmaVariant2 = GAMMA(A)*(1 - IGAMMA(A, Z))
  • , which can be calculated with IGAMMA:
  igmaVariant3 = x^(-A)*IGAMMA(A, Z)

Example 1

Compute the incomplete gamma function for the corresponding elements of A and Z.

; Define an array of parametric exponents:
A = [0.10, 0.50, 1.00, 1.10, 6.00, 26.00]
; Define the upper limits of integration:
Z = [0.0316228, 0.0707107, 5.00000, 1.04881, 2.44949, 25.4951]
; Compute the incomplete gamma functions:
result = IGAMMA(A, Z)
PRINT, result

IDL prints:

[0.742026, 0.293128, 0.993262, 0.607646, 0.0387318, 0.486387]


Result = IGAMMA( A, Z [, /DOUBLE] [, EPS=value] [, ITER=variable] [, ITMAX=value] [, METHOD=variable] )

Return Value

If both arguments are scalar, the function returns a scalar. If both arguments are arrays, the function matches up the corresponding elements of A and Z, returning an array with the same dimensions as the smallest array. If one argument is a scalar and the other argument is an array, the function uses the scalar value with each element of the array, and returns an array with the same dimensions as the input array.

If any of the arguments are double-precision or if the DOUBLE keyword is set, the result is double-precision, otherwise the result is single-precision.



A scalar or array that specifies the parametric exponent of the integrand. A may be complex.


A scalar or array that specifies the upper limit of integration. Z may be complex. If Z is not complex then the values must be greater than or equal to zero.



Set this keyword to return a double-precision result.


Set this keyword to the desired relative accuracy, or tolerance. The default tolerance is 3.0e-7 for single precision, and 3.0d-12 for double precision.


Set this keyword to a named variable that will contain the actual number of iterations performed.


Set this keyword to specify the maximum number of iterations. The default value is 100,000.


This keyword is obsolete. METHOD will still be accepted, but will always return 0.

Thread Pool Keywords

This routine is written to make use of IDL’s thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the !CPU system variable control whether IDL uses the thread pool for a given computation. In addition, you can use the thread pool keywords TPOOL_MAX_ELTS, TPOOL_MIN_ELTS, and TPOOL_NOTHREAD to override the defaults established by !CPU for a single invocation of this routine. See Thread Pool Keywords for details.

Version History




A and Z arguments accept complex input

See Also