StirlingS2
Details

- Integer mathematical function, suitable for both symbolic and numerical manipulation.
- StirlingS2 is defined as the conversion matrix from Power of continuous calculus to FactorialPower of discrete calculus
, where
.
gives the number of ways of partitioning a set of
elements into
non‐empty subsets. »
- StirlingS2 automatically threads over lists.
Examples
open allclose allBasic Examples (1)Summary of the most common use cases
Scope (2)Survey of the scope of standard use cases
StirlingS2 threads element-wise over lists:

https://wolfram.com/xid/0enwhh94q-dbojbb

TraditionalForm formatting:

https://wolfram.com/xid/0enwhh94q-mhnf9j

Applications (5)Sample problems that can be solved with this function
Plot Stirling numbers of the second kind on a logarithmic scale:

https://wolfram.com/xid/0enwhh94q-ek487g


https://wolfram.com/xid/0enwhh94q-bdpzc4

Define a recursive function for generating set partitions:

https://wolfram.com/xid/0enwhh94q-c2q4x5
Generate all set partitions of n elements:

https://wolfram.com/xid/0enwhh94q-wpgfp

Count the number of set partitions that have 1, 2, … n disjoint subsets:

https://wolfram.com/xid/0enwhh94q-etp6ae

The Stirling number of the second kind counts the number of disjoint subsets:

https://wolfram.com/xid/0enwhh94q-b4ihm7

Closed form of derivatives of compositions with exponential functions:

https://wolfram.com/xid/0enwhh94q-yr0vd


https://wolfram.com/xid/0enwhh94q-bvo9r7

A fair ‐sided die is thrown
times independently. The probability that all faces appear at least once is given in terms of Stirling numbers of the second kind:

https://wolfram.com/xid/0enwhh94q-dxrj8e
Plot the probability for a six-sided die:

https://wolfram.com/xid/0enwhh94q-cs9dgd


https://wolfram.com/xid/0enwhh94q-bp7cd6


https://wolfram.com/xid/0enwhh94q-bz9jko

Properties & Relations (7)Properties of the function, and connections to other functions
Generate values from the ordinary generating function:

https://wolfram.com/xid/0enwhh94q-dh3q1x


https://wolfram.com/xid/0enwhh94q-cijcya

Generate values from the exponential generating function:

https://wolfram.com/xid/0enwhh94q-cfpkft


https://wolfram.com/xid/0enwhh94q-f1orby

Stirling numbers of the second kind are effectively inverses of Stirling numbers of the first kind:

https://wolfram.com/xid/0enwhh94q-e64ki

Calculate large Stirling numbers of the second kind using Cauchy's theorem:

https://wolfram.com/xid/0enwhh94q-eg5g42


https://wolfram.com/xid/0enwhh94q-vsy2a

Generate Stirling numbers of the second kind from the commutation relation :

https://wolfram.com/xid/0enwhh94q-dzi8v2

https://wolfram.com/xid/0enwhh94q-h2pz92


https://wolfram.com/xid/0enwhh94q-nsqujl

The limit of finite differences of powers are Stirling numbers of the second kind:

https://wolfram.com/xid/0enwhh94q-jwp6p


https://wolfram.com/xid/0enwhh94q-f3043w


https://wolfram.com/xid/0enwhh94q-bp68k0

Stirling numbers of the second kind are given by a partial Bell polynomial with unit arguments:

https://wolfram.com/xid/0enwhh94q-g6fyo3


https://wolfram.com/xid/0enwhh94q-or69ck

Possible Issues (2)Common pitfalls and unexpected behavior
StirlingS2 can take large values for moderate‐size arguments:

https://wolfram.com/xid/0enwhh94q-br74es


https://wolfram.com/xid/0enwhh94q-fo9d80

The value at is defined to be 1:

https://wolfram.com/xid/0enwhh94q-c7bx6o

Neat Examples (2)Surprising or curious use cases
Wolfram Research (1988), StirlingS2, Wolfram Language function, https://reference.wolfram.com/language/ref/StirlingS2.html.
Text
Wolfram Research (1988), StirlingS2, Wolfram Language function, https://reference.wolfram.com/language/ref/StirlingS2.html.
Wolfram Research (1988), StirlingS2, Wolfram Language function, https://reference.wolfram.com/language/ref/StirlingS2.html.
CMS
Wolfram Language. 1988. "StirlingS2." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/StirlingS2.html.
Wolfram Language. 1988. "StirlingS2." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/StirlingS2.html.
APA
Wolfram Language. (1988). StirlingS2. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StirlingS2.html
Wolfram Language. (1988). StirlingS2. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StirlingS2.html
BibTeX
@misc{reference.wolfram_2025_stirlings2, author="Wolfram Research", title="{StirlingS2}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/StirlingS2.html}", note=[Accessed: 16-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_stirlings2, organization={Wolfram Research}, title={StirlingS2}, year={1988}, url={https://reference.wolfram.com/language/ref/StirlingS2.html}, note=[Accessed: 16-April-2025
]}