01 / Reading Guide
Reading Guide
Citation
Kinder, J. M., & Nelson, P. (2021). A Student's Guide to Python for Physical Modeling (2nd ed.). Princeton University Press.
Chapter Summary
The second edition runs to 240 pages: ten chapters of about 155 pages, seven appendices and a short "Let's Go" preface. The ten chapters alternate between teaching chapters and three "Computer Lab" chapters in which the new tools are applied to modelling problems. Sections and footnotes marked "Track 2" are more advanced and can be skipped on a first reading, according to the preface.
Chapter 1: Getting Started with Python
Algorithmic thinking, the idea of program state and the meaning of an assignment such as a = a + 1 open the book, followed by launching Python in an IPython console, reading error messages, finding help and keeping a log. The chapter ends with modules (import, NumPy and PyPlot) and Python expressions: numbers, arithmetic, predefined functions, variable names and functions.
Chapter 2: Organizing Data
Objects and methods, then lists, tuples and NumPy arrays: creating and filling them, concatenation, indexing, slicing, flattening and reshaping. The chapter also covers strings and their formatting.
Chapter 3: Structure and Control
Loops (for and while), vectorized array operations, matrix math and reducing an array, then scripts and the editor, with sections on good practice in commenting, named parameters and units. It finishes with branching (if statements, testing equality of floats) and nesting.
Chapter 4: Data In, Results Out
Importing data, exporting data to scripts and files, and visualizing data: the plot command, log axes, embellishing and replacing curves, error bars, 3D graphs, multiple plots, subplots and saving figures.
Chapter 5: First Computer Lab
A short lab chapter built around two examples, an HIV model and a bacterial model, each with the steps "explore the model" and "fit experimental data".
Chapter 6: Random Number Generation and Numerical Methods
A long chapter (28 pages). It covers writing functions, random numbers and simulation (coin flips, trajectories), histograms and bar graphs, contour, surface and heat-map plots, numerical solution of nonlinear equations, linear systems, numerical integration and numerical solution of differential equations, and ends with vector fields and streamlines.
Chapter 7: Second Computer Lab
Generating and plotting trajectories, plotting the displacement distribution, and rare events (the Poisson distribution and waiting times).
Chapter 8: Images and Animation
Images as NumPy arrays and their manipulation, displaying data as an image, and creating and saving animations.
Chapter 9: Third Computer Lab
Image processing exercises: convolution (averaging and Gaussian smoothing), denoising an image and emphasizing features.
Chapter 10: Advanced Techniques
Dictionaries, special function arguments, list comprehensions and generators; tools for data science (pandas, scikit-learn); symbolic computing (Wolfram Alpha, SymPy); and writing your own classes, illustrated with a random walk class. The publisher lists data-science libraries, symbolic computing with SymPy and Python classes as new in the second edition.
Appendices
A covers installing Python and Spyder (and FFmpeg and ImageMagick); B command-line tools, text editors and Git version control; C Jupyter notebooks; D errors and error messages; E Python 2 versus Python 3; F "Under the Hood" (assignment, memory, scope); G answers to the "Your Turn" questions. A list of recommended reading and an index follow.
Key Concepts
Chapters 1–4: Language and data
- Algorithmic thinking and state: the way the first chapter frames programming.
- NumPy arrays: the central data structure of Chapters 2 and 3, with slicing and vectorized operations.
- Plotting: PyPlot figures, subplots and 3D graphs in Chapter 4.
Chapters 5–9: Modelling and computing
- Random numbers and simulation: coin flips, trajectories and histograms.
- Numerical methods: root finding, integration and ODE solvers.
- Images as arrays: the basis of Chapters 8 and 9.
Chapter 10 and appendices
- Data-science libraries and SymPy: pandas, scikit-learn and symbolic computing.
- Classes: object-oriented programming illustrated by a random walk.
- Version control: Git in Appendix B.
Critical Analysis
Strengths
- Written for physical modelling. The preface says the authors, working scientists, have removed everything not needed at the outset; the lab chapters apply new tools to modelling problems.
- No programming experience assumed. The publisher states that none is needed, and Chapter 1 begins with algorithmic thinking and a plain explanation of assignment.
- Two tracks. Track 2 sections let a reader skip more advanced material.
- Practical support. Code samples and data sets are available online, "Your Turn" questions have answers in Appendix G, and appendices cover installation, command-line tools, Git and debugging.
- Updated for the second edition. The publisher lists new material on SymPy, pandas and scikit-learn, object-oriented programming and a Git appendix.
Limitations
- A starting point, not a reference. With about 155 pages of chapters it teaches the basics; for deeper numerical analysis, a larger text is needed.
- Machine learning is only introduced. Section 10.2.2 on scikit-learn is about three pages.
- Tool-specific. The installation and editing material is built around Python with Spyder, with Jupyter in a separate appendix, so some steps may date as tools change.
- No published review was located.
Where It Fits in the Course
This is the gentlest entry in the computational-physics list and the one to start with if programming is new. Newman's Computational Physics is Python-based with worked examples and exercises on integration, differential equations, Fourier methods and Monte Carlo, and is a natural next step. Landau, Páez and Bordeianu's Computational Physics covers a broad range of problems coded in Python, including quantum mechanics and fluids. Press and colleagues' Numerical Recipes is a reference with complete routines and discussion of pitfalls, and Thijssen's Computational Physics is a graduate treatment of research methods such as molecular dynamics and quantum Monte Carlo. Taylor's An Introduction to Error Analysis is not a programming book but pairs naturally with the data-analysis chapters, since lab work needs uncertainty estimates.
How to Use This Book
The book suits physics, engineering and science students with introductory calculus and physics, and no programming. It is meant to be read at a computer.
A practical plan: work through Appendix A to install Python first. Then do Chapters 1 to 4 in order, trying every code sample; this is the core language and plotting toolkit. Do the First Computer Lab (Chapter 5) before continuing. Chapter 6 is the heart of the book for physical modelling and deserves the most time. Chapters 8 and 9 are optional for students not working with images; Chapter 10 is for those moving to larger projects. Keep Appendix D for debugging, skip Track 2 sections at first, and check the "Your Turn" answers in Appendix G.
