Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot index problems with Tuples #709

Open
TorkelE opened this issue Jun 9, 2024 · 0 comments
Open

Cannot index problems with Tuples #709

TorkelE opened this issue Jun 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@TorkelE
Copy link
Member

TorkelE commented Jun 9, 2024

Not super noteworthy and hardly something to prioritise (but should at least be recorded), however, it does work for integrators and solutions, so might make sense.

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

@parameters p d 
@variables X(t)
@variables Y(t)
eqs = [
    D(X) ~ p - d*X,
    D(Y) ~ p - d*Y
]
@mtkbuild sys = ODESystem(eqs, t)

u0 = [X => 1.0, Y => 1.0]
tspan = (0.0, 100.0)
ps = [p => 1.0, d => 0.1]

prob = ODEProblem(sys, u0, tspan, ps)
prob[(X, Y)] # ERROR: Invalid indexing of problem

integrator = init(prob)
integrator[(X, Y)] # Works

sol = solve(prob)
sol[(X, Y)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant