### A Note on a Method of Computing the Gamma FunctionA Note on a Method of Computing the Gamma Function

Access Restriction
Subscribed

 Author Gordon, N. L. ♦ Flasterstein, A. H. Source ACM Digital Library Content type Text Publisher Association for Computing Machinery (ACM) File Format PDF Copyright Year ©1960 Language English
 Subject Domain (in DDC) Computer science, information & general works ♦ Data processing & computer science Abstract Numerous formulas are available for the computation of the Gamma function [1, 2]. The purpose of this note is to indicate the value of a well-known method that is easily extended for higher accuracy requirements.Using the recursion formula for the Gamma function, $Γ(\textit{x}$ + 1) = $\textit{x}Γ(\textit{x}),$ (1) and Stirling's asymptotic expansion for ln $Γ(\textit{x})$ [3], we have ln $Γ(\textit{x})$ ∼ $(\textit{x}$ - 1/2) ln $\textit{x}$ - $\textit{x}$ + 1/2 ln 2π + $∑\textit{N}\textit{r}=1$ $\textit{Cr}/\textit{x}2\textit{r}-1.$ (2) It follows that, if $\textit{k}$ and $\textit{N}$ are appropriately selected positive integers, $Γ(\textit{x}$ + 1) can be represented by $Γ(\textit{x}$ + 1) ∼ √2π exp $(\textit{x}$ + $\textit{k}$ - 1/2) ln $(\textit{x}$ + $\textit{k})$ - $(\textit{x}$ + $\textit{k})$ exp $∑\textit{N}\textit{r}=1$ $\textit{Cr}/(\textit{x}$ + $\textit{k})2\textit{r}-1/(\textit{x}$ + $1)(\textit{x}$ + 2) ··· $(\textit{x}$ + $\textit{k}$ - 1) (3) where $\textit{Cr}$ = (- $1)\textit{r}-1$ $\textit{Br}/(2\textit{r}$ - $1)(2\textit{r}),$ $\textit{Br}$ being the Bernoulli numbers [4]. These coefficients have been published by Uhler [5].Requiring the range 0 ≦ $\textit{x}$ ≦ 1 is no restriction since, if necessary, $Γ(\textit{x}$ + 1) can be generated for other arguments using (1). For a given $\textit{N},$ the error in (2) can be estimated from |ε| < $|\textit{C}\textit{N}+1|/\textit{x}2\textit{N}+1.$ (4)The curves of Figure 1 show contours of constant error bound as a function of $\textit{N}$ and $\textit{x}.$ These curves represent single and double-precision floating-arithmetic requirements of ε < 5·10-9 and ε < 5·10-17. For a given $\textit{N},$ $\textit{k}$ is defined as the minimum integral $\textit{x}$ greater than or equal to those on the curves. Then $\textit{N}$ and $\textit{k}$ can be chosen to minimize round-off and computing time.For $\textit{N}$ and $\textit{k}$ equal to 4, formula (3) yields $Γ(\textit{x}$ + 1) ∼ &radic2&pgr;π exp $(\textit{x}$ + 4 - 1/2) ln $(\textit{x}$ + 4) - $(\textit{x}$ + 4) exp $∑4\textit{r}=1\textit{Cr}/(\textit{x}$ + $4)2\textit{r}-1/(\textit{x}$ + $1)(\textit{x}$ + $2)(\textit{x}$ + 3). (5)A similar expression suitable for double precision results for $\textit{N}$ = 8 and $\textit{k}$ = 9.The exponents in (5) are split to reduce roundoff. Various algebraic manipulations might result in a further reduction of roundoff. ISSN 00045411 Age Range 18 to 22 years ♦ above 22 year Educational Use Research Education Level UG and PG Learning Resource Type Article Publisher Date 1960-10-01 Publisher Place New York e-ISSN 1557735X Journal Journal of the ACM (JACM) Volume Number 7 Issue Number 4 Page Count 2 Starting Page 387 Ending Page 388

#### Open content in new tab

Source: ACM Digital Library