如何用mathematica求解变参数的常微分方程
beta*S[t]*MDt] - d*I[t] == M'[t], S[0] == 8.2, M[0] == 3.8}, {S,
M}, {t, 0, 100}]在这个函数中d的值是这么取的,当0=<t<=50时,d=0.8;当50<t<100时,d=0.4.请问应该怎么实现???? 展开
I是什么?虚数单位?还是某个函数?
输入有问题,请自己检查输入。
分段用If或者Piecewise.
非常抱歉,应该是这样的题目:r = 0.3; beta = 0.1; e = 0.2;NDSolve[{r*S[t] - beta*S[t]*M[t] + e*M[t] == S'[t],
beta*S[t]*M[t] - d*M[t] == M'[t], S[0] == 8.2, M[0] == 3.8}, {S,
M}, {t, 0, 100}]
NDSolveValue[{0.2` M[t] + 0.3` S[t] - 0.1` M[t] S[t] ==
Derivative[1][S][t], -0.8 M[t] + 0.1` M[t] S[t] ==
Derivative[1][M][t], S[0] == 8.2`, M[0] == 3.8`}, {S, M}, {t, 0,
50}]
NDSolveValue[{0.2` M[t] + 0.3` S[t] - 0.1` M[t] S[t] ==
Derivative[1][S][t], -0.4 M[t] + 0.1` M[t] S[t] ==
Derivative[1][M][t], S[0] == 8.2`, M[0] == 3.8`}, {S, M}, {t, 50,
100}]
Plot[Piecewise[{{%37[[#]][x], 0 <= x <= 50}, {%38[[#]][x],
50 < x <= 100}}] // Evaluate, {x, 0, 100}] & /@ {1, 2}
(把%37、%38换成你的输出)