NDSolve typically returns an interpolation function, which you can then build a table of values from.
However, if I only need a pre-determined set of discrete time steps, can I just directly obtain these from NDSolve without building the interpolating function?
Presumably if i do
state = NDSolve`ProcessEquations[ <stuff>, t ];
NDSolve`Iterate[state, 1 ] (* iterates from t=0 out to t=1 *)
then i already have a list of discrete values stored somewhere in “state”, and I don’t need to do
NDSolve`ProcessSolutions[state]
Any ideas on how to do this? I just want a list of values, say at t={0,0.2,.0,4,0.6,0.8,1}, for example.
Try to use “EventLocator” method for NDSolve (or WhenEvent[] option).
Here is an example with “EventLocator” (for some reason values at 0. are not catched):
Ok, thanks a lot. It turns out this is actually slower (about a factor of ten) than just Threading the interpolation function NDSolve gives you over a list of times. But I learned a lot from your example.