Cover....1
Half Title....2
Title Page....4
Copyright Page....5
Contents....6
Preface....10
Chapter 1: Preliminaries....14
Chapter 2: Classic numerical methods....17
2.1. CALCULATING SERIES....17
2.2. SOLUTIONS OF NONLINEAR ALGEBRAIC EQUATIONS....19
2.2.1. Example: Root finding, a pathological case....20
2.3. OPTIMIZATION....26
2.3.1. Univariant optimization....26
2.3.2. Multivariant optimization....27
2.4. INTERPOLATION....28
2.4.1. Example: Linear interpolation and cubic splines....30
2.5. FUNCTION APPROXIMATION....31
2.5.1. Example: Polynomial function approximation....32
2.6. MATRICES AND EIGENSYSTEMS....35
2.6.1. Example: Matrices and eigensystems....37
2.7. INTEGRATION....42
2.7.1. Example: Integration....46
2.8. FINITE DIFFERENCES....48
2.8.1. Example: Finite differences....51
2.9. EXAMPLE: LAMBDIFICATION....56
2.10. PROBLEMS....59
Chapter 3: Differential equations....69
3.1. ORDINARY DIFFERENTIAL EQUATIONS....69
3.1.1. Euler method....70
3.1.2. Fourth-order Runge-Kutta method....73
3.1.3. Leap-frog and Verlet algorithms....76
3.1.4. Adaptive step size....78
3.1.5. Python libraries for solving ODEs....79
3.1.6. Boundary-value problems....80
3.1.7. Pseudo-spectral methods....81
3.1.8. Asymptotic iteration method....84
3.1.9. Frobenius method....90
3.1.10. Examples: Ordinary differential equations....92
3.2. PARTIAL DIFFERENTIAL EQUATIONS....113
3.2.1. Laplace equation....115
3.2.2. Diffusion equation....119
3.2.3. Wave equation....121
3.2.4. Continuity equation....122
3.2.5. Schrdinger equation....127
3.2.6. von Neumann stability analysis....128
3.2.7. Examples: Partial differential equations....132
3.3. PROBLEMS....145
Chapter 4: Fourier transforms....166
4.1. DISCRETE FOURIER TRANSFORM....167
4.2. FAST-FOURIER TRANSFORM....168
4.3. SOME NUMERICAL CONSIDERATION....169
4.3.1. Aliasing....170
4.3.2. Spectral leakage....171
4.4. DIFFERENTIATION WITH FOURIER TRANSFORM....173
4.5. EXAMPLE: FOURIER TRANSFORM....174
4.6. PROBLEMS....181
Chapter 5: Monte Carlo methods....185
5.1. BASIC PROBABILITY AND STATISTICS....185
5.1.1. Probability....185
5.1.2. Probability distributions....187
5.2. MONTE CARLO TECHNIQUES....191
5.2.1. Sampling uniform distributions....192
5.2.2. Random variable generation in Python....192
5.2.3. Random variables and integration....192
5.2.4. Example: Random variables....196
5.3. MONTE CARLO INTEGRATION AND SAMPLING....203
5.3.1. Monte Carlo integration: uniform sampling....203
5.3.2. Monte Carlo integration: importance sampling....205
5.3.3. Example: importance sampling....206
5.3.4. Monte Carlo integration: stratified sampling....213
5.3.5. Example: stratified sampling....213
5.3.6. Monte Carlo in multiple dimensions....217
5.3.7. Example: Monte Carlo....218
5.4. MARKOV CHAIN MONTE CARLO....219
5.4.1. Multidimensional weighted Monte Carlo integration....220
5.4.2. Markov chains and detailed balance....220
5.4.3. Metropolis-Hasting algorithm....221
5.4.4. Example: Random walk....223
5.4.5. Example: Variational Monte Carlo....224
5.5. PROBLEMS....229
Chapter 6: Data analysis....240
6.1. PROPAGATION OF UNCERTAINTIES....240
6.2. KINEMATICS....241
6.2.1. Example: Propagation of uncertainties....243
6.3. STATISTICAL ERROR BARS....249
6.3.1. Poisson n and binomial methods....249
6.3.2. Confidence intervals....250
6.4. PARAMETER ESTIMATION....250
6.4.1. Maximum likelihood....251
6.4.2. Binned Likelihood....252
6.4.3. Variance of the parameter estimators....254
6.4.4. Practical consideration....258
6.4.5. Example: Plotting, error bars and fitting....259
6.4.6. Example: Log-likelihood fits....269
6.5. GOODNESS OF FIT....275
6.6. HYPOTHESIS TESTING....276
6.6.1. Example: Hypothesis testing....278
6.7. PROBLEMS....282
Appendix A: Matplotlib style sheet....288
Appendix B: Data for problems....289
Bibliography....290
Index....294
This book provides a practical introduction to using computational (or numerical) methods to solve physics problems using the Python programming language, including differential equations, Fourier transforms, Monte Carlo methods, and data analysis.
It is designed with a two-level approach: topics are introduced at the lowest level, and readers encounter the simplest examples of coding the algorithm themselves before a second level introduced by the problems allows the reader to use library models and take their understanding to a higher level.
The book does not teach Python programming as students traditionally have already learnt those skills before studying computational methods, but it instead teaches readers to apply their knowledge to solve realistic physics problems.
The book is aimed at advanced undergraduate or beginning graduate students in physics or engineering. A junior-level university (or college) physics and mathematics background is assumed. But readers will not be prevented from understanding or applying numerical methods because of a lack of knowledge in a specific physics area.
Key features: