Hello,
I’m new with Mathematica, and I search to write an expression that compute the product of two sets.
Table[f[x,y] , {x,S1},{y,S2} ] is nice to write, but as Cross function, it produce 2 parantheses levels rather than one.
{ { f[a,b], f[a,c] } , { f[z,b], f[z,c] } }
I expect to compute { f[a,b], f[a,c], f[z,b], f[z,c] }
Flatten didnt make things better, because f return List object as result.
Sure I dont know how to manipulate data, I really need to progress. Could someone help ?
Kind Regards,
Seems Tuples function provide help, but now, it’s not really easy to read :
Table[ f [ x[[1]], x[[2]] ] , {x,Tuples[{S1,S2}]} ]
How could I have the same expression power than before with “local variables” associated to quantifiers/iterators ?
Kind Regards,
arnoudb
(Arnoud Buzing)
3
This is not what you want?
iliang
(Ilian Gachevski)
4
Perhaps
Flatten[Outer[f, {a, b}, {c, z}], 1]
I didnt know Flatten last optional parameter.
Flatten[Outer[f, {a, b}, {c, z}], 1]
It’s exactly what I need.
Thank you very much for your help.