MathGroup Archive 2005

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

Search the Archive

Re: direct product of two sets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53274] Re: direct product of two sets
  • From: Simon Anders <simon.anders at uibk.ac.at>
  • Date: Tue, 4 Jan 2005 03:12:45 -0500 (EST)
  • Organization: University of Innsbruck, Austria
  • References: <crb4hv$an3$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

> Give 2 finite sets A and B, how can I compute their direct product
> A x B := {(a,b) : a\in A, b\in B}
> 
> Can someone help me?

Use Outer:

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

In[2] :=  Outer [{#1, #2} &, a, b]

Out[2] :=  {{{1, 2}, {1, 4}, {1, 6}, {1, 8}},
             {{3, 2}, {3, 4}, {3, 6}, {3, 8}},
             {{5, 2}, {5, 4}, {5, 6}, {5, 8}}}

HTH,
   Simon


  • Prev by Date: Re: direct product of two sets
  • Next by Date: Re: direct product of two sets
  • Previous by thread: Re: direct product of two sets
  • Next by thread: Re: direct product of two sets