You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It has to stop at the callbacks. Otherwise it would in theory be incorrect. Yes in your case here the callbacks don't do anything, but there's really no way to know in general if someone is doing something adverse inside of a callback. So if you set a callback to fire at a time t, it has to step to the time t.
In the first case, dt is set so that way it hits each tstops value.
In the second case, between each ts value there is an event that occurs, and so dt needs to be shrunk to 1e-6 and then the next step has dt = ts[i-1] - ts[i] - 1e-6. This is because the PresetTimeCallback is simply appending ts .+ 1e-6 to the ts array for the total tstops to have 21 points that it steps to.
In the 4th case, the same thing occurs but now with a maximal dt = 0.1. So first it steps to 0.1, then 0.1 + 1e-6 for the vent, then 0.2 + 1e-6 for the next event, etc. to 1.0 for 12 steps.
And if you check solutioni.t, the time points are exactly as you have specified from the time stops. So then the last thing,
The solution is different by about 10^-6 depending on whether I use a callback that does nothing or not
Yes, because you changed dt, and the Euler method is only an approximation, so as dt changes you'll get a better or worse approximation of the ODE solution depending on whether the dt shrinks or grows.
I encounter two weird bahaviors when solving u' = u.
f!
is different (11, 21, 12) based on whether I use a callback and whether I pass intstops
ordt
kwarg.The text was updated successfully, but these errors were encountered: