Re: I'm looking for an algorithm: Cartesian Product
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1677] Re: [mg1644] I'm looking for an algorithm: Cartesian Product
- From: Bernhard Hahn <bmhahn at poseidon.knoware.nl>
- Date: Tue, 11 Jul 1995 06:17:21 -0400
This might be what you are looking for: In[1]:= Outer[f, {a1, a2}, {b1, b2, b3}, {z1, z2}] // Flatten Out[1]= {f[a1, b1, z1], f[a1, b1, z2], f[a1, b2, z1], f[a1, b2, z2], f[a1, b3, z1], f[a1, b3, z2], f[a2, b1, z1], f[a2, b1, z2], f[a2, b2, z1], f[a2, b2, z2], f[a2, b3, z1], f[a2, b3, z2]} Bernhard --- ---------------------------------------------------------- Bernhard M. Hahn Tel: +31-(0)3430-13321 Buntlaan 13 Fax: +31-(0)3430-13321 3941 MG Doorn Email: bmhahn at poseidon.knoware.nl The Netherlands (NeXTmail & MIME Welcome!) PGP public key available ----------------------------------------------------------