Re: I'm looking for an algorithm: Cartesian Product
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1690] Re: [mg1644] I'm looking for an algorithm: Cartesian Product
- From: Richard Mercer <richard at seuss.math.wright.edu>
- Date: Mon, 17 Jul 1995 01:54:22 -0400
> I'm looking for an algorithm that can compute
> Cartesian Product for several sets. For example:
> ....
The following is not perfect but is probably what you are looking for.
In[20]:=
Distribute[{{a,b},{c,d},{e,f,g}},List]
Out[20]=
{{a, c, e}, {a, c, f}, {a, c, g}, {a, d, e}, {a, d, f}, {a, d, g}, {b, c, e},
{b, c, f}, {b, c, g}, {b, d, e}, {b, d, f}, {b, d, g}}
Richard Mercer