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

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

Search the Archive

Re: direct product of two sets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53290] Re: [mg53264] direct product of two sets
  • From: yehuda ben-shimol <benshimo at bgu.ac.il>
  • Date: Tue, 4 Jan 2005 03:14:00 -0500 (EST)
  • References: <200501030929.EAA10701@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Use Outer
Outer[List,a,b]
so let a={1,2,3}; b={4,5,6};
Flatten[Outer[List, a, b], 1] gives you
{{1, 4}, {1, 5}, {1, 6}, {2, 4}, {2, 5}, {2, 6}, {3, 4}, {3, 5}, {3, 6}}

Another option is to use Distribute[]
Distribute[{a,b},List] will give you the same result
yehuda


Cong wrote:

>Hello!
>
>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?
>
>Best Regards,
>
>Cong
>
>  
>


  • Prev by Date: Re: Simplify[expr] bug?
  • Next by Date: Re: RealTime3D
  • Previous by thread: Re: direct product of two sets
  • Next by thread: Re: direct product of two sets