Numerical Methods in Physics with Python (2nd Edition)

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

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. The second edition of this introductory book features several new codes and 140 new problems (many on physics applications), as well as new sections on the singular-value decomposition, derivative-free optimization, Bayesian linear regression, neural networks, and partial differential equations. The last section in each chapter is an in-depth project, tackling physics problems that 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.

Author(s): Alex Gezerlis
Edition: 2
Publisher: Cambridge University Press
Year: 2023

Language: English
Pages: 705

1 Idiomatic Python 1
1.1 Why Python? 2
1.2 Code Quality 3
1.3 Summary of Python Features 4
1.4 Core-Python Idioms 10
1.5 Basic Plotting with matplotlib 13
1.6 NumPy Idioms 15
1.7 Project: Visualizing Electric Fields 21
Problems 25
2 Numbers 31
2.1 Motivation 31
2.2 Errors 32
2.3 Representing Real Numbers 41
2.4 Rounding Errors in the Wild 48
2.5 Project: the Multipole Expansion in Electromagnetism 63
Problems 78
3 Derivatives 89
3.1 Motivation 89
3.2 Analytical Differentiation 90
3.3 Finite Differences 91
3.4 Automatic Differentiation 109
3.5 Project: Local Kinetic Energy in Quantum Mechanics 113
Problems 121
4 Matrices 126
4.1 Motivation 126
4.2 Error Analysis 130
4.3 Solving Systems of Linear Equations 138
4.4 Eigenproblems 167
4.5 The Singular-Value Decomposition 197
4.6 Project: the Schr¨odinger Eigenvalue Problem 205
Problems 213
ix
x Contents
5 Zeros and Minima 232
5.1 Motivation 232
5.2 Non-linear Equation in One Variable 235
5.3 Zeros of Polynomials 261
5.4 Systems of Non-Linear Equations 268
5.5 One-DimensionalMinimization 276
5.6 MultidimensionalMinimization 282
5.7 Project: Extremizing the Action in Classical Mechanics 297
Problems 305
6 Approximation 317
6.1 Motivation 317
6.2 Polynomial Interpolation 323
6.3 Cubic-Spline Interpolation 339
6.4 Trigonometric Interpolation 347
6.5 Linear Least-Squares Fitting 367
6.6 Linear Statistical Inference 383
6.7 Non-Linear Least-Squares Fitting 408
6.8 Project: Testing the Stefan–Boltzmann Law 422
Problems 429
7 Integrals 453
7.1 Motivation 453
7.2 Newton–Cotes Methods 456
7.3 Adaptive Integration 474
7.4 Romberg Integration 479
7.5 Gaussian Quadrature 487
7.6 Complicating the Narrative 501
7.7 Monte Carlo 508
7.8 Project: Variational Quantum Monte Carlo 534
Problems 546
8 Differential Equations 566
8.1 Motivation 566
8.2 Initial-Value Problems 570
8.3 Boundary-Value Problems 601
8.4 Eigenvalue Problems 608
8.5 Partial Differential Equations 617
8.6 Project: Poisson’s Equation in Two Dimensions 625
Problems 632
Appendix A Installation and Setup 657
Contents xi
Appendix B Number Representations 658
B.1 Integers 658
B.2 Real Numbers 659
Problems 663
Appendix C Math Background 664
C.1 Taylor Series 664
C.2 Matrix Terminology 665
C.3 Probability 668
Bibliography 671
Index 677