ODEProblem gives error when using symbolic maps for parameters

Hi, I am trying to solve an ODEProblem for which I want to provide parameters in the form of a dictionary Dict{Symbol, Any}. This used to work in the past but now I get the following error message:
ArgumentError: This problem does not support symbolic maps with 'remake', i.e. it does not have a symbolic origin. Please use 'remake' with the 'p' keyword argument as a vector of values, paying attention to parameter order.

Here’s a simple example which showcases what I would like to do and which results in the above error:

function lorenz!(du,u,p,t)
    @unpack a, b, c = p
    du[1] = a*(u[2]-u[1])
    du[2] = u[1]*(b-u[3]) - u[2]
    du[3] = u[1]*u[2] - c*u[3]
end


u0 = [1.0;0.0;0.0]
p = Dict{Symbol, Any}(
    :a => 10.0,
    :b => 28.0,
    :c => 8/3,
)
tspan = (0.0,100.0)
prob = ODEProblem(lorenz!,u0,tspan,p)
sol = solve(prob,Tsit5())

Is there a way that allows me to continue using my dictionary and get this working? (I stumbled over ModelingToolkit.jl which might provide a solution but I couldn’t quite figure out what I need to do…)

2 Likes

Open an issue. We may need a way to provide an opt-out here.

1 Like

Thanks for your reply. I opened an issue.

For anyone else looking for the same error, the issue is here:
https://github.com/SciML/DifferentialEquations.jl/issues/922

1 Like

… and you’ll find a simple workaround in the issue comments, this workaround being
p = NamedTuple([pair for pair in p]) which turns the dictionary into a named tuple. The named tuple should then work as an input to ODEProblem().