Skip to main content

Curated Jupyter notebooks for MechanicsDSL — classical mechanics, quantum, electromagnetism, relativity, statistical mechanics

Project description

MechanicsDSL Logo

mechanicsdsl-notebooks

Curated Jupyter notebooks spanning all eight MechanicsDSL physics domains.

Active 5 Notebooks Launch Binder MIT License Core Package


Available Notebooks

# Notebook Topics Level
01 Double Pendulum Chaos, Lyapunov exponents, phase portraits, energy conservation Intermediate
02 Coupled Oscillators Normal modes, beating, modal decomposition, FFT verification Intermediate
03 Constraints Lagrange multipliers, Baumgarte stabilization, parameter study Intermediate
04 Central Forces Kepler problem, orbital types, dual Noether conservation Advanced
05 Hamiltonian Mechanics Phase space, separatrix, symplectic vs RK4 over 500 s Advanced

More notebooks in development — see docs/index.md for the full planned curriculum.


Launch

Binder (no install required):

Launch Binder

Local:

pip install mechanicsdsl-core[jupyter]
git clone https://github.com/MechanicsDSL/mechanicsdsl-notebooks
cd mechanicsdsl-notebooks
jupyter lab

Repository Structure

mechanicsdsl-notebooks/
├── notebooks/              # Jupyter notebooks (numbered sequentially)
│   ├── 01_double_pendulum.ipynb
│   ├── 02_coupled_oscillators.ipynb
│   ├── 03_constraints.ipynb
│   ├── 04_central_forces.ipynb
│   └── 05_hamiltonian.ipynb
├── binder/                 # Binder environment configuration
│   ├── environment.yml
│   └── postBuild
├── docs/                   # Documentation
│   ├── index.md            # Full curriculum index
│   └── notation.md         # DSL notation reference
├── scripts/
│   ├── check_notebooks.py  # Execute and validate all notebooks
│   └── generate_index.py   # Auto-regenerate docs/index.md
└── tests/
    └── test_notebooks_run.py

What MechanicsDSL Does in Each Notebook

Every notebook includes the DSL specification that the MechanicsDSL compiler uses to automatically:

  • Derive equations of motion via the Euler-Lagrange equations symbolically
  • Identify conserved quantities via Noether's theorem
  • Generate NumPy, JAX, or other backend simulation code

Example from Notebook 05:

\system{pendulum_hamiltonian}
\parameter{m}{1.0}{kg}
\parameter{l}{1.0}{m}
\lagrangian{0.5*m*l^2*\dot{theta}^2 - m*g*l*(1-cos(theta))}
\target{python_numpy}

MechanicsDSL derives: $H = p_\theta^2/(2ml^2) + mgl(1-\cos\theta)$ and generates Hamilton's equations automatically.


For Instructors

Notebooks are designed for direct classroom use — no prior DSL knowledge assumed. Each opens with physics motivation, introduces DSL syntax progressively, and includes interactive parameter exploration. If you use these notebooks in a course, open an issue to be acknowledged in the documentation.


Testing

pip install pytest nbconvert
python scripts/check_notebooks.py       # execute all notebooks
pytest tests/ -v                        # validate structure

Contributing

See CONTRIBUTING.md. Domain coverage especially needed: rigid body, perturbation theory, quantum tunneling, electromagnetism, general relativity.

Citation

@software{mechanicsdsl2026,
  author = {Parsons, Noah},
  title  = {{MechanicsDSL Notebooks}},
  year   = {2026},
  doi    = {10.5281/zenodo.17771040},
  url    = {https://github.com/MechanicsDSL/mechanicsdsl-notebooks}
}

License

MIT License — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mechanicsdsl_notebooks-0.1.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mechanicsdsl_notebooks-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file mechanicsdsl_notebooks-0.1.0.tar.gz.

File metadata

  • Download URL: mechanicsdsl_notebooks-0.1.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mechanicsdsl_notebooks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8f775fa89049383f57c77a3e8e4e6df28e40054eebf18d0f36b0428716e3effe
MD5 fca862fe6f0acc25ed8a5e369cf21976
BLAKE2b-256 ce2b21511cc92024a9462f98c1c27d648d5c11795b59ce1e2f50d2607fa0ad99

See more details on using hashes here.

Provenance

The following attestation bundles were made for mechanicsdsl_notebooks-0.1.0.tar.gz:

Publisher: publish-pypi.yml on MechanicsDSL/mechanicsdsl-notebooks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mechanicsdsl_notebooks-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mechanicsdsl_notebooks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53cc1ec25f90e626cbae3b1cf9c689fd784893eb597cf0042fffc6fc12741f1b
MD5 0d34af9ee051545c4241fe058dd54a97
BLAKE2b-256 58b7b0c79c6963ddfe291a0aeb0c070d7e0d80ae7201af443dac0dea86416120

See more details on using hashes here.

Provenance

The following attestation bundles were made for mechanicsdsl_notebooks-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on MechanicsDSL/mechanicsdsl-notebooks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page