
31 Mar
2007
31 Mar
'07
10:08 a.m.
On 3/31/07, Scott Brown
It's working now, thank you. I changed the definition to
binom n j = div (fac n) ((fac j)*(fac (n - j)))
bernoulli n p j = fromIntegral(binom n j)*(p ^ j) * ((1 - p)^(n - j))
As a matter of style suggestion, it might make 'binom' more clear if you use 'div' as an infix operator:
binom n j = (fac n) `div` ( fac j * fac (n - j) )