Skip to content

Cannot index/call solution by pure parametersΒ #3267

@hersle

Description

@hersle

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.

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