Blame view

fvn_fnlib/albeta.f 847 Bytes
38581db0c   daniau   git-svn-id: https...
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
31
32
33
        function albeta (a, b)
  c july 1977 edition.   w. fullerton, c3, los alamos scientific lab.
        external alngam, alnrel, gamma, r9lgmc
        data sq2pil / 0.9189385332 0467274 e0 /
  c
        p = amin1 (a, b)
        q = amax1 (a, b)
  c
        if (p.le.0.0) call seteru (
       1  38halbeta  both arguments must be gt zero, 38, 1, 2)
        if (p.ge.10.0) go to 30
        if (q.ge.10.0) go to 20
  c
  c p and q are small.
  c
        albeta = alog(gamma(p) * (gamma(q)/gamma(p+q)) )
        return
  c
  c p is small, but q is big.
  c
   20   corr = r9lgmc(q) - r9lgmc(p+q)
        albeta = alngam(p) + corr + p - p*alog(p+q) +
       1  (q-0.5)*alnrel(-p/(p+q))
        return
  c
  c p and q are big.
  c
   30   corr = r9lgmc(p) + r9lgmc(q) - r9lgmc(p+q)
        albeta = -0.5*alog(q) + sq2pil + corr + (p-0.5)*alog(p/(p+q))
       1  + q*alnrel(-p/(p+q))
        return
  c
        end