1
$\begingroup$

I am running local analyses on the critical points of the system of ODE below:

eq1 = -s1 + (1 - x1)*(1 - s1)*(a0*a4)/(1 - s1 + a1); eq2 = (1 - x1)*(a8 + a9 - (a0*(1 - s1))/(1 - s1 + a1)); eq3 = -s2 - (1 - x1)*(1 - s1)*(a0*a5)/(1 - s1 + a1) + (1 - x2)*(1 - s2)*(a2*a6)/(1 - s2 + a3 + a7*(1 - s2)^2); eq4 = (1 - x2)*(a8 + a10 - (a2*(1 - s2))/(1 - s2 + a3 + a7*(1 - s2)^2)); 

There are 6 critical points, and two of them (CP3 and CP6) are supposed to be asymptotically stable. I got nice plots ie phase portraits and time series for the first two critical points, but CP3 onwards are giving me grief. I either get a plot where the trajectories do not scale nicely or I get plots where there are empty areas where there should be trajectories.

phase portrait of s1-x1 but all the arrows are red and scaled wrong

I tried increasing the plot range in case there’s a bigger pattern I’m not capturing… I tried decreasing the plot range in case my plot weren’t “local” enough… I also tried different ways to define my vectors and arrows.

I'm not sure if the problem is because the ODE system itself is not behaving or because my code needs to be fixed. Here's the current version of my code:

params = {a0 -> 20.97055105, a1 -> 0.021621597, a2 -> 1.963662112, a3 -> 1.217960436, a4 -> 0.01100415, a5 -> 0.016340502, a6 -> 32.71694378, a7 -> 2.907136946, a8 -> 0.148074792, a9 -> 1.599070101, a10 -> 0.069124399,a11 -> 137.1688473}; rule = Solve[{eq1, eq2, eq3, eq4} == 0, {s1, s2, x1, x2}]; cplst = {{s1, x1}, {s2, x2}} /. rule /. params; cp03 = cplst[[3]] (*{{0.998034892335493, -50.911108178852665}, {-1.6050719877417985, 1.0173161380903484}} *) {{s1valcp3, x1valcp3}, {s2valcp3, x2valcp3}} = cp03; (* Phase Portrait for (s1,x1) *) s1rangecp3 = {0.95, 1.05};(* Centered around s1=1 *) x1rangecp3 = {-50.95, -50.85}; (* Centered around x1=-51 *) (* Define vector field*) vecField = {eq1, eq2} /. params; (* Plot phase portrait *) StreamPlot[vecField, {s1, s1rangecp3[[1]], s1rangecp3[[2]]}, {x1, x1rangecp3[[1]], x1rangecp3[[2]]}, StreamPoints -> Fine, StreamStyle -> Arrowheads[0.015], StreamColorFunction -> Function[{x, y, vx, vy}, ColorData["Rainbow"][Rescale[Sqrt[vx^2 + vy^2], {0, 5}]]], StreamColorFunctionScaling -> False, PlotLabel -> Style["Critical Point 3: (s1, x1) Phase Portrait", 14, Bold], Epilog -> {Red, PointSize[Large], Point[{s1valcp3, x1valcp3}]}, FrameLabel -> {"s1", "x1"}, ImageSize -> Large] 

I got a slightly better phase portrait after editing my code but I'm still not seeing asymptotically stable behavior. How can I fix this?

Thanks in advance.

$\endgroup$
14
  • 2
    $\begingroup$ For some reason, StreamPlot[] does not deal with domains that do not have a natural aspect ratio near 1. Probably, at least in part, because it uses Euclidean distance, You could rescale the ODE so that the change in x1 and the change in s1 over the plot domain are about equal. $\endgroup$ Commented Jun 28 at 16:21
  • 3
    $\begingroup$ Note: Your code is incomplete, so it's impossible to verify proposed fixes or demonstrate how to code them. An MWE is preferable. $\endgroup$ Commented Jun 28 at 16:24
  • $\begingroup$ Hi @MichaelE2 this is actually my first time asking a question (despite having lurked here for a while) and the process to submit a question is definitely not newbie friendly compared to other forums. I was having trouble even to get those codes past the submission checker. Let me try to post a screenshot of the other portions of my code, brb and thanks! $\endgroup$ Commented Jun 29 at 4:42
  • $\begingroup$ I'm sorry you're having trouble posting the code. It's happened before, due to an auto-check that prevents newbie code-only posts. Obviously, it's messing up here. I'm afraid I don't know how to fix it. I believe there's a "flag" button beneath your question. Maybe you could flag it and indicate you're having trouble posting the code. A mod might be able to help you. You could paste the code into something like pastebin.com and put a link to the code in your question. I did it here for example. $\endgroup$ Commented Jun 29 at 5:19
  • $\begingroup$ Oh I didn't know the submission checker is so demanding these days. 1. If I read it right, currently only params, cp03 and s1valcp3 and x1valcp3 are missing, which aren't too long. You can post them in the comment, then we can help adding them to the body of question. 2. How do you find out cp03? $\endgroup$ Commented Jun 29 at 12:28

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.