Closed slwu89 closed 2 years ago
It's no coincidence here that I(t)->I(0) as t->infinity. Similar to your jump system, there appears to be a problem with the initial conditions to deal with the recovery of the 10 individuals that are all infected at t=0. I thought that one wouldn't have to deal with this specifically.
I made an issue on the repo: https://github.com/SciML/DelayDiffEq.jl/issues/225
I just checked quickly and observed the same behaviour with Mathematica. I'm not completely familiar with its NDSolve
though, so I am not sure how well it deals with discontinuous history functions. Nevertheless, it makes me wonder if this delay SIR formulation should actually yield I(t) -> 0
as t -> Inf
? More concretely, is I'(t) < 0
if I(t) = 10
for some t > 0
? Otherwise, the dynamics would be limited to values I(t) >= 10
by the model.
(I'm also a bit surprised that the recovery rate depends on the number of susceptibles in this model)
To deal with the initial infecteds, one either needs to have a callback, or run an SI ODE model until t=tau and use that to initialize the DDE model at t=tau. I'll push an update shortly.
Fixed (I think!) with https://github.com/epirecipes/sir-julia/commit/8f11553560e213734e9ee329a76d772810219123
@sdwfrost in looking at the SDDE model issue https://github.com/SciML/StochasticDelayDiffEq.jl/issues/48 I decided to set the diffusion matrix to all zeros to see if the I state variable would decay to zero smoothly like a DDE. It does not; in fact this behavior can also be seen in the regular DDE model too, see example below, just copy-pasting the DDE tutorial in this repo, but solving to
tmax = 1e4
.Checking the last state returned by the solver gives:
example: