I got a nice answer from Chris to my earlier question(though there are still some points unanswered): (In)Stability of equilibrium points depicted in a vector plot?
Now consider the following system:
$$
\begin{align}
\frac{dS}{dt} &= \nu N -\frac{\beta S I}{N} + \xi R - \nu S\\
\frac{dE}{dt} &= \frac{\beta S I}{N}- \sigma E -\nu E \\[2ex]
\frac{dI}{dt} &= \sigma E -\gamma I -\nu I \\[2ex]
\frac{dR}{dt} &= \gamma I -\xi R - \nu R
\end{align}
$$
where $N = S + E + I + R$ is the total population.
If we apply the same technique we have:
r := 1 - s - e - i;
SetModel[{
Pop[pop] -> {
Component[s] -> {Equation :> ξ + ν - ξ e - ξ i - β s i - ξ s - ν s},
Component[e] -> {Equation :> β s i - σ e - ν e },
Component[i] -> {Equation :> σ e - γ i - ν i }
},
Parameters :> {β > 0, γ > 0, ξ > 0, σ > 0, ν > 0}
}]
eq = SolveEcoEq[]
Which is fine. Now I want to do the following;
β = 0.7; γ = 0.3; σ = 0.3; ξ = 0.4; ν = 0.3;
eq = SolveEcoEq[]
N[EcoEigenvalues[eq[[2]]]]
Show[PlotEcoPhasePlane[{s, 0, 2}, {e, -0.6, 1}],
RuleListPlot[eq, PlotMarkers -> EcoStableQ[eq]]]
Our system is 3 dimensional so how would I plot phase planes for say $s$ vs $i$ or $s$ vs $e$ etc? What about initial conditions for the phase portraits?
EDIT:
The paper:
https://www.mdpi.com/2227-7390/5/1/7/htm
Hopefully you can recreate the results!
My code for ODE solution:
tmax = 100;
\[Beta] = 4;
\[Sigma] = 1/3;
\[Gamma] = 1/7;
b = (1.9/100)/365;
d = (0.8/100)/365;
\[Alpha] = 1/14;
\[Nu] = 0.8;
\[Rho] = 0.5;
SExPRS = NDSolveValue[{
S'[t] == \[Alpha] +
b (1 - \[Nu]) - \[Alpha]*Ex[t] - \[Alpha]*P[t] - \[Beta]*S[t]*
P[t] - (b + \[Rho] + \[Alpha])*S[t],
Ex'[t] == \[Beta]*S[t]*P[t] - (b + \[Sigma])*Ex[t],
P'[t] == \[Sigma]*Ex[t] - (b + \[Gamma])*P[t],
S[0] == 0.25,
Ex[0] == 0.25,
P[0] == 0.25},
{S, Ex, P},
{t, 0, tmax}];
{f1, f2, f3} = SExPRS;
st = Style[#, 15, Black] &;
Plot[{f1[t], f2[t], f3[t], 1 - f1[t] - f2[t] - f3[t], 1, 0}, {t, 0,
tmax}, PlotStyle -> {Blue, Orange, Red, Green,
Directive[Black, Dashed], Directive[Black, Dashed]}, Frame -> True,
FrameLabel -> st /@ {"Time", "Density"},
PlotLegends ->
Placed[LineLegend[{Blue, Orange, Red, Green, Black}, {"S(t)",
"E(t)", "I(t)", "R(t)" }, LegendFunction -> Framed], {0.85,
0.44}], ImageSize -> 500]
Compared to your eco package:
r := 1 - s - e - i;
SetModel[{Pop[
pop] -> {Component[
s] -> {Equation :> \[Xi] + \[Nu] (1 -
c) - \[Xi] e - \[Xi] i - \[Beta] s i - \[Xi] s - \[Nu] s \
- \[Rho] s},
Component[
e] -> {Equation :> \[Beta] s i - \[Sigma] e - \[Nu] e },
Component[
i] -> {Equation :> \[Sigma] e - \[Gamma] i - \[Nu] i }},
Parameters :> {\[Beta] > 0, \[Gamma] > 0, \[Xi] > 0, \[Sigma] >
0, \[Nu] > 0, \[Rho] > 0, c > 0}}]
eq = SolveEcoEq[]
\[Beta] = 4; \[Gamma] = 1/7; \[Sigma] = 1/3; \[Xi] =
1/14; c = 0.8; \[Nu] = (1.9/100)/365; \[Rho] = 0.5;
eq = SolveEcoEq[]
N[EcoEigenvalues[eq[[2]]]]
Show[PlotEcoPhasePlane[{s, 0, 1}, {i, 0, 1},
Fixed -> {e -> \[Sigma]}],
RuleListPlot[eq, PlotMarkers -> EcoStableQ[eq]]]
sol = EcoSim[{s -> 0.25, e -> 0.25, i -> 0.25}, 90];
PlotDynamics[sol]
An example of $e$ plotted against $i$:
:>
, not->
afterEquation
inSetModel
. $\endgroup$