I have a system of differential equations :
$\frac{dX}{dt} = (0.8+0.4c_{1})X-(0.007+0.006c_{2})XY$ and
$\frac{dY}{dt} = (0.048+0.004c_{3})XY-(0.4+0.2c_{4})Y$
where $0\le c_{i}\le1$.
Varying $c_{i}$ gives me an envelope of solutions for both $X(t)$ and $Y(t)$. My goal is to find the combination of $c_{i}$ which gives the upper and lower limits of my solution.
Taking $c_{i}$ as discrete points between 0 and 1 with step size 0.1, I used the following code to obtain a solution, and managed to plot it.
sol = ParametricNDSolve[{x'[t] == (0.8 + 0.4 c1) x[t] - (0.007 + 0.006 c2) x[t] y[t],y'[t] == (0.0048 + 0.0004 c3) x[t] y[t] - (0.4 + 0.2 c4) y[t], x[0] == 200, y[0] == 80}, {x, y}, {t, 0, 50}, {c1, c2, c3, c4}]
xt = Flatten[Evaluate[Table[x[c1, c2, c3, c4][t] /. sol, {c1, 0, 1, 0.1}, {c2, 0, 1,0.1}, {c3, 0, 1, 0.1}, {c4, 0, 1, 0.1}]]];
mat = Table[Table[Evaluate[xt[[a]]], {t, 0, 25, 0.01}], {a,Range[Length[xt]]}];
l = Min /@ Transpose[mat];
m = Max /@ Transpose[mat];
ind = Range[0, 25, 0.01];
lupd = Transpose[{ind, l}];
mupd = Transpose[{ind, m}];
ListLinePlot[{lupd, mupd},GridLines -> Automatic, ImageSize -> {600, 300}]
The plot for $X(t)$ came as The plot for $Y(t)$ came as Edit 3
It is not possible to calculate the equation of the upper curve of the envelope obtained by varying $c_{i}$s. Hence, I reworked my question.
Consider the following code fragment
Plot[Evaluate@({x[1, 0, 0, 1][t], x[0, 1, 1, 1][t], x[0, 0, 0, 0][t],
x[0.8, 0, 0, 0.2][t]} /. sol), {t, 0, 25}]
This gives 4 different trajectories for $X(t)$.
Consider the line $t=12$. As it cuts the enevelope, we get a minimum point and a maximum point.
I would like the combination of $c_{i}$ that give this maximum and minimum points for $t=1,2,3,...,25$.
In my solution I used Max
and Min
to extract these maximum and minimum points and then plotted them. I could not get the combination of $c_{i}$ for each of these points.