Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Re: Listing the partitions of a set

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65325] Re: [mg65317] Re: [mg65282] Listing the partitions of a set
  • From: "Adriano Pascoletti" <pascolet at dimi.uniud.it>
  • Date: Mon, 27 Mar 2006 06:55:51 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Reading my previous message I realize I answered a different question: subsets of a given set, not its partitions. Sorry.
Adriano Pascoletti

Adriano Pascoletti wrote ..
>  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}}
> > .  
> 
> Richard,
> Mathematica 5.1 introduced Subsets:
> In[1]:=
> Subsets[{1,2,3,4}]//Rest
> 
> Out[1]=
> {{1},{2},{3},{4},{1,2},{1,3},{1,4},{2,3},{2,4},{3,4},{1,2,3},{1,2,4},{
>   1,3,4},{2,3,4},{1,2,3,4}}
> 
> One can get the same result with Distribute (an idea of I. Vardi, IIRC):
> 
> In[2]:=
> Distribute[{{},{#}}&/@Range[4],List,List,List,Join]//Sort//Rest
> 
> Out[2]=
> {{1},{2},{3},{4},{1,2},{1,3},{1,4},{2,3},{2,4},{3,4},{1,2,3},{1,2,4},{
>   1,3,4},{2,3,4},{1,2,3,4}}
> 
> 
> Adriano Pascoletti
> 


  • Prev by Date: Re: About subscripts
  • Next by Date: Re: Writing prime factor decomposision in conventional form
  • Previous by thread: Re: Listing the partitions of a set
  • Next by thread: Plot equations and inequalities together