# Integrating a dynamical system until an algebraic condition is satisfied

I have a model given by a system of differential equations

$$\frac{dy}{dt}=f(y)$$

with $y=(y_1,y_2,y_3)$ and $f:\mathbb{R}^3 \to \mathbb{R}^3$. The system works as follows : integrate the ode's with initial values $(y_1^0,y_2^0,y_3^0)$ until $y_1$ reaches a certain value (say $y_1=0$), get the time $t_f$ when this happens and start again with the initial values $(y_1^0 ,y_2^0, y_3(t_f))$. All this until some stopping condition is encountered.

My question is : what software can be used to simulate such a system? It would be preferable to be open source, but any suggestion is welcomed.

• I'd implement this in MATLAB using the ODE events framework. Have a look at odeset and event locations. If you do not have MATLAB installed, try the open-source octave and its odepkg package. More info here. – GoHokies Apr 22 '16 at 9:09