To solve a system of ODEs, I need internal calculations of past time steps, so I have to save these internal calculations. I cannot save every calculation because of dynamic time step size of the solver. The event function doesn't help me either, because events only receives (t, y) input, but my internal data is a function of (t,y), f(t, y). Is there an elegant solution to save internal parameters when the solver has calculated a solution and not an internal calculation?