Comments (4)
Yeap okay, I will do that after I learn how all these new stuff works.
I will also make a method
HamiltonianProblem(dHdq, dHdq, tspan)
in case the user can do the differentiation by themselves. I know its is identical to the ODEProblem
but having the Hamiltonian
name will be not only nice but intuitive as well.
from diffeqphysics.jl.
Some more details. Hamiltonians can be written as H(p,q)
. This then gives equations of motion
dp/dt = - dH/dq
dq/dt = dH/dp
Those equations of motion define a PartitionedODEProblem
, where the partition has a set of ODEs for p
and a set of ODEs for q
. OrdinaryDiffEq.jl can natively handle this kind of PartitionedODEProblem
and use things like Verlets, or it can (soon) transform it into a standard ODE for all of the other algorithms. So the actual solving can be handled by that.
What needs to be done is that the equations of motion need to be generated using differentiation tools. I.e., use something like ForwardDiff to define the equations of motion using a user defined H(p,q)
function (for vectors p
and q
).
from diffeqphysics.jl.
I would like to try and solve this issue.
How do you envision the interface?
Hamiltonian(p,q) -> PartitionedODEProblem
etc?
I have had some experience with ForwardDiff for the DynamicalSystems package, so probably I can handle this... (don't be so sure though)
from diffeqphysics.jl.
How do you envision the interface?
ODEHamiltonian(p,q) -> PartitionedODEProblem etc?
Yes.
HamiltonianProblem(H,q0,p0,tspan)
Essentially what it will do is use ForwardDiff to make a function for dHdq and a function for dHdp, and build the ODEProblem((dHdq,dHdp),(q0,p0),tspan)
. This output can then be directly solved by the symplectic solvers.
So the only "hard part" is the differentiation, which should just be differentiating a closure ForwardDiff.derivative!((p)->H(p,q),...)
. And making tests of course. It actually should be pretty easy, but will be a nice convenience.
from diffeqphysics.jl.
Related Issues (20)
- Euler-Legrange Equations
- Lennard-Jones Fluids
- Numerical solution for Euler–Lagrange equation
- Numerical solution for Hamilton's equations
- ArrayPartition n-body system
- having problems adding HOT 10
- Cache the GradientConfig and JacobianConfig for the HamiltonianProblems
- Thread safety of HamiltonianProblem
- package dependency errors? HOT 2
- Handling animations of n-body problems via iterators HOT 1
- Comments on N-body problem HOT 2
- GIFs shouldn't be placed in repository
- New package for N-body simulations HOT 2
- Register HOT 21
- Confusing Notation HOT 1
- TagBot trigger issue HOT 6
- Bug in DiffEqPhysics ? HOT 14
- pendulum example is broken HOT 1
- Harmonic oscillator mass ignored HOT 1
- Solving non-autonomous `HamiltonianProblem` no longer works HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diffeqphysics.jl.