4
1 Gamma Functions, Beta Functions, and Related
5 i
5
10
15
4
20
25
| (z)|
2
imag
0 i
30
real
0
35
-2
-4
-5 i
-6
Fig. 1.1 Absolute value of Γ (z) in the complex plane. At negative integer values Γ (z) becomes
infinite
Γ (z) can become very large for large z. Therefore, to avoid overflow the
computation will be based on the logarithm of the gamma function.
1.2.2 Computation of the Gamma Function
The computation of the gamma function is based on a Lanczos series:
Γ (z + 1) = (z + γ + 0.5)
z+0.5 exp[−(z + γ + 0.5)]
×
√
2π
c 0 +
c 1
z + 1
+
c 2
z + 2
· · ·
c n
z + n
.
(1.7)
A general discussion can be found in [5]. This series converges for (z) ≥ 0. To
compute Γ (z) in the left half complex plane Euler’s reflection formula, Eq. (1.4), is
used and to avoid overflows the logarithm ln(Γ (z)) is computed.
For the evaluation, the user can either choose the coefficients derived from
Godfrey [2], γ =
607
128 and
c = [0.99999999999999709182;
57.156235665862923517;
-59.597960355475491248;
14.136097974741747174;
-0.49191381609762019978;
.33994649984811888699e-4;
.46523628927048575665e-4;
-.98374475304879564677e-4;
1 Gamma Functions, Beta Functions, and Related
5 i
5
10
15
4
20
25
| (z)|
2
imag
0 i
30
real
0
35
-2
-4
-5 i
-6
Fig. 1.1 Absolute value of Γ (z) in the complex plane. At negative integer values Γ (z) becomes
infinite
Γ (z) can become very large for large z. Therefore, to avoid overflow the
computation will be based on the logarithm of the gamma function.
1.2.2 Computation of the Gamma Function
The computation of the gamma function is based on a Lanczos series:
Γ (z + 1) = (z + γ + 0.5)
z+0.5 exp[−(z + γ + 0.5)]
×
√
2π
c 0 +
c 1
z + 1
+
c 2
z + 2
· · ·
c n
z + n
.
(1.7)
A general discussion can be found in [5]. This series converges for (z) ≥ 0. To
compute Γ (z) in the left half complex plane Euler’s reflection formula, Eq. (1.4), is
used and to avoid overflows the logarithm ln(Γ (z)) is computed.
For the evaluation, the user can either choose the coefficients derived from
Godfrey [2], γ =
607
128 and
c = [0.99999999999999709182;
57.156235665862923517;
-59.597960355475491248;
14.136097974741747174;
-0.49191381609762019978;
.33994649984811888699e-4;
.46523628927048575665e-4;
-.98374475304879564677e-4;
