I'm interested in carrying out stability analysis on discrete dynamic systems, as was done in this paper. The Author used their function TwoDimensionalStability[x^2 + 3 x y, y^2 - 2 x y]
to look for stability properties. The output was:
The fixed point {− 2/7 , 3/7} is saddle
The fixed point {0, 1}is source
The fixed point {1, 0} is oscillatory source
The fixed point{0, 0}is Stable sink
I tried to run their code in my Mathematica 12 but I only ever got this:
Out[109]=TwoDimensionalStability[2 x^2 + 3 xy, 0.315165 - 2 xy]
Here is the code from the paper I mentioned above:
TwoDimensionalStability[f , g ]:=Module[{cz, czm, F, G, J, A, l},cz = Solve[{f == x, g == y}, {x, y}]; czm = {x, y}/.cz; F [u , v ]:=f /.x → ucz = Solve[{f == x, g == y}, {x, y}]; czm = {x, y}/.cz; F [u , v ]:=f /.x → ucz = Solve[{f == x, g == y}, {x, y}]; czm = {x, y}/.cz; F [u , v ]:=f /.x → u/.y → v; G[u , v ]:=g/.x → u /.y → v;/.y → v; G[u , v ]:=g/.x → u /.y → v;/.y → v; G[u , v ]:=g/.x → u /.y → v;J[{u , v }] = D[{F [u, v], G[u, v]}, {{u, v}}]; l = Length[czm];J[{u , v }] = D[{F [u, v], G[u, v]}, {{u, v}}]; l = Length[czm];J[{u , v }] = D[{F [u, v], G[u, v]}, {{u, v}}]; l = Length[czm];If[l==0, Print[“No fixed point”], Do[If[Im[First[Eigenvalues[J[czm[[i]]]]]]==0,If[l==0, Print[“No fixed point”], Do[If[Im[First[Eigenvalues[J[czm[[i]]]]]]==0,If[l==0, Print[“No fixed point”], Do[If[Im[First[Eigenvalues[J[czm[[i]]]]]]==0,If[−1 < Max[Eigenvalues[J[czm[[i]]]]] < 1&& − 1 < Min[Eigenvalues[J[czm[[i]]]]] < 1,If[−1 < Max[Eigenvalues[J[czm[[i]]]]] < 1&& − 1 < Min[Eigenvalues[J[czm[[i]]]]] < 1,If[−1 < Max[Eigenvalues[J[czm[[i]]]]] < 1&& − 1 < Min[Eigenvalues[J[czm[[i]]]]] < 1,Print[“The fixed point” , czm[[i]], “is Stable sink”],Print[“The fixed point” , czm[[i]], “is Stable sink”],Print[“The fixed point” , czm[[i]], “is Stable sink”],Which[Max[Eigenvalues[J[czm[[i]]]]] > 1&&0 < Min[Eigenvalues[J[czm[[i]]]]] < 1,Which[Max[Eigenvalues[J[czm[[i]]]]] > 1&&0 < Min[Eigenvalues[J[czm[[i]]]]] < 1,Which[Max[Eigenvalues[J[czm[[i]]]]] > 1&&0 < Min[Eigenvalues[J[czm[[i]]]]] < 1,Print[“The fixed point”, czm[[i]], “ is saddle”],Print[“The fixed point”, czm[[i]], “ is saddle”],Print[“The fixed point”, czm[[i]], “ is saddle”],−1 < Max[Eigenvalues[J[czm[[i]]]]] < 0&&Min[Eigenvalues[J[czm[[i]]]]] < −1,−1 < Max[Eigenvalues[J[czm[[i]]]]] < 0&&Min[Eigenvalues[J[czm[[i]]]]] < −1,−1 < Max[Eigenvalues[J[czm[[i]]]]] < 0&&Min[Eigenvalues[J[czm[[i]]]]] < −1,Print[“The fixed point”, czm[[i]] , “is oscillatory saddle”],Print[“The fixed point”, czm[[i]] , “is oscillatory saddle”],Print[“The fixed point”, czm[[i]] , “is oscillatory saddle” ,
Min[Eigenvalues[J[czm[[i]]]]] > 1, Print[“The fixed point”, czm[[i]] , “is source”],Min[Eigenvalues[J[czm[[i]]]]] > 1, Print[“The fixed point”, czm[[i]] , “is source”],Min[Eigenvalues[J[czm[[i]]]]] > 1, Print[“The fixed point”, czm[[i]] , “is source”],Min[Eigenvalues[J[czm[[i]]]]]== − 1&&Max[Eigenvalues[J[czm[[i]]]]] < 1,Min[Eigenvalues[J[czm[[i]]]]]== − 1&&Max[Eigenvalues[J[czm[[i]]]]] < 1,Min[Eigenvalues[J[czm[[i]]]]]== − 1&&Max[Eigenvalues[J[czm[[i]]]]] < 1,Print[“Try to use Center manifold module for ”, czm[[i]]],Print[“Try to use Center manifold module for ”, czm[[i]]],Print[“Try to use Center manifold module for ”, czm[[i]]],Min[Eigenvalues[J[czm[[i]]]]]==1, Print[“The fixed point”, czm[[i]], “is unstable”],Min[Eigenvalues[J[czm[[i]]]]]==1, Print[“The fixed point”, czm[[i]], “is unstable”],Min[Eigenvalues[J[czm[[i]]]]]==1, Print[“The fixed point”, czm[[i]], “is unstable”],Max[Eigenvalues[J[czm[[i]]]]] == −1, Print[“The fixed point”, czm[[i]], “is unstable”],Max[Eigenvalues[J[czm[[i]]]]] == −1, Print[“The fixed point”, czm[[i]], “is unstable”],Max[Eigenvalues[J[czm[[i]]]]] == −1, Print[“The fixed point”, czm[[i]], “is unstable”],Max[Eigenvalues[J[czm[[i]]]]]==1&&Min[Eigenvalues[J[czm[[i]]]]] < −1,Max[Eigenvalues[J[czm[[i]]]]]==1&&Min[Eigenvalues[J[czm[[i]]]]] < −1,Max[Eigenvalues[J[czm[[i]]]]]==1&&Min[Eigenvalues[J[czm[[i]]]]] < −1,Print[“The fixed point”, czm[[i]], “is unstable”],Print[“The fixed point”, czm[[i]], “is unstable”],Print[“The fixed point”, czm[[i]], “is unstable”],Min[Eigenvalues[J[czm[[i]]]]] == −1&&Max[Eigenvalues[J[czm[[i]]]]] > 1,Min[Eigenvalues[J[czm[[i]]]]] == −1&&Max[Eigenvalues[J[czm[[i]]]]] > 1,Min[Eigenvalues[J[czm[[i]]]]] == −1&&Max[Eigenvalues[J[czm[[i]]]]] > 1,Print[“The fixed point”, czm[[i]], “is unstable”],Print[“The fixed point”, czm[[i]], “is unstable”],Print[“The fixed point”, czm[[i]], “is unstable”],Max[Eigenvalues[J[czm[[i]]]]]==1&&Min[Eigenvalues[J[czm[[i]]]]] > −1,Max[Eigenvalues[J[czm[[i]]]]]==1&&Min[Eigenvalues[J[czm[[i]]]]] > −1,Max[Eigenvalues[J[czm[[i]]]]]==1&&Min[Eigenvalues[J[czm[[i]]]]] > −1,Print[“Try to use Center manifold module for ”, czm[[i]]],Print[“Try to use Center manifold module for ”, czm[[i]]],Print[“Try to use Center manifold module for ”, czm[[i]]],Max[Eigenvalues[J[czm[[i]]]]] > 1&&Min[Eigenvalues[J[czm[[i]]]]] < −1,Max[Eigenvalues[J[czm[[i]]]]] > 1&&Min[Eigenvalues[J[czm[[i]]]]] < −1,Max[Eigenvalues[J[czm[[i]]]]] > 1&&Min[Eigenvalues[J[czm[[i]]]]] < −1,Print[“The fixed point”, czm[[i]] , “ is oscillatory source”]]],Print[“The fixed point”, czm[[i]] , “ is oscillatory source”]]],Print[“The fixed point”, czm[[i]] , “ is oscillatory source”]]],Which[Abs[First[Eigenvalues[J[czm[[i]]]]]] < 1, Print[“The fixed point”, czm[[i]],Which[Abs[First[Eigenvalues[J[czm[[i]]]]]] < 1, Print[“The fixed point”, czm[[i]],Which[Abs[First[Eigenvalues[J[czm[[i]]]]]] < 1, Print[“The fixed point”, czm[[i]],“ is spiral sink”], Abs[First[Eigenvalues[J[czm[[i]]]]]]==1, Print[“ is spiral sink”], Abs[First[Eigenvalues[J[czm[[i]]]]]]==1, Print[“ is spiral sink”], Abs[First[Eigenvalues[J[czm[[i]]]]]]==1, Print[“The fixed point” , czm[[i]] , “is Center”], Abs[First[Eigenvalues[J[czm[[i]]]]]] > 1,“The fixed point” , czm[[i]] , “is Center”], Abs[First[Eigenvalues[J[czm[[i]]]]]] > 1,“The fixed point” , czm[[i]] , “is Center”], Abs[First[Eigenvalues[J[czm[[i]]]]]] > 1,Print[“The fixed point”, czm[[i]], “ is spiral source”]]], {i, 1, l}]]]Print[“The fixed point”, czm[[i]], “ is spiral source”]]], {i, 1, l}]]]Print[“The fixed point”, czm[[i]], “ is spiral source”]]], {i, 1, l}]]]
I don't know why it doesnt work
because there is no such command in Mathematica. May be the authors used a package or their own code? Try to look at book/paper website and see if they have the code there. I see now they have the code listed in the paper itself. May be you can copy it from the pdf? $\endgroup$TwoDimensionalStability
is found in that paper. Please include it in your question. $\endgroup$xy
should bex*y
or at leastx y
(with a space) -- otherwise Mathematica thinksxy
is a single variable. $\endgroup$