Examples#

Runnable, self-contained scripts demonstrating every chapter of physicskit.quantum – from arbitrary-potential bound states through wave-packet dynamics, entanglement, and Floquet driving.

Each script in this gallery is self-contained and can be run directly with python examples/quantum/<section>/<script>.py. Every script also carries an RST module docstring as its title/description and uses # %% markers to split narrative text from code, which is exactly what Sphinx-Gallery renders into the pages below – the script is the source of truth for what you see, not a copy of it.

Sections#

  • potentials – bound and scattering states in model potentials: the matrix Numerov solver for step and finite square wells and the gravitational “quantum bouncer” (checked against exact Airy-function zeros), real-time animated barrier tunneling and well scattering, double-well tunneling (including an animated complex-valued version), 2D quantum boxes, and the Ramsauer-Townsend transmission resonance.

  • wave_packets – time-dependent dynamics: de Broglie’s traveling matter wave, dispersion (with an animated view of the spreading), twin-slit interference and quantum revivals, Ehrenfest’s theorem in an anharmonic well, and a phase-colored tunneling animation.

  • harmonic_oscillator – the harmonic oscillator suite of eigenstates and coherent/squeezed states, an animated Fock-state superposition, its Wigner phase-space quasi-probability distribution, and the raw ladder-operator algebra the whole suite is built on.

  • hydrogen – the hydrogen atom’s orbitals in three dimensions, including an animated two-eigenstate superposition beating at the Bohr frequency.

  • entanglement – Bloch-sphere spin dynamics (Larmor precession and an animated Rabi oscillation), Bell correlations, the topological Aharonov-Bohm effect, and the dynamical generation of entanglement between two Ising-coupled qubits.

  • measurement – projective measurement and the Born rule, the position-momentum uncertainty bound traced to its operator-algebra root, and two measurement/interference demonstrations propagated genuinely in time: the double-slit experiment and Stern-Gerlach beam splitting.

  • perturbation – Stark/Zeeman splitting from perturbation theory and Floquet driving.

  • atoms_molecules – the Hartree-Fock self-consistent field for helium and the hydrogen molecule.

  • scattering – 3D potential scattering: Rutherford’s formula from the Born approximation and partial-wave phase shifts of the hard sphere and square well.

  • relativistic – the Dirac equation’s hydrogen fine structure and Klein’s paradox for Dirac and Klein-Gordon particles.

  • open_systems – a qubit coupled to its environment: Lindblad \(T_1\)/\(T_2\) decay and the quantum-trajectory (Monte Carlo wavefunction) unravelling of the same dynamics.

  • quantum_computing – a state-vector circuit simulator: the Deutsch-Jozsa algorithm, the quantum Fourier transform and Shor’s period finding, and Grover search.

  • tensor_networks – matrix product states and TEBD: a quench checked against exact time evolution, and the ground state of a 60-site Heisenberg chain.

Atoms and molecules#

Many-electron quantum mechanics by the self-consistent-field method: Hartree-Fock energies of the hydrogen molecule and the helium atom, from the minimal STO-3G basis to the Hartree-Fock limit.

Hartree-Fock: the self-consistent field for H₂ and helium

Hartree-Fock: the self-consistent field for H₂ and helium

Entanglement and topology#

Bell/EPR spin correlations and the CHSH inequality, the Aharonov-Bohm effect (a purely topological consequence of the vector potential), Bloch-sphere qubit dynamics (Larmor precession and an animated Rabi oscillation), the dynamical generation of entanglement between two qubits coupled by an Ising interaction, Schrödinger’s entanglement and cat, and why no fixed unitary can clone an arbitrary qubit state (the no-cloning theorem).

The Aharonov-Bohm effect

The Aharonov-Bohm effect

Rabi’s magnetic resonance on the Bloch sphere

Rabi's magnetic resonance on the Bloch sphere

Bell correlations and the CHSH inequality

Bell correlations and the CHSH inequality

Dynamical entanglement generation

Dynamical entanglement generation

The no-cloning theorem: why a fixed unitary can copy a basis, not a state

The no-cloning theorem: why a fixed unitary can copy a basis, not a state

Schrödinger names entanglement: the whole known, the parts not

Schrödinger names entanglement: the whole known, the parts not

Harmonic oscillator#

Planck’s quantized oscillators and the blackbody spectrum, and the quantum harmonic oscillator suite: Fock states, Glauber coherent states, squeezed states, thermal broadening, an animated Fock-state superposition, and the Wigner quasi-probability distribution in phase space.

The harmonic oscillator suite

The harmonic oscillator suite

Dirac’s ladder-operator method

Dirac's ladder-operator method

Planck’s quantum hypothesis and blackbody radiation

Planck's quantum hypothesis and blackbody radiation

Wigner phase-space quasi-probability

Wigner phase-space quasi-probability

Hydrogen orbitals#

Wilson-Sommerfeld elliptical orbits and fine structure, Pauli’s exclusion principle and spin matrices, radial wavefunctions, the hydrogen energy-level ladder, 3D volumetric electron-density rendering, and an animated two-eigenstate superposition beating at the Bohr frequency.

