Computational Physics with Python
Simulate the modern physics frontier from scratch: quantum mechanics and computing, statistical physics and Monte Carlo, chaos, and complex systems.
11 projects, 275 hands-on levels, run in your browser.
Syllabus
- Foundations: code through physics: Never written code before? Start here. You will learn the basics of Python, output, variables, types, decisions, loops, and functions, through motion, speed, force, and energy. By the end you are ready for Project 1.
- Quantum States & Measurement: Represent normalized complex qubit states, preserve relative phase, compute Born probabilities and observable expectations, and simulate a seeded measurement experiment. Compare sampled counts with predictions while keeping finite-sample uncertainty explicit.
- Quantum Gates & Circuits: Build ideal unitary Pauli and Hadamard gates, compose chronological circuits and extend them with ordered tensor products and CNOT. Finish with a reusable circuit report that retains the full operators, states and probabilities.
- Entanglement & Quantum Algorithms: Study pure-state entanglement, conditional measurements and all branches of quantum teleportation, then assemble Grover amplitude amplification. The speedup is in the ideal oracle-query model; a classical state-vector simulation does not gain that speedup.
- Wavefunctions & the Schrodinger Equation: Discretize one-dimensional wavefunctions and zero-Dirichlet Hamiltonians, solve their complete spectra and compare discrete box energies with continuum anchors. Explore the leading barrier attenuation model, then compose a box report with normalized states, density, region probability and discretization error.
- Randomness & Monte Carlo: Simulate random walks, estimate areas and integrals by sampling, and relate statistical error to sample count under explicit assumptions. Assemble a reproducible diffusion experiment with full paths, time-dependent moments and physical step-length and time units.
- Statistical Mechanics: The Ising Model: Build periodic ferromagnetic Ising energy and local-flip models, then implement Metropolis sweeps and a temperature study. Retain burn-in, measurement traces and batch diagnostics, and separate a finite-lattice threshold estimate from the known infinite-lattice critical temperature.
- Nonlinear Dynamics & Chaos: Iterate the logistic map, inspect fixed points and recurrence, and estimate finite-time Lyapunov growth and sensitivity horizons. Explore explicit-Euler Lorenz trajectories and compose a dynamics report that can leave conclusions unresolved when the observation window is insufficient.
- Cellular Automata & Emergence: Implement elementary binary rules and synchronous Conway Life updates with explicit boundaries. Retain complete histories to distinguish still patterns, oscillators and demonstrated glider translations; finite patterns and symmetry alone do not establish chaos or a universal classification.
- Complex Networks: Represent simple undirected graphs and measure degrees, clustering, components and shortest paths. Study a specified shortcut and deterministic synchronous SIR process, then compose a network report that preserves unreachable distances and finite-model limits.
- Capstone: Critical Phenomena: Assemble an open-grid percolation study with retained trial fields and masks, cluster measurements, spanning probabilities, Wilson intervals and a nullable sampled crossing. Build driven sandpile experiments and synthetic power-law fits in separate chapters, distinguishing these finite observations from critical-exponent or universality evidence.
Key concepts
- Cellular automaton: Discrete cells updated by a specified local rule. State set, neighborhood, boundary convention and update timing are part of the model; synchronous rules read…
- Chaos: Deterministic dynamics with sustained sensitivity to initial conditions on the relevant trajectories. Local uncertainty can grow rapidly before reaching the sy…
- Critical phenomena: Scaling and long-range fluctuations near a continuous transition in the appropriate large-system limit. Universality classes depend on features such as dimensi…
- Entanglement: For a bipartite pure state, failure to factor into subsystem vectors. More generally, an entangled density matrix is not a convex mixture of product states. Co…
- Ising model: A model of spins +1 or -1 with specified interactions, field and boundaries. For zero-field nearest-neighbor ferromagnetic coupling J>0, E=-J*sum of neighbo…
- Monte Carlo method: Estimating quantities by suitable random sampling. IID finite-variance sample means have standard error proportional to 1/sqrt(N); correlated Markov-chain obse…
- Observable: A physical measurement quantity represented here by a Hermitian operator A. For a normalized pure state its mean is the conjugating quadratic form psi-dagger A…
- Phase transition: A change in equilibrium macroscopic behavior that can be singular in a thermodynamic limit. Continuous transitions and first-order transitions have different s…
- Quantum state: A pure quantum state is a normalized complex vector in a specified basis; basis-outcome probabilities are squared magnitudes of its amplitudes. A density matri…
- Schrödinger equation: The closed-system equation i hbar dpsi/dt=H psi for a Hamiltonian H. For time-independent H, stationary states solve H psi=E*psi. Numerical methods introduce s…
- Superposition: A coherent linear combination of basis states. Superposition is basis-dependent; relative phase affects other measurements. In an ideal projective measurement,…