dorkhub

PHYS6350-ComputationalPhysics

Lecture notes and code for the course PHYS6350 Computational Physics at the University of Houston

vlvovch
Jupyter Notebook22163 forksupdated 6 months ago
visit the demogit clone https://github.com/vlvovch/PHYS6350-ComputationalPhysics.gitvlvovch/PHYS6350-ComputationalPhysics

Binder

PHYS6350 Computational Physics

This repository contains the lecture notes and computer code for the graduate course PHYS6350 Computational Physics taught at the University of Houston in Spring 2023 & Spring 2025.

The course is designed for graduate/advanced undergraduate physics students. The focus is on the concepts behind the numerical methods used in computational physics over the implementation. For this reason, most of the code is in Python and uses Jupyter Notebooks for presentation. For the same reason, many standard routines (such as linear equation solvers) are reimplemented.

The materials presented in this repository should be useful both for self-study, as a reference for the course PHYS6350 Computational Physics, and for instructors to use as a reference for their own courses.

Online textbook (lecture notes)

The lecture notes have been done in Jupyter notebook format and converted to HTML using Jupyter Book. The online version of the lecture notes is available at https://vovchenko.net/computational-physics/

Other textbooks

There is no assigned textbook but the following textbooks can be useful:

Many of the problems and examples are taken from the first book, these are referenced in the lecture notes where applicable.

Syllabus

The syllabus for the course is available for Spring 2023 and Spring 2025 editions.

Lecture notes and code

  • Lecture slides: folder slides
  • Sample programs and notebooks: folder code
  • Jupyter Book: folder book

Course outline

  1. Plotting [Lecture (pdf), Code (ipynb)]

  2. Floating-Point Precision [Lecture (pdf), Code (ipynb)]

  3. Function Interpolation [Lecture (pdf), Code (ipynb)]

    • Linear interpolation
    • Polynomial Interpolation in Lagrange and Newton forms
    • Bilinear interpolation (two variables)
  4. Linear Algebra and Matrices

    • Lecture 1 [pdf, Code (ipynb)]
      • Gaussian elimination
      • Pivoting
      • LU-decomposition
    • Lecture 2 [pdf, Code (ipynb)]
      • Matrix inversion
      • Tri- and band-diagonal systems
      • QR decomposition
      • Eigenvalue problem
  5. Non-Linear Equations

    • Lecture 1 [pdf, pptx (for animations), Code (ipynb), Generate Animations (ipynb)]
      • Bisection method
      • Secant and Newton-Raphson method
    • Lecture 2 [pdf, pptx (for animations)]
      • Roots of a polynomial (Code (ipynb)
      • Multi-dimensional Newton and Broyden methods (Code (ipynb)
      • Search for extrema (minimum/maximum) (Code (ipynb)
  6. Numerical integration

    • Lecture 1 [Lecture (pdf, pptx (for animations), Code (ipynb))]
      • Rectangle, trapezoidal, and Simpson rules
      • Composite and adaptive rules, error control
      • Improper integrals
    • Lecture 2 [Lecture (pdf, pptx), Code (ipynb)]
      • Newton-Cotes quadrature
      • Clenshaw-Curtis quadrature
      • Gaussian quadrature
  7. Numerical differentiation [Lecture (pdf), Code (ipynb)]

    • Forward, backward, and central difference
    • High-order approximations and derivatives
    • Balancing truncation and round-off errors
    • Automatic differentiation
  8. Ordinary differential equations (ODE)

    • Lecture 1 [pdf, pptx, Code (ipynb)]

      • Euler, midpoint (RK2), and RK4 methods
      • Adaptive step
      • Stiff equations, stability, and implicit methods
      • Systems of ODEs
      • Simple pendulum
    • Lecture 2 [pdf, pptx, Code (ipynb)]

      • Leapfrog, modified midpoint and Bulirsch-Stoer methods
      • Simple pendulum
      • Comet motion, SIR model
      • Boundary value problems and the shooting method
    • Classical mechanics problems [Lecture (pdf, pptx), Code (ipynb)]

      • Three-body problem
      • Non-linear pendulum
      • Double pendulum and chaotic motion (simulation + animation code)
  9. Molecular dynamics [Lecture (pdf, pptx), Code (ipynb)]

    • Classical N-body problem
    • Lennard-Jones fluid
    • Equilibration and thermodynamics
  10. Partial differential equations (PDE)

    • Lecture 1 [pdf, pptx, Code (ipynb)]
      • Boundary value problems
      • Finite difference method
      • Jacobi and Gauss-Seidel methods
    • Lecture 2 [pdf, pptx, Code (ipynb)]
      • Initial value problems
      • FTCS, implicit, and Crank-Nicolson schemes
      • Heat equation
      • Wave equation
  11. Random numbers and Monte Carlo methods

    • Lecture 1 [pdf, pptx, Code (ipynb)]
      • Pseudo-random number generators
      • Computing integrals
        • As the area under the curve
        • Mean-value method
      • Sampling non-uniformly distributed random numbers
        • Inverse transform sampling
        • Rejection sampling
    • Lecture 2 [pdf, pptx, Code (ipynb)]
      • Multi-dimensional integrals
      • Importance sampling
  12. Statistical physics problems

    • Lecture 1 [pdf, pptx, Code (ipynb)]
      • Markov Chain Monte Carlo (MCMC)
      • Metropolis-Hastings algorithm
      • Simulation of the 2D Ising model
    • Lecture 2 [pdf, pptx, Code (ipynb)]
      • Simulated annealing
      • Percolation threshold simulation
  13. Quantum mechanics [Lecture (pdf, pptx), Code (ipynb)]

    • Matrix method for eigenenergies and eigenstates
    • Time-dependent Schroedinger equation
    • Variational method
  14. Fourier transform [Lecture (pdf), Code (ipynb)]

    • Discrete Fourier Transform
    • Fast Fourier Transform
  15. Introduction to Machine Learning [pdf, pptx]

more like this

BubbleML

A multiphase multiphysics dataset and benchmarks for scientific machine learning

Python50

SimGAN

Pytorch Implementation of SimGAN: Hybrid Simulator Identification for Domain Adaptation via Adversarial Reinforcement L…

Python50

ncrystal

NCrystal : a library for thermal neutron transport in crystals and other materials

C++50

search

search projects, people, and tags