Skip to content

Cannot create problems with tuple vector variables #3280

@TorkelE

Description

@TorkelE
using ModelingToolkit, OrdinaryDiffEq
using ModelingToolkit: t_nounits as t, D_nounits as D

@variables (X(t))[1:2]
@parameters p[1:2]
eqs = [
    D(X[1]) ~ p[1] - X[1],
    D(X[2]) ~ p[2] - X[2]
]
@named model = ODESystem(eqs, t)
model = complete(model)

# Problem inputs
u0_vec = [X => [1.0, 2.0]]
u0_dict = Dict([X => [1.0, 2.0]])
u0_tup = (X => [1.0, 2.0])
p_vec = [p => [4.0, 5.0]]
p_dict = Dict([p => [4.0, 5.0]])
p_tup = (p => [4.0, 5.0])
tspan = (0.0, 10.0)

# Problem creation:
ODEProblem(model, u0_vec, tspan, p_vec)
ODEProblem(model, u0_vec, tspan, p_dict)
ODEProblem(model, u0_vec, tspan, p_tup)
ODEProblem(model, u0_dict, tspan, p_vec)
ODEProblem(model, u0_dict, tspan, p_dict)
ODEProblem(model, u0_dict, tspan, p_tup)
ODEProblem(model, u0_tup, tspan, p_vec) # Error.
ODEProblem(model, u0_tup, tspan, p_dict) # Error.
ODEProblem(model, u0_tup, tspan, p_tup) # Error.

Probably holds for other problem types as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions