This chapter describes the functions that deal with combinatorics. We mainly concentrate on two areas. One is about selections, that is the ways one can select elements from a set. The other is about partitions, that is the ways one can partition a set into the union of pairwise disjoint subsets.
First this package contains various functions that are related to the number of selections from a set (see Factorial, Binomial) or to the number of partitions of a set (see Bell, Stirling1, Stirling2). Those numbers satisfy literally thousands of identities, which we do no mention in this document, for a thorough treatment see GKP90.
Then this package contains functions to compute the selections from a set (see Combinations), ordered selections, i.e., selections where the order in which you select the elements is important (see Arrangements), selections with repetitions, i.e., you are allowed to select the same element more than once (see UnorderedTuples) and ordered selections with repetitions (see Tuples).
As special cases of ordered combinations there are functions to compute all permutations (see PermutationsList), all fixpointfree permutations (see Derangements) of a list.
This package also contains functions to compute partitions of a set (see PartitionsSet), partitions of an integer into the sum of positive integers (see Partitions, RestrictedPartitions) and ordered partitions of an integer into the sum of positive integers (see OrderedPartitions).
Moreover, it provides three functions to compute Fibonacci numbers (see Fibonacci), Lucas sequences (see Lucas), or Bernoulli numbers (see Bernoulli).
Finally, there is a function to compute the number of permutations that fit a given 1-0 matrix (see Permanent).
All these functions are in the file "LIBNAME/combinat.g"
.
GAP 3.4.4