Geology Reference
In-Depth Information
is a classical problem solved by Wallis in 1655! If f n denotes the evaluation using
terms through to a n and b n ,then f n is given by the rational approximation
A n
B n ,
f n
=
(2.411)
with A n and B n given by
A 1
1,
B 1
0,
A 0
b 0 ,
B 0
1,
A j
=
b j A j 1
+
a j A j 2 ,
B j
=
b j B j 1
+
a j B j 2 , j
=
1,2,..., n . (2.412)
Applied to the continued fraction (2.407), with the common factor e y y
a removed,
we have b 0
=
0and
a 1
=
1, a 2
=
1
a , b 1
= y, b 2
=
1,
a 3
=
1, a 4
=
2
a , b 3
= y, b 4
=
1,
a 5
=
2, a 6
=
3
a , b 5
= y, b 6
=
1,
(2.413)
a 7
=
3, a 8
=
4
a , b 7
= y, b 8
=
1,
··· .
Thus, the even and odd coe
cients of the continued fraction show distinct recur-
rence patterns allowing their simple continuations. The subroutine CFGAMI imple-
ments calculation of the incomplete gamma function as the quantity CFGI for
arguments A and X, by the continued fraction expansion (2.407) using recurrence
relations (2.413) and (2.412). First the odd terms in recurrence (2.412) are com-
puted and the odd terms in recurrence (2.413) are updated, then the even terms
in recurrence (2.412) are computed and the even terms in recurrence (2.413) are
updated. This sequence of computations is continued until the next term is negli-
gible compared to the total to double precision accuracy.
SUBROUTINE CFGAMI(CFGI,A,X)
C
C Subroutine to calculate the incomplete gamma function
C by continued fraction expansion.
C
IMPLICIT DOUBLE PRECISION(A-H,O-Z)
C Find natural logarithm of gamma(x).
ALG=ALOGAM(A)
C Set maximum number of terms.
ITER=100
C Set initial value of continued fraction.
CFOLD=0.D0
C Set initial values of even and odd sequences a and b.
AE=0.D0
AO=1.D0
BE=1.D0
BO=0.D0
Search WWH ::




Custom Search