Skip to content

Allow extend System to override previous equations #1518

@bgctw

Description

@bgctw

For understanding a system, it is often helpful to fix some of the derivatives. Hence, I would like to be able to extend a system and override some previous equations, rather than just adding new equations.

using ModelingToolkit, OrdinaryDiffEq
@parameters t σ ρ β
@variables x(t) y(t) z(t)
D = Differential(t)
eqs = [D(D(x)) ~ σ*(y-x),
       D(y) ~ x*(ρ-z)-y,
       D(z) ~ x*y - β*z]
@named sys = ODESystem(eqs)

# create a new system where the derivative of z is fixed:
eqs_ext = [D(z) ~ 0]
@named sys_ext = extend(ODESystem(eqs_ext,t,[],[];name=:ext), sys)
equations(sys_ext)

Currently this gives 4 equations.
Instead of the repeated equation for D(z), I expect the previous equation to be replaced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions