# How to address the domain of an outputed interpolating function

I am solving a system of ODEs with DSolve, which returns the results as interpolating functions. The solver always stops after some finite time because of resolution issues, so the domain of the outputted interpolating function is limited.

Hence, if I then plot those functions with a Plot command, I have to specify the range {t,0,tmax}. However tmax would change a bit everytime I run the DSolve command, and it is a pain to always change tmax manually.

Is there a way to address the domain of such a function directly?

You can get the domain of an interpolation-object quite simple.

For example the simulation timerange of

sol = NDSolveValue[{x'[t] == -x[t], x[0] == 1, WhenEvent[x[t] < .5, "StopIntegration"]}, x, {t, 0, 1}]


is

sol["Domain"][[1]]
(*{0., 0.693147}*)

• Perfect, thanks! – Britzel Mar 26 at 16:02
• You're welcome! – Ulrich Neumann Mar 26 at 16:05
• Short followup question: Is it possible to remove the { } around those two numbers in a simple way? I know I could address now each element of that list. But perhaps there is a smarter solution. – Britzel Mar 26 at 16:11
• Perhaps {t0,t1}= sol["Domain"][[1]]? – Ulrich Neumann Mar 26 at 16:18
• Suppose that works, thanks a lot! – Britzel Mar 28 at 21:04