I am working with a complex set of two differential equations with many parameters. A simplified minimal working example would be the following system:
$$x'[t]=x^2[t]+y[t]+b$$ $$y'[t]=x[t]+y^2[t]-a$$
,where $a\in [0,1]$ and $b\in [0,1]$ are two parameters.
Now, depending on parameters the system may have 0,1 or 2 fixed points. What I want to do is Regionplot/Contourplot the parameterspace $[0,1]$x$[0,1]$ and shade regions/plot the boundary of regions for which there exist a different number of equilibria.
What I started with is plotting the nullclines as well as computing the fixed points of the system. I could just count the number of fixed points but I dont know how much that will help.
a = 0.5;
b = 0.5;
eq1=x^2 + y + b;
eq2=x + y^2 - a;
ContourPlot[{eq1 == 0, eq2 == 0}, {x, -3, 3}, {y, -3,
3}, ContourStyle -> {Red, Blue}, ImageSize -> Scaled[0.3],
PlotLegends ->
LineLegend[{"\!\(\*SubscriptBox[\(\[PartialD]\), \(t\)]\)x=0",
"\!\(\*SubscriptBox[\(\[PartialD]\), \(t\)]\)y=0"}],
FrameLabel -> {x, y}]
a = NSolve[{eq1 == 0 && eq2 == 0 }, {x, y}, Reals]
Length[a]
Ideally, I would like to end up with a plot similar to the following, where either regions are shaded or the boundary-line is plotted:
Edit: I want to emphasize that I am looking for numerical methods for a more complex problem.
Here is my current code, which works but still has 2 major issues:
1.I was only able to ListPlot3D the list and I would like to have a 2D projection of the data.
2.Empty sets, i.e. parameter configurations for which there exist no fixed point are still counted. I would like to get rid of those entries, while still preserving the value 0 in the plot.
eq1 = x^2 + y + b;
eq2 = x + y^2 - a;
c = Table[{a, b, x} /.
NSolve[{eq1 == 0 && eq2 == 0 }, {x, y}, Reals], {a, 0, 1,
0.005}, {b, 0, 1, 0.005}];
d = Flatten[Map[Length, c, {2}]];
e = Table[{a, b}, {a, 0, 1, 0.005}, {b, 0, 1, 0.005}];
f = Flatten[e, 1];
g = Flatten[Riffle[f, d]];
par = Partition[g, 3];
ListPointPlot3D[par, ColorFunction -> "Rainbow", Boxed -> False,
Axes -> {True, True, False}, ViewPoint -> {0, 0, 250},
PlotLegends -> SwatchLegend[{Red, Blue}, {0, 2}]]
a
has two meanings, which is usually a bad idea. $\endgroup$