MathGroup Archive 2005

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

Search the Archive

Re: direct product of two sets


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