Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*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 2000

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

Search the Archive

Re: generating subsets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21599] Re: [mg21588] generating subsets
  • From: Maris Tõnso <maris at tpu.ee>
  • Date: Sun, 16 Jan 2000 22:43:47 -0500 (EST)
  • References: <200001160856.DAA10812@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Michael,

I find the following function Subsets from Ilan Vardi's package
Miscellaneous`OneLiners`

Subsets[x_]:= Distribute[{{}, {#}}& /@ x, List, List, List, Union]

Regards
Maris Tonso


Michael Gass wrote:

> I need an _efficient_  procedure for generating all the subsets
> of a given set.  The procedure should produce output as follows:
>
> subSets[{a,b,c}]
> produces
> {{}, {a}, {b}, {c}, {a,b}, {a,c}, {b,c}, {a,b,c}}
>
> I have written a recursive procedure to do this, but
> it takes quite a while to generate, say, the 512 subsets
> of a 9 element set and I need to work with somewhat larger
> sets.
>
> Thanks
>
> --
> Michael Gass                            Department of Mathematics
> phone: 320 363-3090                     St. John's University
> email: mgass at csbsju.edu                 Collegeville, MN  56321-3000



  • Prev by Date: Series expansion of ArcSin around 1
  • Next by Date: Re: Plotting A verticle line?
  • Previous by thread: Re: generating subsets
  • Next by thread: Re: generating subsets