I stumbled upon a problem while reproducing some numerical solution of MATLAB (ode45) in Python (using solve_ivp) using the default Abstol (1e-6) and Reltol (1e-3) for both cases. And to my surprise for a particular case the solution computed in MATLAB and Python does not match. Each function uses (RK4(5)), all other parameters, initial condition are same, and both solutions look a valid solution, as they converge to a solution of periodic orbit but of different kind. As I plotted a variable for the whole-time length in Python, I found the trajectory is making many rounds near two regions, and I suspect one them is the solution computed by MATLAB. What exactly is going on here? Are there two co-existing solutions? How can I can correctly tell which one is correct? My system is a coupled non-linear set of ordinary differential equations. Any comment, suggestion in this regard will be appreciated.

I am attaching a few figures that I obtained in MATLAB as well as Python herewith.

More Rebeka Sarkar's questions See All
Similar questions and discussions