Re: Creating combinations from a group of sets

• To: mathgroup at smc.vnet.net
• Subject: [mg48715] Re: Creating combinations from a group of sets
• From: koopman at sfu.ca (Ray Koopman)
• Date: Fri, 11 Jun 2004 03:52:44 -0400 (EDT)
• References: <ca91bp\$t8h\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Jeanette L Domber <Jeanette.L.Domber at aero.org> wrote in message
news:<ca91bp\$t8h\$1 at smc.vnet.net>...
> I have a group of sets:
>
> {1,2,3}
> {4,5}
> {6}
> {7,8}
>
> I wish to create all unique combinations of the sets that contain exactly one element from each set:
>
> {1,4,6,7}
> {1,5,6,7}
> {1,4,6,8}
> {1,5,6,8}
> {2,4,6,7}
> {2,5,6,7}
> etc.
>
> In all, there should be 12 combinations.

In[1]:= a = {{1,2,3},
{4,5},
{6},
{7,8}};

In[2]:= Distribute[a,List]
Out[2]= {{1,4,6,7},
{1,4,6,8},
{1,5,6,7},
{1,5,6,8},
{2,4,6,7},
{2,4,6,8},
{2,5,6,7},
{2,5,6,8},
{3,4,6,7},
{3,4,6,8},
{3,5,6,7},
{3,5,6,8}}

```

• Prev by Date: Re: Combining plots
• Next by Date: Re: Scriptable Mathematica tools for auto-editing text?
• Previous by thread: RE: Creating combinations from a group of sets
• Next by thread: Re: Creating combinations from a group of sets