1
$\begingroup$

This question already has an answer here:

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.

$\endgroup$

marked as duplicate by Kuba Jun 6 at 5:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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

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

Fitness1 @@@ GenotypesMale1
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.