-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Capture observed dependence on unknowns in simplified nonlinear systems #2863
Conversation
Would it be better if, for example, using ModelingToolkit
@variables x y z
@parameters σ ρ β
@mtkbuild ns = NonlinearSystem([
0 ~ σ * (y - x)
0 ~ x * (ρ - z) - y
0 ~ x * y - β * z
])
J = calculate_jacobian(ns) did not expand observed derivatives like
but rather kept them in a form like
? |
# TODO: must do the same fix in e.g. calculate_hessian? | ||
# TODO: rather keep observed derivatives unexpanded, like "Differential(obs)(expr)"? | ||
obs = map(eq -> eq.lhs => eq.rhs, observed(sys)) | ||
rhs = map(eq -> substitute(eq.rhs, obs), equations(sys)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't catch a chain of observed, it would need a fixed point sub I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like in the most recent commit? Can you think of a simple example on to test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
z ~ y,
y ~ x,
x^2 - 2z` should hit it, since if you just plug in z you get y.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite after structural simplification, it seems.
But I added 0 ~ x^2 + 2*z + y
, z ~ y
, y ~ x
, which seems to do the trick.
This fixes the incorrect Jacobian in #2858.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.