Partial Differential Equations in 1D
Reaction-Diffusion Models
In this session we move from ODEs to reaction-diffusion PDEs in one spatial dimension. We will discretize space with finite differences, advance in time with Euler’s method, and visualize pattern formation.
Case Studies
Goals
- Implement the 1D Laplacian with finite differences.
- Simulate a reaction-diffusion system with explicit time stepping.
- Visualize patterns and understand when they emerge.
- Connect parameter choices to stability and pattern formation.
- Build animations and add simple user interaction.
What do we need?
numpy
We use NumPy arrays to represent spatial fields and np.roll() to compute the discrete Laplacian.
matplotlib.pyplot
Initialize the figure and axes and plot static elements (labels, titles, limits).
matplotlib.animation
Update line objects frame-by-frame to create animations.
matplotlib.backend_bases
Handle mouse clicks to let the user interact with the simulation.
scipy
Great for ODEs, but we will not use it for PDEs in this session. We need to enforce boundary conditions at every step.