# solving an equation for two lists of values sequentially

I'm very new to this. My goal is to run a function for 10 different pairs of values. The function looks like this:

f[groupsize_, solvedforq_] =
Sum[Binomial[groupsize, t] Chop[solvedforq]^t (1 - Chop[solvedforq])^(groupsize - t), {t, 3, groupsize}]


The objects groupsize and solvedforq are lists, each containing 10 values. I would like to create a List or Table of outputs, where the first output is the solution for taking the first element of each list (i.e., the pair of values that I get when taking the first element of groupsize and the first element of solvedforq), the second output is the solution for taking the second element of each list, etc...

So I will ideally have a List or Table with 10 output values. I am ware for the command Map[], but I wouldn't know how to use it in this more complex case. Thanks for all help!

MapThread[f, {group, solved}]


This will give f[group[], solved[]], f[group[], solved[]], etc. Note that your function f should probably be defined with := instead of =.

Bob Hanlon suggest the use of Transpose, and this brings up a good point. There is a tight relationship between here: Thread is a synonym for Transpose (at least for 2D matix-style lists), so this could also be written:

Map[f, Thread[{group, solved}]]


or using the shortcut

Here it is easy to see the relationship between Map and Thread, and MapThread. This also demonstrates how similar the functioning is between Map /@ and Apply @@@:

f @@@ Thread[{group, solved}]


or the more pedantic

Apply[f, Thread[{group, solved}], 2]


which also give the same output.

• Works perfectly, thank you! Nov 13, 2018 at 14:55
• Also f @@@ Transpose@{group, solved} Nov 13, 2018 at 14:57

Here is another variation, with Table.

Table[f[group[[i]], solved[[i]]], {i, 1, 4}]


I assume

group = {1, 2, 3, 4};
solved = {5, 6, 7, 8};
f[groupsize_, solvedforq_] := etc


For these sets, the output is the same as in the previous case. {0, 0, 343, -10240}