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?
NDSolve
to solve the system for a fixed parameter value? $\endgroup$s1
) of the code is no problem. $\endgroup$