probability distribution function in python

Alex Martelli aleaxit at yahoo.com
Tue Apr 10 15:59:05 EDT 2001


"Tomasz Lisowski" <lisowski.tomasz at sssa.NOSPAM.com.pl> wrote in message
news:9auule$28g$1 at news.tpi.pl...
> It is numerically a bad idea to compute the factorial directly. Most often
> it is encountered in expressions, where two similarly huge numbers are
> divided, resulting in a quite normal (not so huge) number.

For the specific (and frequent) case of binomial coefficients, aka
combinations ((a+b)!/(a!b!)), GMP directly offers a shortcut that
can be rather speedy (and gmpy, my Python wrapper for GMP, of
course exposes it -- it may be the single gmpy function I call
most often, as I often compute cards-related probabilities:-).


Alex






More information about the Python-list mailing list