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: [mg98727] Re: [mg98707] Finding all n-partitions of a set
  • From: Adriano Pascoletti <adriano.pascoletti at dimi.uniud.it>
  • Date: Fri, 17 Apr 2009 04:27:26 -0400 (EDT)
  • References: <200904160818.EAA17706@smc.vnet.net>

My previous message was truncated.
Joe,
you are requesting the n-partitions of a set but {a,a,b,b} isn't a set.
Look at the built in functions Subsets and ReplaceList

In[1]:= ReplaceList[{a, a, b, b}, {x__, y__} :> {{x}, {y}}]
Out[1]= {{{a}, {a, b, b}}, {{a, a}, {b, b}}, {{a, a, b}, {b}}}

Adriano Pascoletti

2009/4/16 Joe.Mapasapam <mapasapam at gmail.com>

> 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: Re: Simplify
  • Next by Date: Re: FindRoot
  • Previous by thread: Re: Finding all n-partitions of a set
  • Next by thread: Re: Finding all n-partitions of a set