Numerical Methods for Physicists

Lecture course

Author

Kirill Bazarov, Dmitry V. Naumov

Lecture course · in preparation

Numerical Methods for Physicists

A course on how a physicist solves problems that have no analytic solution. One lecture is one physical problem: the pendulum and chaos, a chain of oscillators, electrostatics, heat conduction, waves, quantum mechanics, cosmology, hydrodynamics, radiative transfer. The methods needed (eigenproblems, sparse systems, the FFT, spherical harmonics, the SVD) are introduced when a problem cannot be solved without them. The language is Python with Numba.

Course card on the NeutrinoHit map: in preparation.

Course authors: Kirill Bazarov and Dmitry V. Naumov (profile on NeutrinoHit).

Course lectures

Preparation

01Python, NumPy and Numba

The random walk (\(\langle x^2\rangle=N\)) and \(\pi\) by Monte Carlo: why numerical methods are needed, what numerical error and convergence are, how to trade accuracy against time.

Tools: Jupyter, NumPy arrays, slicing and broadcasting, data types and precision, a seeded random number generator, Matplotlib, timing, Numba; Python versus Mathematica.

Lead author: Dmitry V. Naumov.

Part I. Equations, matrices, motion

02Roots and quadratures

The period of a pendulum at large amplitude (an elliptic integral) and the energy levels of a finite well (a transcendental equation): the exact answer is known, and one sees how numerical methods converge to it.

Tools: bisection, Newton’s method, secants; rectangles, trapezoids, Simpson, Gaussian quadrature; order of convergence, singular integrands.

Lead author: Kirill Bazarov.

03Ordinary differential equations: the pendulum

The pendulum beyond small oscillations; the reference is the energy and the period from lecture 2. First the method works, then one sees where and why it fails.

Tools: Euler, Runge–Kutta and Verlet schemes, order of accuracy and convergence test, adaptive step, events (impact, dry friction), stiffness and implicit Euler.

Lead author: Kirill Bazarov.

04Eigenvalue problems: normal modes

A chain of \(N\) masses and phonons; random masses lead to localization. The limit \(N\to\infty\) gives the wave equation.

Tools: eigh, spectral decomposition, matrix functions (the evolution operator), tridiagonal matrices, the condition number.

Lead author: Kirill Bazarov.

05Chaos and synchronization

The double pendulum, the restricted three-body problem, Kuramoto oscillators. Why an «exact» solution of a chaotic system is impossible and what counts as a result then.

Tools: adaptive Runge–Kutta methods (solve_ivp), the Lyapunov exponent, Poincaré sections, the order parameter, trajectory ensembles with Numba.

Lead author: Kirill Bazarov.

Part II. Fields, diffusion and waves

06Electrostatics: the Poisson equation and multipoles

The potential of conductors in a box (the reference is a capacitor and a Fourier series); a non-conducting sphere with charge density \(\sigma(\theta,\varphi)\): the field inside and outside, exact via spherical harmonics.

Tools: sparse matrices, LU and Cholesky, Jacobi, Gauss–Seidel and conjugate gradient iterations, the multipole expansion, \(Y_{\ell m}\), Gauss–Legendre quadrature.

Lead author: Kirill Bazarov.

07Diffusion and random forces

Cooling of a rod (the reference is the Green function), nonlinear and inhomogeneous media; a Brownian particle under a random force, continuing the random walk of lecture 1.

Tools: explicit and implicit schemes, von Neumann stability, the tridiagonal (Thomas) algorithm, Crank–Nicolson, the method of lines, the Langevin equation (Euler–Maruyama scheme).

Lead author: Kirill Bazarov.

08Waves and the telegraph equation

A string (the reference is d’Alembert’s solution) and a lossy transmission line (Heaviside’s signal): the third type of equation after Poisson and heat conduction.

Tools: characteristics, the Courant condition, numerical dispersion, absorbing boundaries.

Lead author: Dmitry V. Naumov.

09Fourier analysis and the FFT

Frequencies in a noisy signal; solving the diffusion and wave equations in Fourier space; the momentum representation in quantum mechanics.

Tools: the FFT, aliasing, windows, convolution, spectral derivatives.

Lead author: Kirill Bazarov.

Part III. Quantum mechanics

10Stationary quantum mechanics

The oscillator (reference), the anharmonic oscillator, the double well, the hydrogen atom; scattering on a barrier.

Tools: the Hamiltonian as a matrix, shooting, Numerov, the variational method, the transmission coefficient, convergence of levels.

Lead author: Kirill Bazarov.

11Quantum evolution and neutrino oscillations

Wave packets and tunnelling; \(2\nu\) oscillations (exact) and \(3\nu\) oscillations in matter of varying density.

Tools: Crank–Nicolson and unitarity, split-step with the FFT, the matrix exponential (expm).

Lead author: Dmitry V. Naumov.

Part IV. Data and statistical physics

12Interpolation and approximation

Reconstruct a function from points when the function itself is known (the reference), and see why more nodes are not always better.

Tools: the Lagrange polynomial, the Runge phenomenon, Chebyshev nodes, splines, least squares, the danger of extrapolation.

Lead author: Kirill Bazarov.

13Monte Carlo in statistical physics: the Ising model

The two-dimensional Ising model: the phase transition, the critical temperature and thermodynamic quantities; the reference is Onsager’s exact solution.

Tools: the Metropolis algorithm, autocorrelation and errors, finite-size effects, heat capacity and susceptibility, Numba acceleration.

Lead author: Kirill Bazarov.

14Inverse problems: the reactor antineutrino spectrum and the SVD

The positron spectrum is measured, the antineutrino spectrum is needed: a response matrix with detector resolution and its inversion.

Tools: the singular value decomposition, the condition number, the pseudo-inverse, truncated SVD and Tikhonov regularization, deconvolution.

Lead author: Dmitry V. Naumov.

Part V. Flows, transport and machine learning

15Hydrodynamics: shock waves and vortices

The Burgers equation (the reference is the Hopf–Cole solution), the Sod shock tube (a Riemann problem); briefly, Taylor–Green vortices.

Tools: conservative schemes, finite volumes, the Godunov scheme, limiters, the pseudo-spectral method.

Lead author: Dmitry V. Naumov.

16The transport equation: from Boltzmann to light in water

A photon in a turbid medium: ballistics, diffusion (lecture 7), finite speed (lecture 8). The example is light in Lake Baikal and a neutrino telescope.

Tools: Monte Carlo for transport, the diffusion approximation, expansion in angular moments (\(P_N\)).

Lead author: Dmitry V. Naumov.

17Machine learning for differential equations

The oscillator and the heat equation with known solutions: what a neural network gives and what it costs compared with classical methods.

Tools: a neural network as an approximator, physics-informed networks (PINN), comparison with classical methods in accuracy and cost.

Lead author: Kirill Bazarov.