Expand description

Stirling numbers of the second kind and friends

For integers 0 ≤ k ≤ n, the Stirling number of the second kind S(n,k) is the number of k-element partitions of a set of size n. See wikipedia.

This crate consists of a few functions related to these Stirling numbers.


Compute the probability of selecting at most m distinct elements in x random draws with replacement from a set of size n.

Compute a table of “Stirling ratios”, Stirling numbers divided by the asympotic approximation k^n / k!, which is useful because the ratios are numerically better behaved than the Stirling numbers themselves.

Build a table of Stirling numbers of the second kind S(n,k), for n ≤ n_max.