hamiltonian neural networks
**Hamiltonian Neural Networks (HNNs)** are **neural networks that learn to predict the dynamics of physical systems by learning the Hamiltonian function** — instead of directly predicting derivatives, HNNs learn $H(q, p)$ and derive the dynamics from Hamilton's equations, automatically conserving energy.
**How HNNs Work**
- **Network**: A neural network $H_ heta(q, p)$ approximates the system's Hamiltonian (total energy).
- **Hamilton's Equations**: $dot{q} = partial H / partial p$, $dot{p} = -partial H / partial q$ — dynamics derived from the learned $H$.
- **Training**: Train on observed trajectory data by minimizing the error between predicted and observed derivatives.
- **Conservation**: Energy $H$ is automatically conserved along the learned trajectories.
**Why It Matters**
- **Physical Inductive Bias**: Encodes the Hamiltonian structure — the most fundamental formulation of conservative mechanics.
- **Generalization**: HNNs generalize better to unseen initial conditions and longer time horizons than standard neural ODEs.
- **Data Efficiency**: Physical prior reduces the data needed to learn accurate dynamics.
**HNNs** are **learning energy instead of forces** — a physics-informed architecture that discovers the Hamiltonian and derives correct, energy-conserving dynamics.