I am an R user and am totally new to Mathematica. I am trying to find the roots of a system of two equations over a series of paramter values and plot the results. I can do the computation but would love to know how I can work with the results without exporting them from Mathmatica.

 alphas = Table[
          FindRoot[ {
          S1*(1 - Exp[-R01*(1 - alpha)*Zinf1/N1 - R02*alpha*Zinf2/N2]) - Zinf1,
          S2*(1 - Exp[-R02*(1 - alpha)*Zinf2/N2 - R01*alpha*Zinf1/N1]) - Zinf2} == 0, 
          {Zinf1, 10000},
          {Zinf2, 10000}], {alpha, 0, 1, .1}]

This seems to return a list of named lists (each element being something like {Zinf1 -> 9403.65, Zinf2 -> 9800.66}). I would like to plot all the Zinf1's vs. alphas and thought something like ListPlot[] could do it, but it seems to have issues with the name:

ListPlot::optx: Unknown option Zinf1 in ListPlot[Zinf1->9403.65,Zinf1->9475.33,Zinf1-    9533.97,Zinf1->....

Any idea how to get this data into an easier (perhaps unnamed) form?

  • $\begingroup$ Try the following: ListPlot[{Zinf1, Zinf2} /. alphas] This will allow for each replacement of the Zinf1's and Zinf2's one by one from the solutions. $\endgroup$ Commented Jun 7, 2013 at 16:04
  • $\begingroup$ Thanks! Feel free to post that as a solution. $\endgroup$
    – scottyaz
    Commented Jun 7, 2013 at 16:06

1 Answer 1


alpha1 has given you a Table of replacements. You just need to create something in which you can make these replacements. A command of the form {a,b}/.{a->1,b->2} will give you {1,2}. Similarly in this case you can pass the whole table in as follows:

ListPlot[{Zinf1, Zinf2} /. alphas]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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