A compiler-based framework for computational physics | Describe it once, simulate it anywhere.
MechanicsDSL is a domain-specific language and compiler for physical systems. You write a Lagrangian or Hamiltonian in a LaTeX-inspired syntax; the symbolic engine (built on SymPy) derives the equations of motion automatically, and the compiler generates simulation code in your choice of twelve target languages, plus a JAX runtime backend for GPU-accelerated, differentiable simulation.
The project is developed and maintained by Noah Parsons.
| Repository | Description |
|---|---|
| mechanicsdsl | Core DSL compiler, symbolic engine, twelve physics domains, twelve code-generation backends plus a JAX runtime backend, LSP server, Jupyter magic commands, FastAPI server. |
| Repository | Description |
|---|---|
| mechanicsdsl-embedded | Embedded and edge deployment for Arduino, Raspberry Pi, and ARM platforms. Pendulum and double pendulum examples, ARM cross-compilation via Docker, POSIX real-time scheduling, IMU integration. |
| mechanicsdsl-ros2 | ROS2 integration. Generated C++ nodes, custom messages, launch files, parameter configs, and integration tests. |
| mechanicsdsl-unity | Unity and Unreal Engine plugin packages. Pendulum and coupled-pendulum components, conservation monitors, phase-space trails, custom Inspectors, runtime test suite. |
| Repository | Description |
|---|---|
| mechanicsdsl-notebooks | Worked-example Jupyter notebooks covering a selection of MechanicsDSL topics: double pendulum (chaos, Lyapunov), coupled oscillators (normal modes, beating), constraints (Baumgarte), central forces (Kepler), and Hamiltonian mechanics (phase space, symplectic integration). Binder-launchable. |
| mechanicsdsl-datasets | Reference datasets for physics parameter estimation and inverse problem benchmarking. Includes synthetic trajectories for pendulum, double pendulum, and coupled oscillators, with CSV, HDF5, metadata, and validation scripts. |
Measured via Google BigQuery (the public PyPI download dataset), MechanicsDSL has 495 organic installs from 838 raw, across 18 countries. Raw counts exclude automated clients, mirrors, CI runners, and requests without a reported installer, under the PyPI installer.name/null exclusion rule. Total file requests come to ~18,000 across 71 countries, but that figure is dominated by automatic PyPI mirrors (e.g. bandersnatch) and direct/web traffic, so it overstates real adoption. The package is published with a Zenodo DOI (10.5281/zenodo.17771040).
pip install mechanicsdsl-core # core compiler
pip install mechanicsdsl-core[jax] # + GPU acceleration
pip install mechanicsdsl-datasets # physics datasets
pip install mechanicsdsl-core[all] # everythingDocker:
docker pull ghcr.io/mechanicsdsl/mechanicsdsl:latest
docker run -it ghcr.io/mechanicsdsl/mechanicsdsl:latestFull documentation: mechanicsdsl.readthedocs.io
@software{mechanicsdsl2026,
author = {Parsons, Noah},
title = {{MechanicsDSL}: A Domain-Specific Language for Computational Physics Simulation},
year = {2026},
doi = {10.5281/zenodo.17771040},
url = {https://github.com/MechanicsDSL/mechanicsdsl},
license = {MIT}
}All MechanicsDSL repositories are released under the MIT License unless otherwise noted.
