auxiliary {randtoolbox} | R Documentation |
Stirling numbers of the second kind and permutation of positive integers.
stirling(n) permut(n)
n |
a positive integer. |
stirling
computes stirling numbers of second kind i.e.
Stirl_n^k = k * Stirl_{n-1}^k + Stirl_{n-1}^{k-1}
with Stirl_n^1 = Stirl_n^n = 1. e.g.
Go to wikipedia for more details.
permut
compute permutation of {1, ..., n} and store it
in a matrix.
e.g.
1 |
1 | 2 |
2 | 1 |
3 | 1 | 2 |
3 | 2 | 1 |
1 | 3 | 2 |
2 | 3 | 1 |
1 | 2 | 3 |
2 | 1 | 3 |
a vector with stirling numbers.
Christophe Dutang.
choose
for combination numbers.
# should be 1 stirling(0) # should be 0,1,7,6,1 stirling(4)