Stirling Numbers #
This file defines Stirling numbers of the first and second kinds, proves their fundamental recurrence relations, and establishes some of their key properties and identities.
The Stirling numbers of the first kind #
The unsigned Stirling numbers of the first kind, represent the number of ways
to partition n distinct elements into k non-empty cycles.
The Stirling numbers of the second kind #
The Stirling numbers of the second kind, represent the number of ways to partition
n distinct elements into k non-empty subsets.
Main definitions #
Nat.stirlingFirst: the number of ways to partitionndistinct elements intoknon-empty cycles, defined by the recursive relationship it satisfies.Nat.stirlingSecond: the number of ways to partitionndistinct elements intoknon-empty subsets, defined by the recursive relationship it satisfies.
Main results #
Nat.pow_eq_sum_stirlingSecond_mul_descFactorial: every powern ^ kis a linear combination of the descending factorialsNat.descFactorialwith the Stirling numbers of the second kind as coefficients.
References #
- [Knuth, The Art of Computer Programming, Volume 1, §1.2.6][knuth1997]
Nat.stirlingFirst n k is the (unsigned) Stirling number of the first kind,
counting the number of permutations of n elements with exactly k disjoint cycles.
Equations
- Nat.stirlingFirst 0 0 = 1
- Nat.stirlingFirst 0 n.succ = 0
- n.succ.stirlingFirst 0 = 0
- n.succ.stirlingFirst k.succ = n * n.stirlingFirst (k + 1) + n.stirlingFirst k
Instances For
Nat.stirlingSecond n k is the Stirling number of the second kind,
counting the number of ways to partition a set of n elements into k nonempty subsets.
Equations
- Nat.stirlingSecond 0 0 = 1
- Nat.stirlingSecond 0 n.succ = 0
- n.succ.stirlingSecond 0 = 0
- n.succ.stirlingSecond k.succ = (k + 1) * n.stirlingSecond (k + 1) + n.stirlingSecond k
Instances For
Every power n ^ k is a linear combination of the descending factorials n.descFactorial j
with the Stirling numbers of the second kind stirlingSecond k j as coefficients.