Geology Reference
In-Depth Information
with coe
cients,
c 0
=
1.000000000178,
c 1
=
76.180091729406, c 2
=−
86.505320327112,
c 3
=
24.014098222230, c 4
=−
1.231739516140, c 5
=
0.001208580030,
=−
c 6
0.000005363820.
(2.409)
10 10 .
The function subprogramme ALOGAM(X) finds the natural logarithm of the
gamma function of x .
| | < 2
×
The relative error term has an absolute value
DOUBLE PRECISION FUNCTION ALOGAM(X)
C
C A function subprogramme to calculate the natural logarithm of
C the gamma function using the seven-term Lanczos formula.
C
IMPLICIT DOUBLE PRECISION(A-H,O-Z)
DIMENSION COEF(7)
C Set values of coefficients.
COEF(1)=1.000000000178D0
COEF(2)=76.180091729406D0
COEF(3)=-86.505320327112D0
COEF(4)=24.014098222230D0
COEF(5)=-1.231739516140D0
COEF(6)=0.001208580030D0
COEF(7)=-0.000005363820D0
C Set value of square root of 2pi.
RT2PI=2.506628274631D0
C Change argument to that of factorial.
Z=X-1.D0
C Set initial term of seven term series.
SERIES=COEF(1)
C Sum remaining six terms.
DO 10 I=1,6
IP1=I+1
AI=DFLOAT(I)
DENOM=Z+AI
SERIES=SERIES+COEF(IP1)/DENOM
10 CONTINUE
C Multiply sum of series by square root of 2pi.
SERIES=SERIES*RT2PI
C Set value of gamma for seven term series.
GAM=5.D0
C Set value of Z+1/2.
ZPH=Z+0.5D0
C Set value of Z+1/2+GAM
ZPHG=ZPH+GAM
C Find natural logarithm of coefficient of series sum.
HOLD=ZPH*DLOG(ZPHG)-ZPHG
C Find natural logarithm of Gamma(x).
ALOGAM=HOLD+DLOG(SERIES)
RETURN
END
a , the incomplete gamma
function is found from (2.404) using the series expansion (2.406). The subroutine
SEGAMI returns the incomplete gamma function P ( a , x ) as the argument SEGI, for
As Press et al. (1992, p. 211) suggest, foryless than 1
+
Search WWH ::




Custom Search