| nStirling2 {kStatistics} | R Documentation |
Stirling number of second kind
Description
The function computes the Stirling number of the second kind.
Usage
nStirling2( n, k )
Arguments
n |
integer |
k |
integer less or equal to |
Details
The Stirling number of the second kind S(n,k) is equal to the number of ways to split a
set of cardinality n into k nonempty subsets. For example, if the set is [a,b,c,d], then
the partitions in 2 blocks are: [[a], [bcd]], [[b], [acd]], [[c], [abd]], [[d],[abc]] with
cardinalities (1,3) and [ab, cd], [ac, bd], [ad, bc] with cardinalities (2,2). Then S(4,2)
is equal to 7. Note that (1,3) and (2,2) are also the partitions of the integer 4 in 2 parts.
Value
integer |
the Stirling number of the second kind |
Note
Called by the nKS and nKM functions in the kStatistics package.
Author(s)
Elvira Di Nardo elvira.dinardo@unito.it,
Giuseppe Guarino giuseppe.guarino@rete.basilicata.it
References
R. P. Stanley (2012) Enumerative combinatorics. Vol.1. II edition. Cambridge Studies in Advanced Mathematics, 49. Cambridge University Press, Cambridge.
See Also
mkmSet,
mCoeff,
intPart,
countP,
ff
Examples
# Return the number of ways to split a set of 6 objects into 2 nonempty subsets
nStirling2(6,2)