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

Obtain equation associated with a given variable? #3374

Open
hersle opened this issue Feb 6, 2025 · 2 comments
Open

Obtain equation associated with a given variable? #3374

hersle opened this issue Feb 6, 2025 · 2 comments
Labels
question Further information is requested

Comments

@hersle
Copy link
Contributor

hersle commented Feb 6, 2025

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).

@hersle hersle added the question Further information is requested label Feb 6, 2025
@ChrisRackauckas
Copy link
Member

This information is computed as part of the matching algorithm during structural simplification. @AayushSabharwal is there a nice way to expose this?

@AayushSabharwal
Copy link
Member

Yeah I can make a function. If the system is structural_simplify-ed, it contains the information to reconstruct the matching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants