Hamiltonian systems in Jax
In this ReCoDE exemplar, we introduce the basics of Hamiltonian dynamics and demonstrate how Python and JAX can be used to simulate and visualise systems. We go over the mathematical prerequisites and create a framework for solving Hamiltonian equations using the general dynamical systems solver in JAX. Finally, we demonstrate how we can implement simple harmonic oscillator and N-body systems, including visualisation code to plot various system simulated over time.
Learning Outcomes
By studying this exemplar you will be better able to:
- Use dynamical systems to model physical scenarios
- Use JAX to solve ODEs and perform linear algebra operations
- Visualise trajectories in 1D and 2D phase space
- Organise code in an an object-oriented way
Estimated Duration
Task | Time |
---|---|
Reading | 3 hours |
Practising | 2 hours |
Requirements
Undergraduate level calculus, linear algebra and a basic understanding of physics are required. Specific knowledge of Hamiltonian dynamics is not required, as we will introduce the necessary concepts in the course of this exemplar.
License
This project is licensed under the BSD-3-Clause license