Toggle Navigation
Everything
Blog posts
Pages
Home
About
The Author
The Book
This Website
Book
Chapter 1: Introduction
Chapter 2: The Core Python Language I
Examples
Questions
Problems
Additional Problems
Chapter 3: Simple Plotting with pylab
Examples
Problems
Chapter 4: The core Python language II
Examples
Questions
Problems
Additional Problems
Chapter 5: IPython and IPython Notebook
Examples
Chapter 6: NumPy
Examples
Questions
Problems
Additional Examples
Additional Problems
Chapter 7: Matplotlib
Examples
Questions
Problems
Chapter 8: SciPy
Examples
Questions
Problems
Additional Examples
Additional Problems
Chapter 9: General Scientific Programming
Examples
Questions
Problems
Errata
Book (2nd ed.)
Chapter 1: Introduction
Chapter 2: The Core Python Language I
Examples
Questions
Problems
Additional Problems
Chapter 3: Simple Plots and Charts
Examples
Problems
Chapter 4: The core Python language II
Examples
Questions
Problems
Additional Problems
Chapter 5: IPython and Jupyter Notebook
Examples
Problems
Chapter 6: NumPy
Examples
Questions
Problems
Additional Examples
Additional Problems
Chapter 7: Matplotlib
Examples
Questions
Problems
Chapter 8: SciPy
Examples
Questions
Problems
Additional Examples
Additional Problems
Chapter 9: Data Analysis with pandas
Examples
Problems
Chapter 10: General Scientific Programming
Examples
Questions
Problems
Errata
Additional Notes
Blog
Apps
Contact
Home
Book (2nd ed.)
Chapter 6: NumPy
Examples
Examples
E6.1 A "comb" function
E6.2 Creating a Magic Square
E6.3 vstack and hstack
E6.4 Checking a Sudoku grid for validity
E6.5 argmax and argmin
E6.6 Using NumPy's loadtxt method
E6.7 The Stroop effect
E6.8 Simulating radioactive decay
E6.9 Covariance with np.cov
E6.10 The correlation between air pressure and temperature
E6.11 The height of liquid in a spherical tank
E6.12 Finding a best-fit straight line
E6.13 Creating a rotation matrix in NumPy
E6.14 Mesh analysis of a electrical network
E6.15 Matrix operations
E6.16 Visualizing linear transformations
E6.17 Fitting the Beer-Lambert law with NumPy
E6.18 Random sampling of evenly-spaced real numbers
E6.19 Simulating coin-tosses
E6.20 The normal distribution
E6.21 Modelling the distribution of $\mathrm{^{13}C}$ atoms in $\mathrm{C_{60}}$
E6.22 The probability of cleaving DNA with EcoRI
E6.23 Blurring an image with a two-dimensional FFT