22 Mar
2020
22 Mar
'20
6:39 p.m.
On Mon, Mar 23, 2020 at 5:13 AM Neil Girdhar <mistersheik@gmail.com> wrote:
I mean:
def binom(n, *ks): # Check that there is at least one ki, and that their sum is less than n, and that they are all nonnegative. # Returns n! / (prod(ki! for ki in ks) * (n-sum(ks))!)
This would still work for binom(n, k), but would also work for the mulinomial case.
Thanks for pulling this up again. I actually would have very much liked to have an efficient and accurate binom(n,k) function available - everything I could find was either floating-point (with the limitations thereof) or too inefficient to be used for ridiculously large values of n and/or k. +1 on moving forward with adding an imath module. ChrisA