use*_*184 3 wolfram-mathematica list
我想知道在Mathematica中如何从两个列表开始f=[1,2,3] g=[4,5,6]并找到列表h = f X g,其中包含所有可能的对{a,b},这a是一个元素,f并且b是元素g.
f = {1, 2, 3}; g = {4, 5, 6};
Tuples@{f, g}
(*{{1, 4}, {1, 5}, {1, 6}, {2, 4}, {2, 5}, {2, 6}, {3, 4}, {3, 5}, {3, 6}}*)
Run Code Online (Sandbox Code Playgroud)