Open source · Python · MIT licensed · v0.3.0

Physics you can run.

Simulations from pendulums to the double slit, in one Python package. Every solver is checked against an exact answer.

A wavepacket passing through two slits and forming interference fringes

Live in the repo · qplay animate double-slit

One electron. Two slits. Solved on a grid.

A 2D Schrödinger simulation with absorbing edges. The dark fringes land where the path difference is half a wavelength, and the test suite checks that they do.

iℏ ∂ψ/∂t = −(ℏ²/2m) ∇²ψ + V ψ

topic modules
17
figures and animations
31
notebooks, run on every build
4
tests against exact results
208

In motion.

Rendered fresh by qplay animate each time the site is built.

A chaotic double pendulum with a fading trail.
Double pendulumA chaotic double pendulum with a fading trail.qplay animate double-pendulum
A 2D wavepacket passing through two slits and interfering.
Double slitA 2D wavepacket passing through two slits and interfering.qplay animate double-slit
Three equal masses chasing each other around a figure-eight.
Figure eightThree equal masses chasing each other around a figure-eight.qplay animate figure-eight
Discs in a box: every one starts at the same speed and the speeds spread into Maxwell-Boltzmann.
GasDiscs in a box: every one starts at the same speed and the speeds spread into Maxwell-Boltzmann.qplay animate gas
Domains coarsening in the 2D Ising model at the critical temperature.
IsingDomains coarsening in the 2D Ising model at the critical temperature.qplay animate ising
A Gaussian wavepacket tunnelling through and reflecting off a barrier.
WavepacketA Gaussian wavepacket tunnelling through and reflecting off a barrier.qplay animate wavepacket
Through a wall it can’t climb. A wavepacket with less energy than the barrier still gets 2% of itself through, exactly what the plane-wave formula predicts. qplay animate wavepacket
A wavepacket reflecting from and tunnelling through a barrier

Accuracy

Pretty pictures are easy. Correct ones are the point.

Every function is tested against an analytic result, a conservation law or a limiting case. Never against its own output.

10−12

Probability conserved

In tunnelling, transmitted plus reflected equals one to twelve digits.

10−8

Hydrogen, exactly

Radial functions normalised, and ⟨r⟩ = a₀(3n² − l(l+1))/2, to eight decimal places.

±0.01

Onsager, by Monte Carlo

Ising magnetisation at T = 1.5 against the exact 1944 result.

Drag a slider. Watch the physics answer.

Six experiments run live in your browser: the pendulum, tunnelling, the double slit, Kepler orbits, the Lorenz attractor and the Ising model. Each one sits next to the exact result it should reproduce.

Open the explorer

Lessons for A-level and IB.

Guided lessons with exam-style questions and worked solutions. Follow a route below: each lesson lists what it builds on. Nothing to install: each one runs in your browser on Google Colab.

  1. 01Simple harmonic motion

    For: A-level Physics (for example AQA 3.6.1.2 to 3.6.1.4, OCR A 5.3, Edexcel Topic 13) and IB Physics (C.1, with resonance from C.4). Check your own specification for the exact wording.

    A starting pointRun it in Colab
  2. 02Projectile motion

    For: A-level Physics (for example AQA 3.4.1.4, OCR A 3.1.3, Edexcel Topic 2) and IB Physics (A.1). Check your own specification for the exact wording.

    A starting pointRun it in Colab
  3. 03Circular motion and gravitational orbits

    For: A-level Physics (for example AQA 3.6.1.1 and 3.7.2, OCR A 5.2 and 5.4, Edexcel Topics 6 and 12) and IB Physics (A.2 circular motion and D.1 gravitational fields). Check your own specification for the exact wording.

    Builds on lesson 2Run it in Colab
  4. 04Stationary waves and harmonics

    For: A-level Physics (for example AQA 3.3.1.3, OCR A 4.4.4, Edexcel Topic 5) and IB Physics (C.4 standing waves and resonance). Check your own specification for the exact wording.

    Builds on lesson 1Run it in Colab
  5. 05Electric fields and potential

    For: A-level Physics (for example AQA 3.7.1 and 3.7.3, OCR A 6.2, Edexcel Topic 7) and IB Physics (D.2 electric and magnetic fields). Check your own specification for the exact wording.

    Builds on lesson 3Run it in Colab
  6. 06Charged particles in electric and magnetic fields

    For: A-level Physics (for example AQA 3.7.3.2 and 3.7.5.2, OCR A 6.2 and 6.3, Edexcel Topic 7) and IB Physics (D.3 motion in electromagnetic fields). Check your own specification for the exact wording.

    Builds on lessons 2, 3, 5Run it in Colab
  7. 07Wave–particle duality and the double slit

    For: A-level Physics (for example AQA 3.2.2 and 3.3.2.1, OCR A 4.4.3 and 4.5, Edexcel Topic 5) and IB Physics (C.3 wave phenomena and E.2 quantum physics). Check your own specification for the exact wording.

    Builds on lessons 4, 5Run it in Colab
  8. 08Special relativity

    For: IB Physics (A.5 Galilean and special relativity, HL) and the AQA A-level option 3.12.3 (Turning points: special relativity). Check your own specification for the exact wording.

    Builds on lessons 2, 5Run it in Colab
  9. 09Ideal gases and kinetic theory

    For: A-level Physics (for example AQA 3.6.2.2 to 3.6.2.4, OCR A 5.1.4, Edexcel Topic 9) and IB Physics (B.3 gas laws). Check your own specification for the exact wording.

    Builds on lesson 3Run it in Colab
  10. 10Radioactive decay

    For: A-level Physics (for example AQA 3.8.1.3, OCR A 6.4.4, Edexcel Topic 11) and IB Physics (E.3 radioactive decay). Check your own specification for the exact wording.

    Builds on lesson 1Run it in Colab
  11. 11Capacitors

    For: A-level Physics (for example AQA 3.7.4, OCR A 6.1, Edexcel Topic 7) and IB Physics (HL capacitance and RC circuits). Check your own specification for the exact wording.

    Builds on lessons 5, 10Run it in Colab

Four notebooks, in order.

Rebuilt from scratch on every push, so the outputs always match the code.

  1. 01Classical mechanics

    Newton's second law for a pendulum of length $L$ gives

    Run it in Colab
  2. 02Quantum mechanics

    Everything here uses natural units, $\hbar = m = 1$. The time-independent Schrödinger equation is

    Run it in Colab
  3. 03Maths and chaos

    Numerical methods, Fourier series and a tour of chaos.

    Run it in Colab
  4. 04Orbitals, interference, phase transitions and phase space

    New modules in this notebook: `quantum` (orbitals, 2D dynamics), `statmech`, `hamiltonian`, `dynamics`, `complexplane` and `linalg`.

    Run it in Colab

Three commands to start.

Python 3.10 or newer. NumPy, SciPy, SymPy and Matplotlib come with it.

git clone https://github.com/StativeSh/quantum-playground
cd quantum-playground && make install
.venv/bin/qplay run double-slit