# Solve discontinuous ODE with lsode

I am trying to solve a discontinuous ODE using the lsode solver. I tried setting the t_crit parameter to specify the time where the discontinuity is present, but it didn't help.

The analytical solution of the ODE looks like the following, where the discontinuity appears at $$t = -0.433$$, which is the value I set to the t_crit parameter of lsode. Is there any strategy to tackle this kind of situations with lsode?

Please note that I am restricted to using lsode as the solver.

If you speak of discontinuous ODE, one would think of a discontinuous right side function. If the discontinuity is only a jump, and only depends on time, then using the t_crit parameter will divide the integration into two pieces there, each piece a well-defined integration task.
What you have here is a singularity in the ODE. One strategy to integrate over the end of the solution is to divide the ODE into a system for the parts of the fraction $$y=\frac{u}{v}$$, where the system for $$(u,v)$$ is not singular.
Example: The model Riccati equation $$y'=x^2+y^2$$. Inserting the fraction gives $$u'v-uv'=x^2v^2+u^2\\ \iff (u'-x^2v)v=u(v'+u)$$ The non-trivial (and only) case is for the linear system $$u'=x^2v\\ v'=-u$$ This has continuous coefficients, can thus be integrated without bounds. The singularity of the original equations occurs at the roots of $$v$$.