Computational Physics Tutorial
Learn Computational Physics step by step: 47 lessons in 9 chapters with examples, quizzes, diagrams and practice.
Start learning →
of lessons completed
Getting Started
- Course Map: Computational Physics See the whole computational physics course at a glance: who it is for, what you need, how to study it, and a nine-chapter map from Python basics to quantum simulations.
- What Is Computational Physics? Learn what computational physics is, how it sits beside theory and experiment, and the model, algorithm, code and check loop behind every trustworthy simulation.
- Python and NumPy for Physics Learn the NumPy skills every simulation needs: arrays, linspace, vectorized formulas, slicing, masks, broadcasting and physical constants, with runnable physics examples.
- Plotting Physics Data with Matplotlib Learn to draw clear physics plots with Matplotlib: labeled axes with units, error bars, log scales, subplots and residuals, with runnable examples and a checklist.
- Chapter 1 Review: Getting Started Review chapter 1 of the computational physics course: the simulation workflow, NumPy arrays, and plotting habits, with a recap table and a ten-question quiz.
Numerical Foundations
- Numerical Foundations: Overview Preview chapter 2 of the computational physics course: floating point numbers, derivatives and integrals on a grid, root finding, and the error budget that ties them together.
- Floating Point Numbers and Errors Understand IEEE 754 doubles, machine epsilon, overflow, catastrophic cancellation and safe summation, with runnable examples on the quadratic formula and long sums.
- Derivatives and Integrals on a Grid Learn finite-difference derivatives, the trapezoid and Simpson rules, orders of accuracy and the error floor from round-off, with runnable Python examples.
- Roots and Linear Systems Solve f(x) = 0 with bisection, Newton and SciPy, apply it to Kepler's equation, and solve linear systems such as circuits with numpy.linalg.solve and condition numbers.
- Chapter 2 Review: Numerical Foundations Review chapter 2: floating point and round-off, derivatives and integrals on a grid, root finding and linear systems, with a recap table and a ten-question quiz.
Ordinary Differential Equations
- Ordinary Differential Equations: Overview Preview chapter 3: how physics becomes ordinary differential equations, how to turn second-order equations into first-order systems, and how the methods in this chapter fit.
- Euler's Method Learn Euler's method for ordinary differential equations: the algorithm, why its global error is first order, how to test it, and when a large step makes it unstable.
- Runge-Kutta Methods Learn the midpoint and classical fourth-order Runge-Kutta methods, implement RK4 in Python, measure convergence order, and compare accuracy per function evaluation.
- Oscillators and Energy: Leapfrog and Verlet Learn why Euler and RK4 drift in energy on oscillators and how symplectic methods such as leapfrog and velocity Verlet keep energy bounded, with a pendulum period test.
- Projectile Motion with Air Drag Simulate a projectile with quadratic air drag using scipy solve_ivp and event detection, find the best launch angle, check limits and terminal velocity, and see why drag skews the arc.
- Chapter 3 Review: Ordinary Differential Equations Review chapter 3: initial value problems, Euler, Runge-Kutta, symplectic leapfrog and solve_ivp, with a method comparison table and a ten-question quiz.
Monte Carlo Methods
- Monte Carlo Methods: Overview Preview chapter 4: how random sampling solves problems in physics, from estimating pi to random walks and the Ising model, and why the error falls as one over the square root of N.
- Random Numbers and Sampling Learn how pseudo-random generators work, why seeds matter, and how to sample exponential, Gaussian and direction distributions by inverse transform, Box-Muller and rejection.
- Monte Carlo Integration Estimate integrals by averaging random samples, report the standard error, see why the 1/sqrt(N) law holds in any dimension, and cut the variance with importance sampling.
- Random Walks and Diffusion Simulate random walks in one and two dimensions, show that the mean squared distance grows linearly with time, and extract the diffusion coefficient from the simulation.
- The Ising Model and the Metropolis Algorithm Simulate the 2D Ising model with the Metropolis algorithm: spins, energy, Boltzmann weights, magnetization, the phase transition at Tc = 2.269, and an interactive lattice.
- Chapter 4 Review: Monte Carlo Methods Review chapter 4: random numbers and sampling, Monte Carlo integration, random walks and the Metropolis algorithm for the Ising model, with a recap table and a ten-question quiz.
Partial Differential Equations
- Chapter overview: partial differential equations See the big picture of numerical PDEs: heat, wave and Laplace equations, why grids work, and what every lesson in this chapter covers.
- The heat equation and the FTCS scheme Solve the 1D heat equation on a grid with the explicit FTCS scheme, see why r must stay below one half, and fix it with an implicit method.
- The wave equation and the leapfrog scheme Simulate a vibrating string with the leapfrog scheme, learn the CFL stability condition and see the numerical errors that appear when r is below one.
- The Laplace equation and relaxation methods Solve the 2D Laplace equation by relaxation: Jacobi, Gauss-Seidel and successive over-relaxation, with iteration counts and a check against exact symmetry.
- Chapter 5 review: partial differential equations A one-picture recap of the heat, wave and Laplace solvers, their stability rules, and a ten-question quiz covering the whole chapter.
Molecular Dynamics
- Chapter overview: molecular dynamics What molecular dynamics is, how a simulation loop works, and what you will build in this chapter: forces, the Verlet integrator, and measured temperature and pressure.
- Forces and boundaries: Lennard-Jones and the minimum image Compute Lennard-Jones forces in Python, apply a cut-off, and use periodic boundaries with the minimum image convention to simulate a bulk fluid.
- Velocity Verlet and energy conservation Why molecular dynamics uses velocity Verlet: compare it with Euler, watch energy drift, test time reversibility and choose a safe time step.
- Temperature, pressure and structure Turn raw trajectories into physics: kinetic temperature, virial pressure, velocity-rescaling thermostat and the radial distribution function of a Lennard-Jones liquid.
- Chapter 6 review: molecular dynamics A recap of the molecular dynamics chapter in one picture and one table, plus a ten-question quiz on forces, integrators, boundaries and measurements.
Quantum Simulations
- Chapter overview: quantum simulations A map of numerical quantum mechanics: solving the SchrΓΆdinger equation on a grid, evolving wave packets, and using the variational principle, in natural units.
- Energy levels from matrices Solve the 1D time-independent SchrΓΆdinger equation with a finite-difference matrix and scipy: particle in a box, harmonic oscillator and a finite well, with error checks.
- Wave packets and tunneling Evolve a quantum wave packet with the split-step Fourier method, watch it hit a barrier, and check the transmitted fraction against the exact tunneling formula.
- The variational method Use the variational principle to bound a ground-state energy: trial Gaussians for the quartic oscillator and hydrogen, plus a Monte Carlo local-energy estimate.
- Chapter 7 review: quantum simulations One-picture recap of grid eigenvalue solvers, split-step wave packet evolution and the variational principle, with a recap table and a ten-question quiz.
Data Analysis and Projects
- Chapter overview: data analysis How to turn simulation output and measurements into results you can defend: fits, uncertainties, spectra and honest reporting, with a map of the chapter.
- Fitting models to data Fit lines and curves to data with weighted least squares, read parameter uncertainties from chi-square and covariance, and compare with a bootstrap.
- Fourier analysis of signals Find the frequencies hidden in a noisy signal with the FFT. Learn frequency resolution, the Nyquist limit, aliasing and window functions with checked examples.
- Chapter 8 review: data analysis A recap of fitting, uncertainty estimation and Fourier analysis in one picture and one table, plus a ten-question quiz mixing the whole chapter.
Projects and Practice
- Project: the chaotic double pendulum Simulate a double pendulum with a fourth-order Runge-Kutta integrator, verify energy conservation, and measure how tiny differences in the start grow exponentially.
- Project: gravity and the N-body problem Simulate Kepler orbits and the three-body figure-eight with Euler, velocity Verlet and RK4, and learn to audit energy and angular momentum.
- Practice set: eight exercises Eight hands-on exercises covering PDEs, molecular dynamics, quantum tunneling, fitting, spectra and convergence, with hints and self-checking Python solutions.
- Glossary and units A reference glossary of the terms, symbols and units used in numerical PDEs, molecular dynamics, quantum simulation and data analysis, with flashcards.
- One-page cheat sheet A one-page recap with a poster of the key schemes, stability rules and checks, plus a tested mini-library of reference implementations in Python.
- Where to go next A roadmap from this course to research-grade simulation: numerical methods, Monte Carlo, statistical mechanics, GPUs and your own project, with a scaling calculator.