0
$\begingroup$

I have code from question 96004, and I made same changes:

s1 = ParametricNDSolveValue[{D[r[t], t, 
       t] - μ r[t] (r[t] + μ)^2 == 0, D[θ[t], t] == 1, 
    r[0] == 1, θ[0] == 1}, {r[t] Cos[θ[t]], r[t] Sin[θ[t]]}, {t, 0, 
    100}, {μ}, MaxSteps -> ∞];
coll = {};
Table[pp = 
   ParametricPlot[Through[s1[a][t]], {t, 0, 100}, 
    PlotRange -> {{-4, 4}, {-4, 4}}, PerformanceGoal -> "Quality", 
    MeshFunctions -> (#2 &), Mesh -> {{0.}}, 
    MeshStyle -> {Red, PointSize[0.02]}];
  pts = pp[[1, 1]];
  AppendTo[
   coll, {a, #[[1]]} & /@ 
    pts[[First@Cases[pp[[1]], Point[x__] :> x, -1]]]];, {a, -1, -0.5, 
   0.005}];
lp = ListPlot[Join @@ coll, Frame -> True, PlotStyle -> Red];
Manipulate[
 Column[{ParametricPlot[Through[s1[τ][t]], {t, 0, 100}, 
    PlotRange -> {{-4, 4}, {-4, 4}}, PerformanceGoal -> "Quality", 
    MeshFunctions -> (#2 &), Mesh -> {{0.}}, 
    MeshStyle -> {Red, PointSize[0.02]}, Frame -> True], 
   Show[lp, 
    Graphics[{Gray, 
      Line[{{τ, -2}, {τ, 2}}]}]]}], {τ, -1, -0.5, 
  0.01}]

In the original question the differential equation is second order. I found the code doesn't work for first order differential equation. Could someone tell me how to change the above code?

$\endgroup$
  • $\begingroup$ What changes have you made? What are you trying to achieve? $\endgroup$ – MarcoB Apr 8 at 14:40
  • $\begingroup$ Before attempting the bifurcation diagram, can you get NDSolve to solve the system for a fixed parameter value? $\endgroup$ – Chris K Apr 8 at 14:42
  • $\begingroup$ I just change the two order differential equation in the original code to the first order differential equation. And I want to plot the bifurcation diagram as ubpdqn(the third answer) do $\endgroup$ – 郑新然 Apr 9 at 0:33
  • $\begingroup$ I can get the parametric solve of the system and I can get the phase diagram. In other words, I think the first step (s1) of the code is no problem. $\endgroup$ – 郑新然 Apr 9 at 0:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.