I am a bit confused about the timepoints that the solution array represents.
Since the algorithms used to solve are adaptive, the size of solutions might be different. Now, if I say that all my growth rates of species have the units hour^(-1) and all other constants have appropriate units and specify the time span to be 0.0 to 100.0 and I wish to track the population size in each hour. Given the model equations, if the length of solution comes out be 1000, then:
1) What time points do these 1000 values represent?
2) How to get the values of population size in each hour i.e., get the 101 values which would represent population size at each hour? Can this array be obtained by using `solve(problem,saveat = 1.0)`?
So from I understand, if I set up the time span to be 0.0 to 10.0 and my units are still hour^(-1) and the algorithm somhow calculates stepsize as 0.5 (assume, I dont know if its possible or not), I must get the solution vector to be of length 10.0/0.5 i.e., 20, right?
And,would each of the 20 values would represent values for time points 0 hr, 0.5 hr, 1.0 hr, 1.5 hr…,19.5 hr,20 hr?
If you don’t use saveat, the solver will typically pick how many points it needs to represent the solution well enough that the interpolation will be accurate in between. I’ve almost exclusively used Tsit5() and this seems to work really well. As a result, I don’t worry about what points the solver actually finds and use the interpolation interface to find values at times of interest. The one time I got away from that was when doing a large and long simulation in which I was running low on RAM, but that should be the exception.
The time points the solver will use will probably not be evenly spaced. They will depend on how fast things are changing in your simulation. I would encourage you to try using the interpolation - it is a good feature.
I am quiet new to solving ODEs, rather this is my first time.
Can you shed some light upon the interpolating function as I did not find any good material on it online?
Is it anything like the integrated function of the ODE/s?
It only stored 15 points over the 5 seconds of simulation. However, you can get the value at any time by executing something like sol(1.0) (note I’m using parentheses, not brackets) and it will interpolate and give an accurate answer.
Or you can do this: