I converted the formulae in:
function dynVirul!(du, u, p, t)
μ, ϕ, ω, Ω, β, τ = p
#=
du[1] = susceptible
du[2] = infected
du[3] = phages
τ = latency time, l
μ = growth rate, a
ϕ = adsorption rate, b
ω = outflow (loss rate bacteria), p
Ω = outflow (loss rate phage), s = p
β = burst size, r
=#
sumTerm = sum(u[2] * (ϕ * u[1] * u[3] - ω * ϕ * u[1] * u[3]))
du[1] = (μ * u[1]) - (ϕ * u[1] * u[3]) - (ω * u[1])
du[2] = (ϕ * u[1] * u[3]) - (ω * u[2]) - sumTerm
du[3] = (β * sumTerm) - (ϕ * u[1] * u[3]) - (Ω * u[3])
end
but when I run it I get an error:
mu = 0.03 # maximum growth rate susceptible strain
phi = 2e-8 # adsorption rate
omega = 0.05 # outflow
beta = 150 # burst size
tau = 26 # latency time
tmax = 4000.0 # time span 0-tmax
s0 = 1.3e5 # initial susceptible population
i0 = 0.0 # initial infected population
v0 = 5.3e3 # initial phage population
omega_bact = omega_phage = omega
tspan = (0.0, tmax)
u0 = [s0, i0, v0]
parms = [mu, phi, omega_bact, omega_phage, beta, tau]
prob = DDEProblem(dynVirul!, u0, tspan, parms)
ERROR: MethodError: objects of type Array{Float64,1} are not callable
Use square brackets [] for indexing an Array.
Stacktrace:
[1] DDEProblem{false,tType,lType,lType2,isinplace,P,F,H,K} where K where H where F where P where isinplace where lType2 where lType where tType(::DDEFunction{false,typeof(dynVirul!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}, ::Array{Float64,1}, ::Tuple{Float64,Float64}, ::Array{Float64,1}; order_discontinuity_t0::Int64, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/gigiux/.julia/packages/DiffEqBase/KnYSY/src/problems/dde_problems.jl:32
[2] DDEProblem{false,tType,lType,lType2,isinplace,P,F,H,K} where K where H where F where P where isinplace where lType2 where lType where tType(::DDEFunction{false,typeof(dynVirul!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}, ::Array{Float64,1}, ::Tuple{Float64,Float64}, ::Array{Float64,1}) at /home/gigiux/.julia/packages/DiffEqBase/KnYSY/src/problems/dde_problems.jl:32
[3] DDEProblem(::DDEFunction{false,typeof(dynVirul!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}, ::Array{Float64,1}, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/gigiux/.julia/packages/DiffEqBase/KnYSY/src/problems/dde_problems.jl:44
[4] DDEProblem(::DDEFunction{false,typeof(dynVirul!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}, ::Array{Float64,1}, ::Vararg{Any,N} where N) at /home/gigiux/.julia/packages/DiffEqBase/KnYSY/src/problems/dde_problems.jl:44
[5] DDEProblem(::Function, ::Array{Float64,1}, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/gigiux/.julia/packages/DiffEqBase/KnYSY/src/problems/dde_problems.jl:41
[6] DDEProblem(::Function, ::Array{Float64,1}, ::Vararg{Any,N} where N) at /home/gigiux/.julia/packages/DiffEqBase/KnYSY/src/problems/dde_problems.jl:41
[7] top-level scope at none:0
What did I get wrong?
Thanks