What is a better way to code using Mathematica in my answer in order to visualize a dynamic situation between given $(x,y)$ field limits for several starting curves/points?
I shall link your replies there.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityWhat is a better way to code using Mathematica in my answer in order to visualize a dynamic situation between given $(x,y)$ field limits for several starting curves/points?
I shall link your replies there.
Update: You can control (move / remove / add) initial values dynamically using Locator
s as in, for example, this answer.
tm = 15;
EQ1[a_, b_] := {X'[t] == X[t] (1 - Y[t]), Y'[t] == 1 + Y[t] (X[t] - 1),
X[0] == a, Y[0] == b};
pf = ParametricNDSolveValue[EQ1[a, b], {X, Y}, {t, 0, tm}, {a, b}];
ab = {{- 0.4, 2.75}, {-.2, 4}, {4.4, 3.75}};
manipulate = Manipulate[
ParametricPlot[Evaluate[Table[Through@pf[a[[1]], a[[2]]][t], {a, u}]], {t, 0, tm},
GridLines -> Automatic, AspectRatio -> 1, PlotRange -> All,
BaseStyle -> Thick, Frame -> True,
Epilog -> ListPlot[{Labeled[#, Style[#, 16, "Panel"]]} & /@ u,
PlotStyle -> PointSize[Large]][[1]]],
{{u, ab}, Locator, Appearance -> None, LocatorAutoCreate -> True}];
Evaluate the following line in place, i.e. highlight it and use Ctrl+Shift+Enter
DynamicSetting[manipulate]
To print the current snapshot in the next cell use Shift+Enter
:
Original answer:
You might find ParametricNDSolveValue convenient:
tm = 10;
EQ1[a_, b_] := {X'[t] == X[t] (1 - Y[t]), Y'[t] == 1 + Y[t] (X[t] - 1),
X[0] == a, Y[0] == b};
pf = ParametricNDSolveValue[EQ1[a, b], {X, Y}, {t, 0, tm}, {a, b}];
ab = {{- 0.4, 2.75}, {-.2, 4}, {4.4, 3.75}};
ParametricPlot[Evaluate[Table[Through @ pf[a[[1]], a[[2]]][t], {a, ab}]], {t, 0, tm},
GridLines -> Automatic, AspectRatio -> 1, PlotRange -> All, BaseStyle -> Thick,
Epilog -> ListPlot[Labeled[#, Style[#, 16, "Panel"]] & /@ ab,
PlotStyle -> PointSize[Large]][[1]]]
colors = Partition[ColorData[63, "ColorList"][[;; 6]], 2];
Table[cf[ab[[i]]] = colors[[i]], {i, Length@ab}];
Show[Table[Plot[Evaluate[Through@pf[a[[1]], a[[2]]][t]], {t, 0, tm},
BaseStyle -> Thick, PlotStyle -> cf[a],
PlotLegends -> (TraditionalForm /@ ({X[##][t], Y[##][t]} & @@ a))], {a, ab}]]