Description Usage Arguments Details Value Author(s) References Examples
This function computes Stirling numbers of the second kind, S(n, k), which count the number of ways of partitioning n distinct objects in to k non-empty sets.
1 | Stirling2(n, k)
|
n |
A vector of one or more positive integers |
k |
A vector of one or more positive integers |
The implementation on this function is a simple recurrence relation which defines
S(n, k) = kS(n - 1, k), + S(n - 1, k - 1)
for k > 0
with the inital conditions S(0, 0) = 1 and S(n, 0) = S(0, n) =
0. If n
and n
have different lengths then expand.grid
is used to construct a vector of (n, k) pairs
An vector of Stirling numbers of the second kind
James Curran
https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind#Recurrence_relation
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.