Skip to content

Obtain equation associated with a given variable? #3374

@hersle

Description

@hersle

Does MTK expose some functionality that can be used to obtain a map from every variable in a system to the equation that determines it? Is this stored or computed internally somewhere?

For example, for a system like

vars = @variables x(t) y(t) z(t)
@sys = ODESystem([
    D(x) ~ 0 # determines unknown x
    x^2 + y^2 ~ 5^2 # determines unknown y
    z ~ x + y # determines observed z
], t, vars, [])

I am looking for something like

var2eq = Dict(
    x => D(x) ~ 0
    y => x^2 + y^2 ~ 25
    z => x + y
)

Nonlinear algebraic equations is not a must; I guess it makes no sense if there are more than one, anyway.
I found Dependency Graphs in the documentation, but it doesn't mention exactly what I am looking for (if I read it correctly).

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions