I am trying to plot 'data' in function of m. To achieve this I tried to get 501 datapoints using divide and then running the equations for each m. This however outputs two solutions, of which the ones with negative numbers are not possible. I have removed the negative numbers but would now like to select from each row the solution without a zero or previously a negative number.
ClearAll[m, L, w, alpha, sigma, H, F]
L = 2000; (* Queen daily laying rate*)
w = 27000;(* Rate at which eclosion approaches L as N gets large*)
alpha = 0.25;(*maximum rate that hive bees will become foragers when \
there are no foragers in the colony*)
sigma = 3/4;(*social inhibition factor*)
(*H = hive bees, F= foraging bees, m= death rate *)
mvector = Subdivide[0.01, 0.4, 500];
(* getting all the data points *)
data = Table[N[#] & /@ Solve[{
0 == L*(H + F)/(w + H + F) - H*(alpha - sigma*(F/(H + F))),
0 == H*(alpha - sigma*(F/(H + F))) - m*F}, {H, F}], {m, mvector}];
data = data /. {x_?Negative -> 0};
Extra: I don't know if the method is the most efficient, I have very little experience. The rest of the code where I plot both solutions can be found below:
(* Calculating N=H+F of the first row -- not sure how to approach the \
two rows *)
newData = Table[{data[[i, 1]][[1]][[2]] + data[[i, 1]][[2]][[2]]}, {i, 1,501}];
newData2 = Table[{data[[i, 2]][[1]][[2]] + data[[i, 2]][[2]][[2]]}, {i, 1,501}];
(* Flatten and removal of negative populations *)
Tble = Flatten[newData];
Tble2 = Flatten[newData2];
Tble = Tble /. {x_?Negative -> 0};
Tble2 = Tble2 /. {x_?Negative -> 0};
Result = Transpose[{mvector, Tble}];
Result2 = Transpose[{mvector, Tble}];
(* Plot the List *)
ListPlot[{Result}]
ListPlot[{Result2}]