Hello,
a few months ago I generated a figure of the expected interaction between bacteria and phages using a delayed ODE:
Now I tried to re-run that file but I got an error. Here is what happened:
Version 1.4.1
julia> using DifferentialEquations
julia> function dynDelay!(du, u, h, p, t)
μ, κ, ϕ, ω, β, ρ, τ = p
#=
du[1] = susceptible
du[2] = infected
du[3] = phages
=#
history = h(p, t - τ)
delay_lysis = ϕ * history[1] * history[3] * exp(-1 * ω * τ)
du[1] = (μ * u[1]) * (1 - (u[1]+u[2])/κ) - (ϕ * u[1] * u[3]) - (ω * u[1])
du[2] = (ϕ * u[1] * u[3]) - delay_lysis - (ω * u[2])
du[3] = (β * delay_lysis) - (ρ * ϕ * u[1] * u[3]) - (ω * u[3])
end
dynDelay! (generic function with 1 method)
julia> mu = 0.16 # maximum growth rate susceptible strain
0.16
julia> nu = 0.12 # maximum growth rate resistant strain
0.12
julia> kappa = 2.2e7 # maximum population density
2.2e7
julia> phi = 1.0e-9 # adsorption rate
1.0e-9
julia> omega = 0.05 # outflow
0.05
julia> beta = 50.0 # burst size
50.0
julia> rho = 1.0 # reinfection rate
1.0
julia> tau = 3.62 # latency time
3.62
julia> tmax = 4000.0 # time span 0-tmax
4000.0
julia> s0 = 50000.0 # initial susceptible population
50000.0
julia> i0 = 0.0 # initial infected population
0.0
julia> v0 = 80.0 # initial phage population
80.0
julia> r0 = 500.0 # initial resistant population
500.0
julia> h(t, p) = [s0, i0, v0]
h (generic function with 1 method)
julia> tspan = (0.0, tmax)
(0.0, 4000.0)
julia> u0 = [s0, i0, v0]
3-element Array{Float64,1}:
50000.0
0.0
80.0
julia> parms = [mu, kappa, phi, omega, beta, rho, tau]
7-element Array{Float64,1}:
0.16
2.2e7
1.0e-9
0.05
50.0
1.0
3.62
julia> prob = DDEProblem(dynDelay!, u0, h, tspan, p=parms; constant_lags = [tau])
DDEProblem with uType Array{Float64,1} and tType Float64. In-place: true
timespan: (0.0, 4000.0)
u0: [50000.0, 0.0, 80.0]
julia> algt = MethodOfSteps(Tsit5())
MethodOfSteps{Tsit5,NLFunctional{Rational{Int64},Rational{Int64}},false}(Tsit5(), NLFunctional{Rational{Int64},Rational{Int64}}(1//100, 1//5, 10))
So far so good, but then I run the solver:
julia> soln = solve(prob, algt)
ERROR: MethodError: no method matching iterate(::DiffEqBase.NullParameters)
Closest candidates are:
iterate(::Core.SimpleVector) at essentials.jl:603
iterate(::Core.SimpleVector, ::Any) at essentials.jl:603
iterate(::ExponentialBackOff) at error.jl:253
Stacktrace:
[1] indexed_iterate(::DiffEqBase.NullParameters, ::Int64) at ./tuple.jl:84
[2] dynDelay!(
[... several other lines of error]
What went wrong? How can I solve it?
Thank you