This is a repost of a question I posted on MathOverflow, but was suggested to post here due to relevance.
I am trying to reproduce Figure 1 in the paper "Chaos in learning a simple two-person game" (English) Proc. Natl. Acad. Sci. USA 99, No. 7, 4748-4751 (2002) (MR1895748, Zbl 1015.91014), by Sato, Akiyama, and Doyne Farmer, showing the Poincare section of a two-player replicator dynamics in rock-paper-scissors game.
I am not able to reproduce the clean, axis aligned orbits. I'm not sure if this is happening because I'm not using a fourth order symplectic integrator or because of some other issue in my code. My code is available here. Any help would be greatly appreciated! For comparison, you can see below the relevant figures:
Edit My code was incorrectly computing $y^{\top} A x$ as $x^{\top} A y$, and the step-size was set too high, as per the comments by Lutz Lehmann below. Fixing these problems results in the following image:
xTAy
is correctly computed? The.dot
method can be strange if not used for scalar products, I would not be surprised if the result wasyTAx
. Better, more explicit, would bex.T @ A @ y
but atm I'm not sure how arrays translate to column vectors, so that might also not work as expected. // Or use the products in the next lines,xTAy = x.dot(Ay)
. $\endgroup$dt = 2
might be too coarse to approximate the Poincaré points by linear interpolation, making the image fuzzy. You might even miss some intersections because the solution crosses the plane twice on the segment? The better variant, but probably slower, is to usesolve_ivp
withsection_condition
as event function. Then you can also prescribe the crossing direction, so that you only get one shape instead of two. $\endgroup$