I'm solving a system of equations that gives me three solutions and then plot a series of solutions depending on a parameter.
The problem is that I have to choose different solutions depending on parameters.
For each combination of parameters the only one solution which makes physical sence - such solution is positive and always less then parameter P0. I guess the right solution is the minimal positive solution.
In the proposed sample code the right solutions plotted in the first and third plot between 0 and 0.05 (parameter P0 = 0.1)
How can I put all good solutions in a single plot automatically ?
Quiet[solution =
Solve[{K1*P*M == PaM, K2*PaM*P == PMP, K3*PaM == PM,
P0 == P + PaM + PM + 2*PMP, r*P0 == M + PaM + PM + PMP}, {P, M,
PaM, PM, PMP}]];
Rmax = 5;
Rmin = 0.01;
K1 = 11;
K3 = 102;
P0 = 0.1;
K2values = {1, 10, 100, 1000, 10000, 100000, 1000000};
colors = ColorData[22, "ColorList"];
SetOptions[ParametricPlot, PlotStyle -> (Directive[#, AbsoluteThickness[3]] & /@ colors), AspectRatio -> 0.7, AxesLabel -> {"R", "v"}, PlotRange -> {{0, 5}, {-0.05, 0.2}}];
SetOptions[Graphics, ImageSize -> Large];
Plot1 = ParametricPlot[Evaluate[
Table[{{r, Re[PMP /. solution[[1]]]}}, {K2, K2values}]], {r, Rmin,
Rmax}, PlotLabel -> "Solution 1"] ;
Plot2 = ParametricPlot[Evaluate[
Table[{{r, Re[PMP /. solution[[2]]]}}, {K2, K2values}]], {r, Rmin,
Rmax}, PlotLabel -> "Solution 2"] ;
Plot3 = ParametricPlot[Evaluate[
Table[{{r, Re[PMP /. solution[[3]]]}}, {K2, K2values}]], {r, Rmin,
Rmax}, PlotLabel -> "Solution 3"] ;
GraphicsGrid[{{Graphics[Plot1], Graphics[Plot2], Graphics[Plot3], Column[K2values, Background -> colors]}}, Frame -> None]
Show[]
should be, what you need. $\endgroup$