A compiler-based framework for computational physics — describe it once, simulate it anywhere.
MechanicsDSL is an open-source computational physics organization building a full compiler toolchain for physical simulation. Our flagship package lets researchers, engineers, and educators define physical systems in natural, LaTeX-inspired notation — and automatically derives equations of motion, handles constraints, identifies conservation laws, and generates high-performance simulation code for 12+ target platforms.
We are not a wrapper around existing tools. We are a compiler. The user writes physics; we write the code.
\system{double_pendulum}
\parameter{m}{1.0}{kg}
\parameter{l}{1.0}{m}
\lagrangian{
0.5*m*l^2*(\dot{theta1}^2 + \dot{theta2}^2 + 2*\dot{theta1}*\dot{theta2}*cos(theta1-theta2))
- m*g*l*(2*cos(theta1) + cos(theta2))
}
\initial{theta1: 1.0, theta2: 0.5}
\target{python_jax}
\solve{t_span: [0, 30], dt: 0.005}
That's it. The compiler handles symbolic derivation, conservation law detection, GPU-accelerated integration, and phase space visualization.
| Repository | Description | Status |
|---|---|---|
| mechanicsdsl | Core DSL compiler, symbolic engine, 8 physics domains, 17+ classical mechanics modules, 12+ code generation backends, JAX/GPU support, LSP server, Jupyter magic commands, FastAPI server | v2.0 stable |
| Repository | Description | Status |
|---|---|---|
| mechanicsdsl-embedded | Embedded and edge deployment for Arduino, Raspberry Pi, and ARM platforms. Arduino and RPi pendulum/double pendulum examples, ARM cross-compilation via Docker, POSIX real-time scheduling, IMU integration, serial monitor tooling. | active |
| mechanicsdsl-ros2 | Dedicated ROS2 integration layer. Complete mechanicsdsl_pendulum package with generated C++ nodes, custom messages (PendulumState, SystemState), launch files, parameter configs, GTest physics tests, and ROS2 integration tests. |
active |
| mechanicsdsl-unity | Unity and Unreal Engine plugin packages. PendulumComponent, DoublePendulumComponent, CoupledPendulumsComponent MonoBehaviours; ConservationMonitor, PhaseSpaceTrail, MechanicsDSLMath utilities; custom Inspectors; UPM manifest; runtime test suite. |
active |
| Repository | Description | Status |
|---|---|---|
| mechanicsdsl-notebooks | Curated Jupyter notebooks spanning all eight MechanicsDSL physics domains. Currently: double pendulum (chaos, Lyapunov), coupled oscillators (normal modes, beating), constraints (Baumgarte), central forces (Kepler), Hamiltonian mechanics (phase space, symplectic integration). Binder-launchable. | active |
| mechanicsdsl-datasets | Reference datasets for physics parameter estimation and inverse problem benchmarking. Currently: pendulum_synthetic, double_pendulum_synthetic, coupled_oscillators_synthetic — each with CSV, HDF5, metadata, and estimation/validation scripts. |
active |
Since release on PyPI, MechanicsDSL has accumulated 11,000+ downloads across 66 countries, with institutional mirrors (bandersnatch, Nexus, devpi) confirmed in multiple national research computing environments. The package is published with a formal Zenodo DOI (10.5281/zenodo.17771040) and is the subject of ongoing peer-reviewed research:
Parsons, N. Decoupling Programming from Physics: A Compiler-Based Approach to Teaching Lagrangian Mechanics. Under review at American Journal of Physics (submitted January 2026).
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.
Built for physicists, engineers, and curious minds.
Docs ·
Core Repo ·
Zenodo ·
PyPI ·
Datasets on PyPI
