MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Finding all n-partitions of a set

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98738] Re: [mg98707] Finding all n-partitions of a set
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 17 Apr 2009 04:29:25 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

Needs["Combinatorica`"];

Union[Sort /@ KSetPartitions[{a, a, b, b}, 2]]

{{{a}, {a, b, b}}, 
   {{b}, {a, a, b}}, 
   {{a, a}, {b, b}}, 
    {{a, b}, {a, b}}}


Bob Hanlon

---- "Joe.Mapasapam" <mapasapam at gmail.com> wrote: 

=============
Please how can I find all n-partions of a set ?


Say, i want partitions of the set (no order) {a,a,b,b} into 2,

so we have 
{
{{a,a,b,},{b}},
{{a,b,b},{a}},
{{a,a},{b,b}},
{{a,b},{a,b}}
}

is there already a built in function in mathematica ?

i need so n can be any number



  • Prev by Date: getting data points instead of a plot in ListContourPlot ?
  • Next by Date: Re: Exporting animations
  • Previous by thread: Re: Finding all n-partitions of a set
  • Next by thread: Exporting animations