It's not often there's a question on here about resource competition of phytoplankton (my niche speciality), so I'm obligated to attempt an answer.
First, define the right-hand sides:
Clear["Global`*"]
dy1 = (v1*y3/(y3 + k1) + v2*y4/(y4 + k2) - m1)*y1;
dy2 = (v3*y3/(y3 + k3) + v4*y4/(y4 + k4) - m2)*y2;
dy3 = -v1*y3/(y3 + k3)*q1*y1 - v3*y3/(y3 + k3)*q2*y2 + s1;
dy4 = -v2*y4/(y4 + k2)*q1*y1 - v4*y4/(y4 + k4)*q2*y2 + s2;
Usually one would Solve
for all of these equal to zero simultaneously as in @Domen's answer, but the expressions are complicated and there are many equilibria (since both species y1
and y2
could be present or absent). One trick is to divide their equations by yi
to focus on the case of coexistence. They are still too ugly to look at, so I suppress output with a semicolon, but we can see that there are two of them:
eq = Solve[{dy1/y1 == 0, dy2/y2 == 0, dy3 == 0, dy4 == 0}, {y1, y2, y3, y4}];
Length[eq]
(* 2 *)
Alternatively, one could break it into two subproblems taking advantage of the fact that the species' per capita growth depends only on the nutrient concentrations (y3
and y4
). This is why zero-net growth isoclines (ZNGIs) work in resource competition theory.
First, solve for nutrients when both species don't grow:
nuteq = FullSimplify[Solve[{dy1 == 0, dy2 == 0}, {y3, y4}]]
(* two not TOO ugly expressions *)
Then solve for species abundances when resources don't change:
speq = FullSimplify[Solve[{dy3 == 0, dy4 == 0}, {y1, y2}]][[1]]
(* one almost nice looking expression *)
I gather from the authors' python code (files s001_00_12_Optimized.py
and Solutions01.py
), this is what they did.
Finally, assign parameters and plot. Here's my attempt at Fig. 5A:
v1 = 1.14; v2 = 2.42; v3 = 2.17; v4 = 3.98;
k1 = 35.5; k2 = 11.8; k3 = 19.9; k4 = 69.2;
m1 = 0.706; m2 = 0.517;
q1 = 1.2*10^-4; q2 = 2.88*10^-4;
s2 = 0.005*10^3;
s1 := s2*sratio; (* define s1 in terms of s2 *)
LogLogPlot[Evaluate[(y1*q1/(y2*q2)) /. eq[[2]]], {sratio, 10^-1.5, 10^0.5}, PlotRange -> {{10^-1.5, 10^0.5}, {10^-4, 10^4}}]
Looks pretty close, but might be off since you used different notation than in the paper. Also, I had to guess that eq[[2]]
was the correct solution.
One other thing I can note: Replicating Fig. 2 requires a little hack to keep nutrient levels non-negative, due to the non-physical negative "source" terms as found in Table S4 of the Supplemental Material.