When passing parameters p
to the function f
of an ODEProblem
(or any problem type in the DiffEq universe), does p
always have to be an array? Is there a “best practices” reason for why I shouldn’t use Dict
s to hold my parameters in my function definition f
?
As a concrete example, I tried modifying the ODE tutorial
p = Dict()
p[:c] = 1.01
f(u,p,t) = p[:c]*u
u0 = 1/2
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)
sol = solve(prob, Tsit5(), reltol=1e-8, abstol=1e-8)
but I get ERROR: MethodError: no method matching getindex(::Nothing, ::Symbol)
related to p
on the solve
, so I was curious why parameters have to be “list”-like.