admin管理员组

文章数量:1287230

I am trying to solve a nonlinear system of differential equations in Wolfram Mathematica using NDSolve and visualize the solution with Manipulate. However, I encounter the following error when running the code. Interestingly, the plot still appears in the output, but the warning message also shows up. Is this normal, or is there something wrong with my Mathematica code? I suspect the issue arises because my system of equations is quite complex and nonlinear, with fractions whose denominators contain variables. Is that the main cause of this error?

This is the code that I made:

 Module[{plt1, plt2, plt3, sol, S0 = SS0, Ih0 = IhIh0, Y0 = YY0}, sol =
   sol = 
    NDSolve[{S'[t] == 
       3.5*S[t]*(1 - (S[t] + Ih[t])/50) - 1*S[t]*Ih[t] - (
        0.34*(S[t])^2*Y[t])/(S[t] + 0.1*Ih[t]),
      Ih'[t] == 
       1*S[t]*Ih[t] - (2.2*(Ih[t])^2*Y[t])/(S[t] + 0.1*Ih[t]) - 
        0.02*Ih[t],
      Y'[t] == (0.9*0.34*(S[t])^2*Y[t])/(S[t] + 0.1*Ih[t]) - (
        0.02*2.2*(Ih[t])^2*Y[t])/(S[t] + 0.1*Ih[t]) - 0.022*Y[t],
      S[t /; t <= 0] == S0, Ih[t /; t <= 0] == Ih0, 
      Y[t /; t <= 0] == Y0}, {S[t], Ih[t], Y[t]}, {t, 0, 500}];
  plt1 = 
   ParametricPlot[{t, S[t]} /. sol, {t, 0, 500}, PlotRange -> All, 
    AspectRatio -> 1, PlotStyle -> {Red, Thick}, Axes -> {t, S}];
  plt2 = 
   ParametricPlot[{t, Ih[t]} /. sol, {t, 0, 500}, PlotRange -> All, 
    AspectRatio -> 1, PlotStyle -> {Green, Thick}, Axes -> {t, Ih}];
  plt3 = 
   ParametricPlot[{t, Y[t]} /. sol, {t, 0, 500}, PlotRange -> All, 
    AspectRatio -> 1, PlotStyle -> {Blue, Thick}, Axes -> {t, Y}];
  Show[plt1, plt2, plt3, ImageSize -> {300, 300}]],
 
 Style["Persamaan differensial :", Bold],
 Style["S'= rS(1-\!\(\*FractionBox[\(S + I\), \
\(K\)]\))-\[Lambda]SI-\!\(\*FractionBox[\(\*SuperscriptBox[\(pS\), \
\(2\)] Y\), \(S + \[Alpha]I\)]\)", Bold],
 Style["I'=\!\(\*FormBox[\(\[Lambda]SI - \
\*FractionBox[\(\*SuperscriptBox[\(cI\), \(2\)] Y\), \(S + \
\[Alpha]I\)] - \[Gamma]I\),
TraditionalForm]\) ", Bold],
 Style["Y'=\!\(\*FormBox[\(\*FractionBox[\(\*SuperscriptBox[\(\[Delta]\
pS\), \(2\)] Y\), \(S + \[Alpha]I\)] - \
\*FractionBox[\(\*SuperscriptBox[\(\[Eta]cI\), \(2\)] Y\), \(S + \
\[Alpha]I\)] - dY\),
TraditionalForm]\)", Bold],
 Delimiter,
 Style["parameters", Bold, 10],
 
 Delimiter,
 Style["initial conditions", Bold, 10],
 {{SS0, 4, "S0"}, 0, 10, .01, ImageSize -> Small, 
  Appearance -> "Labeled"},
 {{IhIh0, 1, "Ih0"}, 0, 10, .01, ImageSize -> Small, 
  Appearance -> "Labeled"},
 {{YY0, 6, "Y0"}, 0, 10, .01, ImageSize -> Small, 
  Appearance -> "Labeled"},
 ControlPlacement -> Left, SynchronousUpdating -> False]```

I got the plot and error message in the output. Is it normal or or is there something wrong with my Mathematica code? How can I resolve this error and still obtain a reliable solution? Are there specific methods or options in NDSolve designed to handle stiff systems? Should I focus on adjusting and finding the right values for S0, Ih0, and Y0 to prevent the error? I have attached the plot generated from Manipulate that illustrates the problem. I would greatly appreciate any explanations and suggestions to solve this issue. Thank you very much! 

本文标签: