\(\text{S}\)

You can use the \(\text{S}\) function to calculate Sterling numbers of the second kind.

You can use the \sterling2fn backslash command to insert this function.

The following variants of this function are available:

  • \(\text{real } \text{S} \left ( \text{<n>}, \text{<k>} \right )\)

Where \(\text{<n>}\) and \(\text{<k>}\) represents the number of elements and number of disjoint cycles respectively.

The function returns the number of permutations calculated by the recurrence relation:

\[\text{S} \left ( n, k \right ) = \frac{1}{k!} \sum_{i = 0}{k} \left ( -1 \right ) ^ i \binom{k}{i} \left ( k - i \right ) ^ n\]

Figure 197 shows the basic use of the \(\text{S}\) function.

../_images/sterling_function_2_example.png

Figure 197 Example Use Of The S Function