A 1D wave equation simulator
Mathematical model
Numerical discretization
A solver function
Saving large arrays in files
Using savez
to store arrays in files
Using joblib
to store arrays in files
Using a hash to create a file or directory name
Software for the 1D wave equation
Making hash strings from input data
Avoiding rerunning previously run cases
Verification
Programming the solver with classes
Class Problem
Class Mesh
Class Function
Class Solver
Migrating loops to Cython
Declaring variables and annotating the code
Visual inspection of the C translation
Building the extension module
Calling the Cython function from Python
Migrating loops to Fortran
The Fortran subroutine
Building the Fortran module with f2py
How to avoid array copying
Migrating loops to C via Cython
Translating index pairs to single indices
The complete C code
The Cython interface file
Building the extension module
Migrating loops to C via f2py
Migrating loops to C++ via f2py
Exercises
Exercise 1: Make an improved numpy.savez
function
Bibliography