Hypergeometric distribution
Alex Martelli
aleax at mail.comcast.net
Tue Dec 27 05:17:39 CET 2005
Raven <balckraven at gmail.com> wrote:
> Hi to all, I need to calculate the hpergeometric distribution:
>
>
> choose(r, x) * choose(b, n-x)
> p(x; r,b,n) = -----------------------------
> choose(r+b, n)
>
> choose(r,x) is the binomial coefficient
> I use the factorial to calculate the above formula but since I am using
> large numbers, the result of choose(a,b) (ie: the binomial coefficient)
> is too big even for large int. I've tried the scipy library, but this
> library calculates
> the hypergeometric using the factorials too, so the problem subsist. Is
> there any other libray or an algorithm to calculate
> the hypergeometric distribution? The statistical package R can handle
> such calculations but I don't want to use python R binding since I want
> a standalone app.
Have you tried with gmpy?
Alex
More information about the Python-list
mailing list