# Mapping function with multiple variables and ingrained list

Been working on this for hours, but I can't seem to find something which mimics this.

So I've got parameter values in a list of the form:

parameters=
{{{-2, 0.5}, {-2, 1}, {-2, 2}, {-2, 3}, {-2, 4}},
{{-1, 0.5}, {-1,  1}, {-1, 2}, {-1, 3}, {-1, 4}},
{{0, 0.5}, {0, 1}, {0, 2}, {0,3}, {0, 4}},
{{1, 0.5}, {1, 1}, {1, 2}, {1, 3}, {1, 4}},
{{2,0.5}, {2, 1}, {2, 2}, {2, 3}, {2, 4}}}


I've got a MapThread function:

MapThread[f, parameters, 1]


which gives

{f[{-2, 0.5}, {-1, 0.5}, {0, 0.5}, {1, 0.5}, {2, 0.5}],
f[{-2, 1}, {-1, 1}, {0, 1}, {1, 1}, {2, 1}],
f[{-2, 2}, {-1, 2}, {0, 2}, {1, 2}, {2, 2}],
f[{-2, 3}, {-1, 3}, {0, 3}, {1, 3}, {2, 3}],
f[{-2, 4}, {-1, 4}, {0, 4}, {1, 4}, {2, 4}]}


When I actually want it to give:

{{f[-2, 0.5], f[-1, 0.5], f[0, 0.5], f[1, 0.5], f[2, 0.5] },
{f[-2, 1], f[-1, 1], f[0, 1], f[1, 1], f[2, 1]},
{f[[-2, 2], f[-1, 2], f[0, 2], f[1, 2], f[2, 2]},
{f[-2, 3], f[-1, 3], f[0, 3], f[1, 3], f[2, 3]},
{f[-2, 4], f[-1, 4], f[0, 4], f[1, 4], f[2, 4]}}


Not quite sure what is going wrong.

I am especially interested in how to work with the curly brackets. Thanks in advance!

MapThread[f @@@ {##} &, parameters]


{{f[-2, 0.5], f[-1, 0.5], f[0, 0.5], f[1, 0.5], f[2, 0.5]},
{f[-2, 1], f[-1, 1], f[0, 1], f[1, 1], f[2, 1]},
{f[-2, 2], f[-1, 2], f[0, 2], f[1, 2], f[2, 2]},
{f[-2, 3], f[-1, 3], f[0, 3], f[1, 3], f[2, 3]},
{f[-2, 4], f[-1, 4], f[0, 4], f[1, 4], f[2, 4]}}

you get the same result using

f @@@ # & /@ Transpose[parameters]


Just Apply[] at an appropriate level before doing a Transpose[], so you don't need to Map[]:

Transpose[Apply[f, {{{-2, 0.5}, {-2, 1}, {-2, 2}, {-2, 3}, {-2, 4}},
{{-1, 0.5}, {-1, 1}, {-1, 2}, {-1, 3}, {-1, 4}},
{{0, 0.5}, {0, 1}, {0, 2}, {0, 3}, {0, 4}},
{{1, 0.5}, {1, 1}, {1, 2}, {1, 3}, {1, 4}},
{{2, 0.5}, {2, 1}, {2, 2}, {2, 3}, {2, 4}}}, {2}]]
{{f[-2, 0.5], f[-1, 0.5], f[0, 0.5], f[1, 0.5], f[2, 0.5]},
{f[-2, 1], f[-1, 1], f[0, 1], f[1, 1], f[2, 1]},
{f[-2, 2], f[-1, 2], f[0, 2], f[1, 2], f[2, 2]},
{f[-2, 3], f[-1, 3], f[0, 3], f[1, 3], f[2, 3]},
{f[-2, 4], f[-1, 4], f[0, 4], f[1, 4], f[2, 4]}}