I have an ODE (for a phase space density) with a physical interpretation where the values should always be non-negative. Unfortunately, solve_ivp uses large enough timesteps such that the values become negative. Forcing small timesteps would lead to a huge increase in computation time. So I'm looking for other ways to enforce the nonnegativity:
- I looked at solve_bvp, but it seems like it can only enforce some linear S*y = 0 and not y > 0
- Is there a way to change which steps in the solve_ivp integration are accepted/discarded?
- Alternatively, is there a way to adapt the step size when the values are close to zero?
Thanks for any help,
Nik