Python and Combinatorics
Alan Isaac
aisaac at american.edu
Thu Oct 25 17:14:11 EDT 2007
none wrote:
> Is there some package to calculate combinatorical stuff like (n over
> k), i.e., n!/(k!(n - k!) ?
Yes, in SciPy.
Alan Isaac
>>> from scipy.misc.common import comb
>>> help(comb)
Help on function comb in module scipy.misc.common:
comb(N, k, exact=0)
Combinations of N things taken k at a time.
If exact==0, then floating point precision is used, otherwise
exact long integer is computed.
Notes:
- Array arguments accepted only for exact=0 case.
- If k > N, N < 0, or k < 0, then a 0 is returned.
More information about the Python-list
mailing list