gammacplx

Purpose

Computes the Gamma function for complex inputs.

Format

g_cplx = gammacplx(x_cplx)
Parameters:

x_cplx (NxK matrix;) – the values used to compute the Gamma function. May include complex elements.

Returns:

g_cplx (NxK matrix) – the values of the Gamma function evaluated at x. May be complex.

Examples

// Real component
xr = { 2.5 ,
       9.1 };

// Imaginary component
xi = { 3 ,
       1 };

// Create complex matrix
x_cplx = complex(xr, xi);

// Compute gamma function
gammacplx(x_cplx);

The results after the code:

-0.21811897 +      0.072034763i
-25993.298 +        39350.237i

Remarks

Accuracy is 15 significant digits along the real axis and 13 significant digits elsewhere. This routine uses the Lanczos series approximation for the complex Gamma function.

References

    1. Lanczos, SIAM JNA 1, 1964, pp. 86-96.

    1. Luke, ‘’The Special … approximations,’’ 1969, pp. 29-31.

    1. Luke, ‘’Algorithms … functions,’’ 1977.

    1. Spouge, SIAM JNA 31, 1994, pp. 931-944.

    1. Press, ‘’Numerical Recipes.’’

    1. Chang, ‘’Computation of special functions,’’ 1996.

  1. W. J. Cody ‘’An Overview of Software Development for Special Functions,’’ 1975.

  2. P. Godfrey ‘’A note on the computation of the convergent Lanczos complex Gamma approximation.’’

  3. Original code by Paul Godfrey