set partition - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


combinat

  

setpartition

  

compute the partitions of a set

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

setpartition(S, m, returnsets)

Parameters

S

-

set or list of objects

m

-

(optional) integer indicating the size of the partitions returned

returnsets

-

(optional) to return the partitions as sets even if S is a list

Description

• 

The setpartition command returns all the partitions of S. A partition of a set S is a set of subsets of S such that every element s in S is in one and only one of these subsets of the partition, and the union of these subsets is equal to S. A set of n elements has combinat[bell](n) partitions (the nth Bell number).

• 

If S is a list of objects, then each partition in the output is represented as a list of sublists instead of a set of subsets. By passing the optional argument returnsets = true, each partition in the output will be a set of subsets even if S is a list. Likewise, when passing returnsets = false, each partition will be a list of sublists even if S is a set.

  

Note: If S is a list of n elements, with some of them being repeated, the total number of partitions will be smaller than combinat[bell](n) and some elements s of S will appear in more than one sublist of a single partition. For example, when computing all the partitions of 1,1,2 via setpartition([1, 1, 2]), the partition 1,1,2 appears only once in the result and it contains the element 1 in two sublists.

• 

When the optional argument m is given, each subset is of size m where m must divide the cardinality of the set.

Examples

withcombinat,setpartition

setpartition

(1)

S1,2,3,4

S1,2,3,4

(2)

setpartitionS

1,2,3,4,1,2,3,4,2,1,3,4,3,1,2,4,4,1,2,3,1,2,3,4,1,3,2,4,1,4,2,3,1,2,3,4,1,3,2,4,1,4,2,3,2,3,1,4,2,4,1,3,3,4,1,2,1,2,3,4

(3)

nops=combinat:-bell4

15=15

(4)

nopssetpartition1,2,3,4,5,6,7=combinat:-bell7

877=877

(5)

setpartitionS,2

1,2,3,4,1,3,2,4,1,4,2,3

(6)

S1,1,3,4

S1,1,3,4

(7)

setpartitionS,2

1,1,3,4,1,3,1,4

(8)

Compatibility

• 

The combinat[setpartition] command was updated in Maple 18.

• 

The returnsets option was introduced in Maple 18.

• 

For more information on Maple 18 changes, see Updates in Maple 18.

See Also

combinat

combinat[bell]

combinat[choose]

combinat[partition]

list

set