Bringing together idiomatic Python programming, foundational numerical methods, and physics applications, this is an ideal standalone textbook for courses on computational physics. All the frequently used numerical methods in physics are explained, including foundational techniques and hidden gems on topics such as linear algebra, differential equations, root-finding, interpolation, and integration. Accompanying the mathematical derivations are full implementations of dozens of numerical methods in Python, as well as more than 250 end-of-chapter problems. Numerical methods and physics examples are clearly separated, allowing this introductory book to be later used as a reference; the penultimate section in each chapter is an in depth project, tackling physics problems which cannot be solved without the use of a computer. Written primarily for students studying computational physics, this textbook brings the non-specialist quickly up to speed with Python before looking in detail at the numerical methods often used in the subject.
- Provides examples of idiomatic usage of Python and the NumPy library, listing and discussing more than 50 complete codes on numerical methods and physics projects
- Carefully explains, using actual derivations and code, topics which often appear mysterious, e.g., rounding error, ill-conditioning, automatic differentiation, the QR eigenvalue method, Lagrange interpolation, the Fast Fourier Transform, Gauss-Legendre quadrature, and Monte Carlo integration
- Online resources provided at numphyspy.org including Python and NumPy tutorials, programs listed in the book, figure files, and solutions for instructors