The Nature of Mathematical Modelling


Consider the 1D wave equation

(f) Numerically solve the wave equation for the evolution from an initial condition with u = 0 except for one nonzero node, and verify the stability criterion.

See the Pen 8.1 by Ann (@beansbeansbeans) on CodePen.


Write a program to solve a 1D diffusion problem on a lattice of 500 sites, with an initial condition of zero at all the sites, except the central site which starts at the value 1.0. Take D = ∆x = 1, and use fixed boundary conditions set equal to zero.

(a) Use the explicit finite difference scheme, and look at the behavior for ∆t = 1, 0.5, and 0.1. What step size is required by the Courant condition?

See the Pen 8.2a by Ann (@beansbeansbeans) on CodePen.

(b) Now repeat this using implicit finite differences and compare the stability.

See the Pen 8.2b by Ann (@beansbeansbeans) on CodePen.


Use ADI to solve a 2D diffusion problem on a lattice, starting with randomly seeded values.

See the Pen 8.3 by Ann (@beansbeansbeans) on CodePen.


Use SOR to solve Laplace’s equation in 2D, with boundary conditions uj,1 = u1,k = 0, uN,k = −1, uj,N = 1, and explore how the convergence rate depends on α, and how the best choice for α depends on the lattice size.

See the Pen evEBNM by Ann (@beansbeansbeans) on CodePen.