Skip to content
@MechanicsDSL

MechanicsDSL

Open-source DSL & compiler for computational mechanics

MechanicsDSL Logo

MechanicsDSL

A compiler-based framework for computational physics — describe it once, simulate it anywhere.

CI Python 3.9+ MIT License DOI Docs Binder

What is MechanicsDSL?

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.


Repositories

Core

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.

Deployment and integration

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.

Data and education

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.

Adoption

Measured via Google BigQuery (the public PyPI download dataset), MechanicsDSL has ~790 organic installs (via pip/uv, excluding CI) across 16 countries — the best available proxy for genuine usage. 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).


Quick start

pip install mechanicsdsl-core          # core compiler
pip install mechanicsdsl-core[jax]     # + GPU acceleration
pip install mechanicsdsl-datasets      # physics datasets
pip install mechanicsdsl-core[all]     # everything

Docker:

docker pull ghcr.io/mechanicsdsl/mechanicsdsl:latest
docker run -it ghcr.io/mechanicsdsl/mechanicsdsl:latest

Full documentation: mechanicsdsl.readthedocs.io


Citation

@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}
}

License

All MechanicsDSL repositories are released under the MIT License unless otherwise noted.


Docs · Core repo · Zenodo · PyPI · Datasets on PyPI

Popular repositories Loading

  1. mechanicsdsl mechanicsdsl Public

    Domain-specific language and compiler for physical systems. Write a Lagrangian, get a simulation. Thirteen code generation backends, built on SymPy.

    Python 2

  2. .github .github Public

    MechanicsDSL organization profile.

  3. mechanicsdsl-datasets mechanicsdsl-datasets Public

    Reference datasets for physics parameter estimation and inverse problem benchmarking. Synthetic data with ground truth, experimental trajectories, and paired MCMC posteriors.

    Python

  4. mechanicsdsl-embedded mechanicsdsl-embedded Public

    Deploy MechanicsDSL simulations to Arduino, Raspberry Pi, and ARM edge devices. Optimized C++ and no_std Rust for real-time closed-loop control and on-device physics.

    Python

  5. mechanicsdsl-ros2 mechanicsdsl-ros2 Public

    Compile MechanicsDSL physical systems to ROS2 packages. Auto-generates CMakeLists, message definitions, topic architecture, and launch files.

    C++

  6. mechanicsdsl-unity mechanicsdsl-unity Public

    Simulation components for Unity (C#) and Unreal Engine (C++), compiled from MechanicsDSL notation. For accurate game mechanics, science exhibits, and engineering digital twins.

    C#

Repositories

Showing 7 of 7 repositories

Top languages

Loading…

Most used topics

Loading…