Re: Listing the partitions of a set

• To: mathgroup at smc.vnet.net
• Subject: [mg65300] Re: [mg65282] Listing the partitions of a set
• From: leigh pascoe <leigh at cephb.fr>
• Date: Sat, 25 Mar 2006 05:17:35 -0500 (EST)
• References: <200603240559.AAA26153@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

Richard Palmer wrote:
> Is there a simple way to list the partitions of a set?  For example, there
> are 15 partitions on a set of 4 elements.  {{{1, 2, 3, 4}}, {1, {2, 3, 4}},
> {{1, 3, 4}, 2}, {{1, 2, 4}, 3}, {{1, 2, 3},    4}, {{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}} .
>
>
>
>
>
Try this

<<DiscreteMath`Combinatorica`

l={1,2,3,4};
SetPartitions[l]
Length[SetPartitions[l]]

Read the help in the Combinatorica section.

LP

• Prev by Date: Plot equations and inequalities together
• Next by Date: constraints and NMinimize
• Previous by thread: Listing the partitions of a set
• Next by thread: Re: Listing the partitions of a set