Skip to content

structural_simplify elimiantes differently for ODESystem and NonlinearSystems #3521

@TorkelE

Description

@TorkelE

Something popped up while going through the Catalyst tests. Simple example. Here, I'd imagine that we could eliminate A in both cases. However, structural_simplify does it only for NonlinearSystems, but not for ODESystems. Seems odd that the two systems have different behaviours here?

using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
@parameters p d a b
@variables X(t) A(t)
eqs1 = [
    D(X) ~ p - d * X
    a*A^2 ~ X + b
]
eqs2 = [
    0 ~ p - d * X
    a*A^2 ~ X + b
]
@mtkbuild osys = ODESystem(eqs1, t) 
@mtkbuild nlsys = NonlinearSystem(eqs2)
unknowns(osys) # [X(t) A(t)]
unknowns(nlsys) # [A(t)]

Metadata

Metadata

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