EDIT: typo spotted in comments, code reposted with fix as well as new behavior
I'm having trouble getting mathematica to give me a working plot. I've defined specific values for my parameters:
b = 0.1372;
g = 1/7;
soln = NDSolve[{X'[t] + b*X[t]*Y[t]/2700000 == 0,
Y'[t] - b*X[t]*Y[t]/2700000 + g*Y[t] == 0, Z'[t] - g*Y[t] == 0,
X[0] == 2700000 - Y[0], Y[0] == b*2700000, Z[0] == 0}, {X, Y,
Z}, {t, 0, 180}, MaxSteps -> Infinity];
Plot[{Evaluate[X[t] /. soln], Evaluate[Y[t] /. soln],
Evaluate[Z[t] /. soln]}, {t, 0, 180}, PlotRange -> {0, 3000000},
PlotLabels -> {"S", "I", "R"}]
and got a good plot. I tried to scale this up for manipulate:
ClearAll;
soln = ParametricNDSolve[
{
X'[t] + b*X[t]*Y[t]/2700000 == 0,
Y'[t] - b*X[t]*Y[t]/2700000 + g*Y[t] == 0,
Z'[t] - g*Y[t] == 0,
X[0] == 2700000 - Y[0],
Y[0] == b*2700000,
Z[0] == 0
},
{{X[t], Y[t], Z[t]}},
{t, 0, 500},
{b, g}];
Manipulate[
ParametricPlot[
soln[b, g],
{t, 0, 500},
PlotRange -> {0, 3000000}
],
{b, 0.01, .999},
{g, 0.01, .999}
]
and nothing fruitful came out. The sliders show up, but the plot window is highlighted red, and I get error output:
ParametricNDSolve::dspar: 1 cannot be used as a parameter.
ParametricNDSolve::dspar: 1.` cannot be used as a parameter.
ParametricNDSolve::dspar: 1 cannot be used as a parameter.
General::stop: Further output of ParametricNDSolve::dspar will be suppressed during this calculation.
ParametricNDSolve
and notParamatricNDSolve
and see if that works. When the color is blue it means Mathematica does not know about it. $\endgroup$