[Previous] [Next] [Contents]

[ImplState=stable,TestState=stable,DocState=stable]

## `combinat::bell` -- Bell numbers

#### Introduction

`combinat::bell`(n) computes the n-th Bell number.

#### Call(s)

`combinat::bell(n)`
`combinat::bell(expression)`

#### Parameters

`n` | - | nonnegative integer
`expression` | - | An expression of type `Type::Arithmetical` which must be a nonnegative integer if it is a number.

#### Returns

A positive integer value if `n` was a nonnegative integer. Otherwise `combinat::bell` returns the unevaluated function call.

#### Details

- The n-th Bell number is defined by the exponential generating function:

      exp(exp(x) - 1) = sum(bell(n)/n! * x^n, n = 0..infinity)

  Often another definition is used. The n-th Bell number is the number of different ways of partitioning the set 1, 2, ..., n into disjoint nonempty subsets, and bell(0) is defined to be 1.

- Bell numbers are computed using the formula:

                   bell(0)   = 1
                   bell(n+1) = sum(binomial(n,i)*bell(i), i=0..n), n > 0

#### Example 1

    >> combinat::bell(3)

                                         5

This means that you can partition the set 1,2,3 into disjoint subsets in 5 different ways. These are {{1,2,3}}, {{1},{2,3}}, {{2},{1,3}}, {{3},{1,2}}, and {{1},{2},{3}}. Or, that you can write 105 = 3*5*7 as 5 different products. These are 105 = 3*5*7 = 15*7 = 21*5 = 3*35 = 105*1.

#### Example 2

If one uses a wrong argument, an error message is returned.

    >> combinat::bell(3.4)

          Error: Nonnegative integer expected [combinat::bell]

#### Example 3

It can be useful to return the unevaluated function call.

    >> a:=combinat::bell(x)

                                 combinat::bell(x)

    >> x :=4

                                         4

    >> a ; delete a:

                                        15

[Previous] [Next] [Contents]

MuPAD Combinat, an open source algebraic combinatorics package