1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
SUBROUTINE gcf(gammcf,a,x,gln)
implicit none
INTEGER ITMAX
REAL*8 a,gammcf,gln,x,EPS,FPMIN
PARAMETER (ITMAX=100,EPS=3.d-7,FPMIN=1.d-30)
CU USES gammln
INTEGER i
REAL*8 an,b,c,d,del,h,gammln
gln=gammln(a)
b=x+1-a
c=1/FPMIN
d=1/b
h=d
do 11 i=1,ITMAX
an=-i*(i-a)
b=b+2
d=an*d+b
if(abs(d).lt.FPMIN)d=FPMIN
c=b+an/c
if(abs(c).lt.FPMIN)c=FPMIN
d=1/d
del=d*c
h=h*del
if(abs(del-1).lt.EPS)goto 1
11 continue
pause 'a too large, ITMAX too small in gcf'
1 gammcf=exp(-x+a*log(x)-gln)*h
return
END
C (C) Copr. 1986-92 Numerical Recipes Software t4.
|