c$Header: /weru/cvs/weps/weps.src/util/math/binomial.for,v 1.1.1.1 1999-03-12 17:05:31 wagner Exp $ c real function bino i (n,k,p) c c + + + PURPOSE + + + c Addition to the bico function which returns binomial coefficient c as a floating point number. c c Modification based on: c 'NUMERICAL RECIPES - The Art of Scientific Computing', c W.H. Press, B.P. Flannery, S.A. Teukolsky, W.T. Vetterling c Cambridge University Press, 1986 c pg 158 c c + + + KEYWORDS + + + c binomial function c c + + + ARGUMENT DECLARATIONS + + + integer n,k real p c c c + + + ARGUMENT DEFINITIONS + + + c n,k - inputs for computing binomial coefficient c p - probability value c c + + + LOCAL VARIABLES + + + c real factln real bico c c + + + LOCAL VARIABLE DEFINITIONS + + + c c bico - computed binomial coefficient c c + + + END SPECIFICATIONS + + + c bico = anint(exp(factln(n) - factln(k) - factln(n-k))) bino = bico*(p**dble(k))*((1.0-p)**dble(n-k)) return end