GitHunt
CA

carlosardura/lagrangian-noether-simulator

Dynamic system simulator via Euler-Lagrange. EOM resolution and visualization of symmetries/conservation laws (Noether’s theorem).

Lagrangian Mechanics Simulator

This repository provides a modular and scalable simulator for classical mechanics, designed to bridge the gap between analytical mechanics and numerical computation. By utilizing SymPy, the system derives the Euler-Lagrange equations from the automatically defined Lagrangian, solving the equations of motion symbolically before mapping them into the numerical domain. This approach prevents potential algebraic errors in manual derivation.

The project features a rigorous comparison between different integration schemes. While Runge-Kutta 4 (RK4) provides high local precision with a global error of $O(h^4)$, its non-symplectic nature leads to a systematic drift, making it unreliable for long-term evolution. On the other hand, Euler-Cromer ( $O(h)$ ) and Velocity Verlet ( $O(h^2)$ ) are symplectic methods where the error remains bounded, oscillating around the nominal value without secular growth. Future direct scaling of the simulator aims to incorporate the numerical quantification of the phase-space area invariance ($\omega = dq \wedge dp$), an application of Liouville’s theorem that serves as a strict metric to evaluate the structural stability of the implemented methods.

To prevent numerical overflow and minimize round-off errors, the simulator operates in a dimensionless environment. Mass is scaled relative to the minimum mass in the particle set, while position and velocity are normalized. This scaling is integrated with a comprehensive testing suite in Pytest, validating the results against strict error bounds: a linear drift proportional to the time interval for RK4, and bounded deviations for symplectic methods.

The main goal of the project is to provide an interactive tool for illustrating the connection between a physical system’s symmetries and the corresponding conservation laws, as described by Noether’s theorem. By analyzing Lagrangian invariances under potentials with temporal, translational or rotational invariances, the simulator provides visual and numerical evidence of the conservation of energy, linear momentum or angular momentum in classical dynamics.

Languages

Python80.1%MATLAB19.9%

Contributors

MIT License
Created December 22, 2025
Updated January 19, 2026
carlosardura/lagrangian-noether-simulator | GitHunt