# How to use a table with two variables as the values for a function with two variables (x and y)? [duplicate]

I'm sorry if this is a dumb question. I am a student and have 0 prior experience with Mathematica or any sort of coding and I have looked at various resources trying to figure it out myself but still need help. Also, I'm sorry if anything is confusing.

This is my function. The virus[vt] and Sigma parameters are set.

Fitness1[x_, y_] := Exp[-((x + y)/2 - (virus[vt]))^2/(2 \[Sigma]^2)]


This is my table.

GenotypesMale1 =
Table[{Random[NormalDistribution[2, \[Sigma]m]],
Random[NormalDistribution[2, \[Sigma]m]]}, {20]}]


The output of the Table function above is

{{1.62001, 2.40024}, {2.18355, 2.60117}, {1.83962, 2.709}, {1.94572,
2.37221}, {1.69635, 1.30685}, {2.35385, 2.24577}, {1.84914,
3.01337}, {2.01219, 2.47033}, {1.36143, 2.75167}, {2.54443,
2.46801}, {1.89521, 1.12607}, {1.1986, 1.74052}, {2.45004,
1.72624}, {2.35641, 1.98379}, {1.48063, 1.94321}, {1.65051,
2.39117}, {2.87519, 0.860111}, {1.90193, 2.01434}, {1.35583,
2.39696}, {1.88331, 1.56575}}


I am trying to generate a new set of data (output as a table) by running the function using each pair { , } in the table as the values for x and y in my function.

• try Fitness1@@@GenotypesMale1 ? (See Apply (@@) in the docs.) – kglr Jun 6 '19 at 0:06
• Thank you so much! That worked :) – missalyssa Jun 6 '19 at 1:07
• posted the comment as an answer... – kglr Jun 6 '19 at 4:36

You can Apply the function Fitness to GenotypesMale1 at level 1 (@@@):
Fitness1 @@@ GenotypesMale1