Handle exception with the problem interface of DifferentialEquations


I have an ODE problem with multiple callbacks (continuous and discrete ones). For some initial conditions, the computation of the right hand side will return an ArgumentError, is it possible to use the function terminate inside the right hand side to kill the resolution of the ODE problem as soon as the exception ArgumentError pops up?

No you can’t, but the bigger question is, why are you getting an ArgumentError?

Are Callback conditions checked once the whole right hand side is constructed?

I don’t understand the question.

Let’s imagine that I have a state vector R of dimension 2 and a callback with a condition on R[1]. Can I construct dR[1], then test the condition associated with the callback before to construct the dR[2]. Or do I have to construct dR[1:2] before the callback’s condition is tested?

No, temporally it doesn’t work out since the callback is called after multiple f calls.