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
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5652950406074524, "perplexity": 9260.374831281724}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-45/segments/1603107882102.31/warc/CC-MAIN-20201024051926-20201024081926-00540.warc.gz"}