Hamiltonian dynamics describes the evolution of a physical system through a Hamiltonian function that encodes total energy as a function of position and momentum, generating equations of motion that conserve energy and preserve phase-space volume. In machine learning it underlies Hamiltonian Monte Carlo, where a sampler’s proposal is generated by simulating Hamiltonian trajectories through parameter space augmented with auxiliary momentum variables, enabling long, low-rejection-rate moves through complex posterior distributions. Its energy-conserving structure makes proposals far more efficient than random-walk methods for high-dimensional, correlated distributions. Numerical integrators such as the leapfrog method are used to simulate the trajectories while approximately preserving the conservation properties that make the method valid.