On Monday, 28 March 2016 at 15:30:56 UTC, Timon Gehr wrote:
For each range, there should probably be a numeric function
computing the length of that range. (e.g. here, binomial
corresponds to combinations, there should be factorial
corresponding to permutations etc.)
I agree. I had been looking at the Discrete Math toolbox for
Matlab to compare functionality and factorial seemed worth adding
(as an aside, I saw an earlier thread about adding factorial to
std.math and people were like nobody uses factorial and I wanted
to punch my computer screen). Matlab's toolbox also has gcd, lcm,
and some prime number functions.
I'm not entirely sold on the name of the binomial function. I'm
concerned if it will be confusing if working with other
dlangscience projects. Looking at dstats there are a bunch of
functions with binomial in the name (rBinomial, binomialCDF,
etc.). SciPy/SAS uses comb. Matlab uses nchoosek. R uses combn.
I'm not a fan of combn.
Other potential overlapping functionality: logFactorial,
logNcomb, Perm, perm, Comb, comb.