# Compute the product between two sets

Posted 8 years ago
7076 Views
|
4 Replies
|
1 Total Likes
|
 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,
4 Replies
Sort By:
Posted 8 years ago
 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.
Posted 8 years ago
 Perhaps  Flatten[Outer[f, {a, b}, {c, z}], 1] 
Posted 8 years ago
 This is not what you want?
Posted 8 years ago
 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,