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

Strange Differential (+jacobian) behavior with arrays #571

Open
cooperrc opened this issue Apr 7, 2022 · 2 comments
Open

Strange Differential (+jacobian) behavior with arrays #571

cooperrc opened this issue Apr 7, 2022 · 2 comments

Comments

@cooperrc
Copy link

cooperrc commented Apr 7, 2022

The recent Fixes #570 and #568 leaves a strange behavior for derivatives (it sounds like there are some known issues, but I wanted to document a simple case here)

@variables t x[1:2](t) # independent and dependent variables
@parameters k # parameters

Dx1 = Differential(x[1])
Dx2 = Differential(x[2])

V = 1/2*k*(x[2]- x[1])^2
Symbolics.expand_derivatives(Dx1(L))

Result should be
-k*(x[2] - x[1])

but instead you receive
0

The problem seems to stem from the Differential

@variables t x[1:2](t) # independent and dependent variables
@parameters k # parameters

Dx1 = Differential(x[1])
Dx2 = Differential(x[2])

V = 1/2*k*x[2]^2 + 1/2*x[1]^2
Symbolics.expand_derivatives(Dx1(L))

returns

k*x_2 + k*x_1

instead of the correct

k*x_1

@ChrisRackauckas
Copy link
Member

Seems like one more of these @shashi

@cooperrc
Copy link
Author

cooperrc commented Apr 8, 2022

@shashi if I can help/troubleshoot, let me know. I'm newish to Julia, but I've got a lot of experience in scientific computing.

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

No branches or pull requests

2 participants