1
DOUBLE PRECISION FUNCTION brcomp(a,b,x,y)
2
C-----------------------------------------------------------------------
3
C EVALUATION OF X**A*Y**B/BETA(A,B)
4
C-----------------------------------------------------------------------
5
C .. Scalar Arguments ..
6
DOUBLE PRECISION a,b,x,y
9
DOUBLE PRECISION a0,apb,b0,c,const,e,h,lambda,lnx,lny,t,u,v,x0,y0,
13
C .. External Functions ..
14
DOUBLE PRECISION algdiv,alnrel,bcorr,betaln,gam1,gamln1,rlog1
15
EXTERNAL algdiv,alnrel,bcorr,betaln,gam1,gamln1,rlog1
17
C .. Intrinsic Functions ..
18
INTRINSIC abs,dble,dlog,dmax1,dmin1,exp,sqrt
20
C .. Data statements ..
22
C CONST = 1/SQRT(2*PI)
24
DATA const/.398942280401433D0/
26
C .. Executable Statements ..
29
IF (x.EQ.0.0D0 .OR. y.EQ.0.0D0) RETURN
31
IF (a0.GE.8.0D0) GO TO 130
33
IF (x.GT.0.375D0) GO TO 10
38
10 IF (y.GT.0.375D0) GO TO 20
47
IF (a0.LT.1.0D0) GO TO 40
51
C-----------------------------------------------------------------------
52
C PROCEDURE FOR A .LT. 1 OR B .LT. 1
53
C-----------------------------------------------------------------------
55
IF (b0.GE.8.0D0) GO TO 120
56
IF (b0.GT.1.0D0) GO TO 70
58
C ALGORITHM FOR B0 .LE. 1
61
IF (brcomp.EQ.0.0D0) RETURN
64
IF (apb.GT.1.0D0) GO TO 50
68
50 u = dble(a) + dble(b) - 1.D0
69
z = (1.0D0+gam1(u))/apb
71
60 c = (1.0D0+gam1(a))* (1.0D0+gam1(b))/z
72
brcomp = brcomp* (a0*c)/ (1.0D0+a0/b0)
75
C ALGORITHM FOR 1 .LT. B0 .LT. 8
90
IF (apb.GT.1.0D0) GO TO 100
94
100 u = dble(a0) + dble(b0) - 1.D0
95
t = (1.0D0+gam1(u))/apb
96
110 brcomp = a0*exp(z)* (1.0D0+gam1(b0))/t
99
C ALGORITHM FOR B0 .GE. 8
101
120 u = gamln1(a0) + algdiv(a0,b0)
104
C-----------------------------------------------------------------------
105
C PROCEDURE FOR A .GE. 8 AND B .GE. 8
106
C-----------------------------------------------------------------------
107
130 IF (a.GT.b) GO TO 140
110
y0 = 1.0D0/ (1.0D0+h)
115
x0 = 1.0D0/ (1.0D0+h)
120
IF (abs(e).GT.0.6D0) GO TO 160
124
160 u = e - dlog(x/x0)
127
IF (abs(e).GT.0.6D0) GO TO 180
131
180 v = e - dlog(y/y0)
133
190 z = exp(- (a*u+b*v))
134
brcomp = const*sqrt(b*x0)*z*exp(-bcorr(a,b))