I am trying to generate 100 random points of variables mf1 and msc1 and calculate mhiggs. I want calculated values and corresponding random points to be printed together in human readable form. Also, What can be done if I want to choose only certain values of mhiggs and want to print those values along with corresponding random points? How can these generated points (for a specific value of mhiggs) be plotted?

mf1 = RandomReal[{100, 2000}, 100];
msc1 = RandomReal[{0, 2000}, 100];
For[j = 1, j < 10, j++,
Print[mhiggs[1, mf1[[j]], msc1[[j]]]]]

closed as off-topic by Anton Antonov, MarcoB, happy fish, march, m_goldberg Mar 22 '17 at 18:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Anton Antonov, MarcoB, happy fish, march, m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ use Table not For and Print $\endgroup$ – george2079 Mar 21 '17 at 17:56
  • $\begingroup$ you could use MapThread[mhiggs[1,#1,#2]&,{mf1,msc1}] $\endgroup$ – ubpdqn Mar 22 '17 at 9:46

You didn't give the definition for the function mhiggs, so I will make up my own to illustrate the procedure.

mf1 = RandomReal[{100, 2000}, 100];
msc1 = RandomReal[{0, 2000}, 100];

(* Function simply adds its argument. Replace this with your definition. *)
mhiggs[x_, y_] := x + y

Then you can use Table to get value of function along with its arguments for first 10 points (or some other range). Results can be neatly printed with TableForm.

list = Table[
  {mhiggs[mf1[[i]], msc1[[i]]], mf1[[i]], msc1[[i]]},
{i, 1, 10}];
TableForm[list, TableHeadings -> {None, {"mhiggs", "mf1", "msc1"}}]

Select with appropriate second argument is the way to extract only the interesting points (e.g. points (lists) where the first argument is larger than some threshold).

Select[list, #[[1]] > 2400 &]

To calculate values of mhiggs for all generated random points you can also write more concisely.

list = MapThread[
  {mhiggs[#1, #2], #1, #2} &,
  {mf1, msc1}

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