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

Add Jacobian field to StochSystem #28

Open
oameye opened this issue Feb 29, 2024 · 7 comments
Open

Add Jacobian field to StochSystem #28

oameye opened this issue Feb 29, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@oameye
Copy link
Member

oameye commented Feb 29, 2024

In many algorithms one needs the jacobian of the drift field. These are now computed using ForwardDiff. Adding the the field jacobian to StochSystem, makes it possible for the user to hardcode it or compute it symbolically using, e.g., ModeligToolkit.

@reykboerner
Copy link
Collaborator

Agreed, integration of ModelingToolkit and the possibility to hardcode the Jacobian of the drift should be included.

@reykboerner reykboerner added the enhancement New feature or request label Mar 13, 2024
@oameye oameye added this to the Release version 1.0 milestone Mar 27, 2024
@oameye
Copy link
Member Author

oameye commented Nov 22, 2024

A jacobian can be stored in sde.integ.f.jac

@oameye
Copy link
Member Author

oameye commented Nov 22, 2024

@Datseris
Copy link
Member

Datseris commented Nov 22, 2024

probably worth coordinating creating the jacobian of a dynamic rule generically via an interface function. I do it on my own in TangentDynamicalSystem via ForwardDiff. And we have the jacobian function for htis.

How does integ.f.jac do it?

@oameye
Copy link
Member Author

oameye commented Nov 22, 2024

Would be nice that jacobian(sde::CoupledSDEs) works, just as jacobian(sde::CoupledODEs). We just need to make CoupledSDEs <: CoreDynamicalSystem. For some reason CoupledODEs <: CoreDynamicalSystem, but I don't see where that's defined.

integ.f.jac stores the jacobian if you define the system with ModelingToolkit and use jac=true in the ODESystem. In the background it just uses Symbolics.build_function to compile the Symbolics.

@Datseris
Copy link
Member

Would be nice that jacobian(sde::CoupledSDEs) works, just as jacobian(sde::CoupledODEs). We just need to make CoupledSDEs <: CoreDynamicalSystem. For some reason CoupledODEs <: CoreDynamicalSystem, but I don't see where that's defined.

You can define jacobian(sde::CoupledSDEs) = jacobian(CoupledODEs(sde)) which to me sounds more correct. Because you refer to the jacobian of the drift, while of course one could ask for the jacobian of the noise term just as well.

integ.f.jac stores the jacobian if you define the system with ModelingToolkit and use jac=true in the ODESystem. In the background it just uses Symbolics.build_function to compile the Symbolics.

Oh, I didn't know that. THat is very useful. DynamicalSystems.jl already supports MTK-made models throughout. So we can add one more option so that if there is a symbolic Jacobian, it uses this one instead of making a forward-diff one. Easy to do via a PR if you are interested!

@oameye
Copy link
Member Author

oameye commented Nov 23, 2024

@Datseris made a PR

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

No branches or pull requests

3 participants