Eigenvalues as a function of k for the linear diffusion equation with various time stepping schemes. Dimensionless timestep n = 2*dt*K/dx^2, where K is the diffusion constant and dx is the grid spacing. This time we use a very long timestep (compare diffusion.c):

n=100

To plot wavenumber on the x-axis, I define

k=x

Forward time, centered space (FTCS):

y=1+n*[cos(k)-1]

Midpoint method with perturbed halfstep, dt*(1+d)/2:

d=-0.5

y=1+n*[cos(k)-1+[1+d]*n/4*[cos(2*k)-(4*cos(k))+3]]

Implicit time, centered space (ITCS):

y=1/(1+n*[1-cos(k)])

Implicit midpoint method. This time, the intermediate timestep is (1+c)/2:

c=0.5

y=1/(1-(n*[cos(k)-1-([1+c]*n/4*[cos(2*k)-(4*cos(k))+3])]))

Analytic result:

y=e^(-n*k^2/2)

Nyquist Frequency:

x=pi


Graph of the formula

This file was created by Graphing Calculator 3.5.
Visit Pacific Tech to download the helper application to view and edit these equations live.