Gamma function

Gamma function.

boring_math.special_functions.gamma.gamma(z: complex) complex

Gamma function valid for all complex values of z.

Note

Lanczos approximation of Gamma using g = 7 with n = 9 terms. The values of g and n were chosen to balance accuracy with speed. Typically accurate to 13 correct decimal places.

Code modified from the Wikipedia Lanczos appoximation article.

Parameters:

z – Complex argument.

Returns:

Value of the analytic continuation of gamma(z). Uses inf + infj to represent a single complex infinity.

boring_math.special_functions.gamma.gamma_real(x: float) float

Gamma function valid for all real values of x.

Parameters:

x – Floating point argument.

Returns:

Value of gamma(x).