-
Notifications
You must be signed in to change notification settings - Fork 172
Throw error on differentiation involving arrays #530
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #530 +/- ##
===========================================
+ Coverage 9.02% 78.62% +69.59%
===========================================
Files 23 23
Lines 2272 2334 +62
===========================================
+ Hits 205 1835 +1630
+ Misses 2067 499 -1568
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
| is_scalar_indexed(ex) = istree(ex) && operation(x) == getindex && !(symtype(x) <: AbstractArray) | ||
| if is_scalar_indexed(x) && is_scalar_indexed(expr) && | ||
| isequal(first(arguments(x)), first(arguments(expr))) | ||
| return isequal(arguments(x), arguments(expr)) |
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.
I think this might be the problem for the DataDriven failure.
using ModelingToolkit
using Symbolics
@variables u[1:2] y[1:1] t
u = collect(u)
y = collect(y)
Symbolics.jacobian([u;u[1]^2; y], u)fails while
using ModelingToolkit
using Symbolics
@variables u[1:2] y[1:1] t
u = collect(u)
y = collect(y)
Symbolics.jacobian([u;u[1]^2], u)is valid. The problem is that I take the Jacobian w.r.t. to the state variables only to derive a variable transform. If the system has control variables, there are mixed terms. Could this be relaxed to
all([isin(xi, arguments(expr) for xi in arguments(x)]) ?
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.
Ah okay, that can be fixed.
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.
Try out the latest change.
0 is very wrong.
As seen on https://stackoverflow.com/questions/71140858/with-julia-symbolics-how-can-i-do-a-mathematical-summation