aboutsummaryrefslogtreecommitdiff
path: root/math/bevington/pbinom.f
blob: 325f6f70f4bbb98f3af03f286ac67ed58b747e60 (plain) (blame)
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
c function pbinom.f
c
c source
c   Bevington, page 31.
c
c purpose
c   evaluate binomial probability coefficient
c
c usage
c   result = pbinom (nobs, ntotal, prob)
c
c description of parameters
c   nobs   - number of items observed
c   ntotal - total number of items
c   prob   - probability of observing each item
c
c subroutines and function subprograms required
c   factor (n)
c      calculates n factorial for integers
c
      function pbinom (nobs,ntotal,prob)
1     notobs=ntotal-nobs
2     pbinom=factor(ntotal)/(factor(nobs)*factor(notobs))*
     *       (prob**nobs)*(1.-prob)**notobs
      return
      end