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

Can index solution by functions of parameters, but not pure parameters #3267

Open
hersle opened this issue Dec 11, 2024 · 0 comments
Open

Can index solution by functions of parameters, but not pure parameters #3267

hersle opened this issue Dec 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@hersle
Copy link
Contributor

hersle commented Dec 11, 2024

The last line in

using ModelingToolkit, OrdinaryDiffEq, Test
using ModelingToolkit: t_nounits as t, D_nounits as D
vars = @variables x(t)
pars = @parameters x0
@named S = ODESystem([D(x) ~ 0.0], t, vars, pars; defaults = [x => x0])
S = structural_simplify(S)
prob = ODEProblem(S, [], (0.0, 1.0), [x0 => 1.0])
sol = solve(prob)
sol[x][begin] # works
sol[x0*2] # works
sol[x0] # fails

fails with

ERROR: Indexing with parameters is deprecated. Use `getp(A, x0)` for parameter indexing.

I think that if indexing by x0*2 works, then so should x0.

@hersle hersle added the bug Something isn't working label Dec 11, 2024
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