Hydrogen orbitals

Hydrogen orbitals

Pauli’s exclusion principle and spin matrices

Pauli's exclusion principle and spin matrices

Wilson-Sommerfeld quantization: elliptical orbits and fine structure

Wilson-Sommerfeld quantization: elliptical orbits and fine structure

Measurement#

The Born rule made concrete: simulated projective measurement outcomes converging to the analytic probability density; the position-momentum uncertainty bound; and two classic measurement/interference demonstrations propagated genuinely in time – the double-slit experiment and Stern-Gerlach beam splitting.

The Born rule

The Born rule

The double-slit experiment, propagated in time

The double-slit experiment, propagated in time

Heisenberg’s uncertainty principle

Heisenberg's uncertainty principle

The Stern-Gerlach experiment

The Stern-Gerlach experiment

Open quantum systems#

A qubit that leaks energy and phase into its environment: the Lindblad master equation’s \(T_1\) relaxation and \(T_2\) dephasing, and the Monte Carlo wavefunction method that unravels the same dynamics into individual jumping quantum trajectories.

The Lindblad master equation: T1 relaxation and T2 dephasing

The Lindblad master equation: T1 relaxation and T2 dephasing

Quantum trajectories: the Monte Carlo wavefunction method

Quantum trajectories: the Monte Carlo wavefunction method

Perturbation and Floquet driving#

Static perturbation theory (linear Stark splitting and Zeeman sublevel splitting) and time-dependent perturbation theory (multiphoton transitions in an AC-driven infinite well, via Floquet analysis).

Floquet-driven box: time-dependent perturbation theory

Floquet-driven box: time-dependent perturbation theory

Stark and Zeeman splitting: static perturbation theory

Stark and Zeeman splitting: static perturbation theory

Potentials#

Bound states and scattering in 1D potential wells, and 2D quantum boxes: the matrix Numerov solver applied to asymmetric wells, the gravitational “quantum bouncer” (also solved with WKB and Kramers’s connection phases), the symmetric double well (including an animated, complex-valued tunneling oscillation), the finite square well (bound states, resonant transmission, and real-time animated wavepacket scattering/tunneling), and rectangular/circular/stadium 2D boxes.

2D quantum boxes

2D quantum boxes

Real-time barrier tunneling

Real-time barrier tunneling

Bound states via the matrix Numerov solver

Bound states via the matrix Numerov solver

Double-well tunneling

Double-well tunneling

The Ramsauer-Townsend effect

The Ramsauer-Townsend effect

The WKB approximation: connection formulas on the quantum bouncer

The WKB approximation: connection formulas on the quantum bouncer

Quantum computing#

A state-vector circuit simulator running the first quantum algorithms: Deutsch-Jozsa’s one-query test, the quantum Fourier transform behind Shor’s period finding, and Grover’s square-root search.

The Deutsch-Jozsa algorithm: the first exponential quantum speed-up

The Deutsch-Jozsa algorithm: the first exponential quantum speed-up

Grover’s quantum search: a square-root speed-up

Grover's quantum search: a square-root speed-up

Shor’s period finding and the quantum Fourier transform

Shor's period finding and the quantum Fourier transform

Relativistic quantum mechanics#

The Dirac equation’s exact hydrogen levels and their fine structure, and Klein’s paradox: how Dirac and Klein-Gordon particles scatter off a potential step taller than twice their rest energy.

The Dirac equation and the fine structure of hydrogen

The Dirac equation and the fine structure of hydrogen

Klein’s paradox: relativistic particles at a tall potential step

Klein's paradox: relativistic particles at a tall potential step

Scattering theory#

Three-dimensional potential scattering: Rutherford’s formula recovered from the Born approximation, and the partial-wave phase shifts of the hard sphere and the square well.

The Born approximation: Rutherford scattering from quantum mechanics

The Born approximation: Rutherford scattering from quantum mechanics

Partial-wave analysis: phase shifts of the hard sphere and the square well

Partial-wave analysis: phase shifts of the hard sphere and the square well

Tensor networks#

Matrix product states and time-evolving block decimation (TEBD) for spin chains, checked against exact diagonalization.

TEBD on matrix product states: spin chains beyond exact diagonalization

TEBD on matrix product states: spin chains beyond exact diagonalization

Wave packets#

Non-stationary wave dynamics: electron twin-slit interference built up one detection at a time (with an animated view of the packet spreading), quantum revivals in an infinite well, Ehrenfest’s theorem in an anharmonic potential, and a phase-colored animation of double-well tunneling.

De Broglie’s matter wave

De Broglie's matter wave

Ehrenfest’s theorem in an anharmonic well

Ehrenfest's theorem in an anharmonic well

A phase-colored tunneling animation

A phase-colored tunneling animation

Wave-packet revivals in the infinite square well

Wave-packet revivals in the infinite square well

Jönsson’s electron double slit: interference one electron at a time

Jönsson's electron double slit: interference one electron at a time

Gallery generated by Sphinx-Gallery