# Mapping function with multiple parameters

So I am trying to print out a table using the map function. My code looks like this:

parameters = Table[{a, z}, {a, 1.251,2.5,5.251}, {z, {1, 10, 15, 25, 30}}];

Map[r+a+z &, parameters, {2}]


Unfortunately, this gets me a list with the parameters unchanged. What I want is for this function to return a list of the sort {r+1.251+1},{r+1.251+10},{r+1.251+15}...{r+2.5+1},{r+2.5+10},{r+2.5+15}... etc etc

Obviously in the final output, the numbers would actually be added up.

• Map[({r + #[[1]] + #[[2]]}) &, Flatten[parameters, 1]] – RMMA Oct 11 '17 at 13:10
• or Map[Plus[r, Total@#] &, parameters, {2}] – kglr Oct 11 '17 at 13:14
• @RMMA! Cool that works. What do the hashtags actually do here? – Dio Oct 11 '17 at 13:14
• Map[r + Total[#] &, First@parameters] The hash mark stands for the argument; the ampersand is postfix for Function. See the documentation for Function. – Alan Oct 11 '17 at 13:19
• I'm not sure if I should VTC as a simple mistake. Note that a and z are not stored or remembered in any way as references to anything in parameters. Another neat way to solve your problem would be Total[parameters, {3}] + r. Further reading is already covered in other comments – LLlAMnYP Oct 11 '17 at 14:25

Join @@ Map[{r + Total@#} &, parameters, {2}]