## `combinat::stirling2` -- Stirling numbers of the second kind

#### Introduction

`combinat::stirling2`(n,k) computes the Stirling numbers of the second kind.

#### Call(s)

`combinat::stirling2(n,k)`

#### Parameters

`n,k` | - | nonnegative integers

#### Returns

a nonnegative integer.

#### Details

- `combinat::stirling2`(n,k) computes the number of ways of partitioning a set of `n` elements into `k` non-empty subsets.
- `combinat::stirling2`(n,k) is calculated using the formula

      stirling2(n,k) = 1/k! * sum((-1)^(k-j)*binomial(k,j)*j^n,j=0...k) .

#### Example 1

One can partition the set 1,2,3 into 1,2,3 = 1,2 union 3 = 1,3 union 2 = 2,3 union 1

    >> combinat::stirling2(3,2)

                                         3

#### Example 2

    >> combinat::stirling2(3)

          Error: Two arguments expected. [combinat::stirling2]

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000