### The Maxima on-line user's manual

Algebra Calculator

#### Stirling2

Function: stirling2 (<n>, <m>) Represents the Stirling number of the second kind.

When <n> and <m> are nonnegative integers, `stirling2 (<n>, <m>)` is the number of ways a set with cardinality <n> can be partitioned into <m> disjoint subsets. Maxima uses a recursion relation to define `stirling2 (<n>, <m>)` for <m> less than 0; it is undefined for <n> less than 0 and for non-integer arguments.

`stirling2` is a simplifying function. Maxima knows the following identities.

1. stirling2(0, n) = kron_delta(0, n) (Ref. [1])

2. stirling2(n, n) = 1 (Ref. [1])

3. stirling2(n, n - 1) = binomial(n, 2) (Ref. [1])

4. stirling2(n + 1, 1) = 1 (Ref. [1])

5. stirling2(n + 1, 2) = 2^n - 1 (Ref. [1])

6. stirling2(n, 0) = kron_delta(n, 0) (Ref. [2])

7. stirling2(n, m) = 0 when m > n (Ref. [2])

8. stirling2(n, m) = sum((-1)^(m - k) binomial(m k) k^n,i,1,m) / m! when m and n are integers, and n is nonnegative. (Ref. [3])

These identities are applied when the arguments are literal integers or symbols declared as integers, and the first argument is nonnegative. `stirling2` does not simplify for non-integer arguments.

References:

[1] Donald Knuth. The Art of Computer Programming, third edition, Volume 1, Section 1.2.6, Equations 48, 49, and 50.

[2] Graham, Knuth, and Patashnik. Concrete Mathematics, Table 264.

[3] Abramowitz and Stegun. Handbook of Mathematical Functions, Section 24.1.4.

Examples:

```          (%i1) declare (n, integer)\$
(%i2) assume (n >= 0)\$
(%i3) stirling2 (n, n);
(%o3)                           1```

`stirling2` does not simplify for non-integer arguments.

```          (%i1) stirling2 (%pi, %pi);
(%o1)                  stirling2(%pi, %pi)```

Maxima applies identities to `stirling2`.

```          (%i1) declare (n, integer)\$
(%i2) assume (n >= 0)\$
(%i3) stirling2 (n + 9, n + 8);
(n + 8) (n + 9)
(%o3)                    ---------------
2
(%i4) stirling2 (n + 1, 2);
n
(%o4)                        2  - 1```

```(%o1)                                true
(%i2) ```

### Related Examples

stirling2(0,2);

Calculate

stirling2(10,2);

Calculate

stirling2(2,1);

Calculate

##### stirling2

stirling2(1000,4) ;

Calculate

stirling2(4,2);

stirling2(5,2);

stirling2(6,2);

Calculate

##### stirling2

stirling2 (5, 5);

Calculate

stirling2(25,4);

Calculate

##### stirling2

stirling2(2002,3)+sti...

Calculate

stirling2(10,2);

Calculate

##### stirling2

stirling2 (n + 1, 2);

Calculate