2

From what I have seen, odeint seems to automatically decide what sort of algorithm it wants to use. However, the math that I am using is sufficiently finicky in converging that I want to have more control over which algorithm gets used. I've tried using ode (specifically, vode), but I'm having a hard time debugging it because of all the moving parts. I'm really not interested in taking apart all the details of the ode solver I'm using: I just want to be able to tell odeint to use one specific alogrithm and call it a day. Is this possible, or will I need to debug ode?

  • In many cases where I have seen someone do something complicated in the ODE function, a much better solution is to use an event mechanism to keep the ODE function smooth and change the model exactly (once) at the phase boundary. Second most common is something hacky to implement delays or random noise which would be better served by dedicated DDE or SDE solvers. – Lutz Lehmann Apr 19 '19 at 11:09

1 Answers1

2

LSODA method used by odeint automatically switches between Adam's method (non-stiff) and BDF (stiff) and as far as I see it does not allow to change this behaviour.

If you are looking for a solver with a similar interface but where you can explicitly choose an integration method, have a look at scipy's solve_ivp. It has an optional argument method that allows you to choose an integration method. Make sure not to choose 'LSODA' or you will get the same problem again.

astoeriko
  • 730
  • 8
  • 20