Given a function f and two lists of variables
{a1,a2,...}, {b1,b2,...}
How can I generate a following list
{f[a1,b1],f[a1,b2],...,f[a2,b1],f[a2,b2]...,}
==========================================
Thanks for the answering of @Bill first. I am not familiar with the function "Mapthread". The best thing I can do is as following
Mapthread[f,{l1,l2}]
leading to a list
{f[a1,b1],f[a2,b2],...}
There is no f[a1,b2] in this result. How can I get a full list that I want?
MapThread
documentation contains everything anyone could write in an answer here. Voting to close as "simple to find in the documentation". $\endgroup$a = {a1, a2, a3};
b = {b1, b2, b3};
MapThread[f, {a, b}]
gives{f[a1, b1], f[a2, b2], f[a3, b3]}
and then EDIT: the question got changed. $\endgroup$