Computational Physics
Solving physics problems numerically with Python and its standard library: the chain from physical model to verified program, modelling, data, discretization and round-off errors and how to measure the order of a method, with the exact large-amplitude pendulum period from the arithmetic–geometric mean; IEEE 754 floating point, machine epsilon, catastrophic cancellation, conditioning, stable and unstable recurrences and compensated summation; finite-difference derivatives from Taylor series, the balance of truncation and round-off, Richardson extrapolation, and root finding by bisection, Newton, secant and fixed-point iteration applied to Wien's displacement law and Kepler's equation; quadrature by the trapezoid, Simpson, Romberg, adaptive and Gauss–Legendre rules with the Debye heat capacity of copper; ordinary differential equations by Euler and Runge–Kutta methods, stability and adaptive step control for a baseball with air drag; symplectic Euler and velocity Verlet for Kepler orbits and the figure-eight three-body orbit; boundary value and eigenvalue problems by shooting and the Numerov method for quantum wells and the harmonic oscillator; the heat, wave and Laplace equations with von Neumann and CFL stability, Crank–Nicolson, the Thomas algorithm and over-relaxation; Gaussian elimination, conditioning, normal modes of chains and molecules by power iteration and Jacobi rotations; pseudorandom numbers, sampling, Monte Carlo integration, importance sampling and the Metropolis algorithm; weighted least squares, chi-squared, uncertainty propagation and the fast Fourier transform with aliasing and leakage; and a capstone simulation of the two-dimensional Ising model from exact enumeration to blocked error bars, critical slowing down and finite-size effects, with runnable Python examples throughout.
PHYS-234 Year 2 3 credits 12 lessons · 4 h 58 min ▶ Video lessons coming soon
Offered by HSM University · Physics
What you'll learn
- Describe the chain from physical model to program, distinguish modelling, data, discretization and round-off errors, and verify a computation by measuring its order of convergence.
- Explain how IEEE 754 double-precision numbers are stored, predict when cancellation or ill conditioning will destroy accuracy, and rewrite formulas and recurrences to be numerically stable.
- Derive finite-difference formulas from Taylor series, choose step sizes that balance truncation and round-off, apply Richardson extrapolation, and solve equations by bisection, Newton, secant and fixed-point methods.
- Integrate functions with the trapezoid, Simpson, Romberg, adaptive and Gauss–Legendre rules, state their error orders, and handle singular, infinite and periodic integrals.
- Solve initial value problems with Euler and Runge–Kutta methods, analyse their stability, and control the error with adaptive step sizes, including projectile motion with air resistance.
- Integrate conservative systems with symplectic Euler and velocity Verlet, explain why their energy errors stay bounded, and simulate Kepler orbits and three-body motion.
- Solve boundary value and eigenvalue problems by shooting and the Numerov method, including bound-state energies of quantum wells and the harmonic oscillator.
- Discretize the heat, wave and Laplace equations, derive the von Neumann and CFL stability conditions, and apply implicit schemes, the Thomas algorithm and relaxation methods.
- Solve linear systems by Gaussian elimination with pivoting, judge their conditioning, and compute normal modes and energy levels with power iteration and Jacobi rotations.
- Generate and test pseudorandom numbers, sample from physical distributions, estimate integrals by Monte Carlo with error bars and importance sampling, and sample Boltzmann distributions with the Metropolis algorithm.
- Fit models to data by weighted least squares, propagate uncertainties, interpret chi-squared and residuals, and analyse signals with the fast Fourier transform, recognizing aliasing and leakage.
- Carry out a complete simulation study of the two-dimensional Ising model, from verification by exact enumeration to correlated error analysis, finite-size effects and a defensible report.
Course content
12 lessons · 4 h 58 min total · final exam
- 1 Why computational physics: models, algorithms and error 25 min · quiz
- 2 Floating point, round-off and numerical stability 23 min · quiz
- 3 Numerical differentiation and root finding 23 min · quiz
- 4 Numerical integration: trapezoid, Simpson and Gaussian quadrature 24 min · quiz
- 5 Ordinary differential equations: Euler, Runge–Kutta and adaptive steps 25 min · quiz
- 6 Symplectic integrators and orbital mechanics 25 min · quiz
- 7 Boundary value problems and the shooting method 25 min · quiz
- 8 Partial differential equations: heat, wave and Laplace by finite differences 26 min · quiz
- 9 Linear algebra in physics: eigenvalue problems and normal modes 26 min · quiz
- 10 Monte Carlo methods: random numbers, integration and the Metropolis algorithm 25 min · quiz
- 11 Data analysis: fitting, uncertainty and the fast Fourier transform 26 min · quiz
- 12 Capstone: the Ising model from algorithm to phase transition 25 min · quiz
- E Final exam 20 questions
Requirements
Recommended background. You can start any course at any time.
Description
Solving physics problems numerically with Python and its standard library: the chain from physical model to verified program, modelling, data, discretization and round-off errors and how to measure the order of a method, with the exact large-amplitude pendulum period from the arithmetic–geometric mean; IEEE 754 floating point, machine epsilon, catastrophic cancellation, conditioning, stable and unstable recurrences and compensated summation; finite-difference derivatives from Taylor series, the balance of truncation and round-off, Richardson extrapolation, and root finding by bisection, Newton, secant and fixed-point iteration applied to Wien's displacement law and Kepler's equation; quadrature by the trapezoid, Simpson, Romberg, adaptive and Gauss–Legendre rules with the Debye heat capacity of copper; ordinary differential equations by Euler and Runge–Kutta methods, stability and adaptive step control for a baseball with air drag; symplectic Euler and velocity Verlet for Kepler orbits and the figure-eight three-body orbit; boundary value and eigenvalue problems by shooting and the Numerov method for quantum wells and the harmonic oscillator; the heat, wave and Laplace equations with von Neumann and CFL stability, Crank–Nicolson, the Thomas algorithm and over-relaxation; Gaussian elimination, conditioning, normal modes of chains and molecules by power iteration and Jacobi rotations; pseudorandom numbers, sampling, Monte Carlo integration, importance sampling and the Metropolis algorithm; weighted least squares, chi-squared, uncertainty propagation and the fast Fourier transform with aliasing and leakage; and a capstone simulation of the two-dimensional Ising model from exact enumeration to blocked error bars, critical slowing down and finite-size effects, with runnable Python examples throughout.
Part of the Science stream, typically taken in year 2.