A difficulty with the given program is that it doesn't work for all
possible numerical values of .You can see that when
is too large (when
is
too small)
the solution in the interior region of the data table
contains growing oscillations.
What is happening is that the low-frequency part of the solution
is OK (for a while), but the high-frequency part is diverging.
The mathematical reason the divergence occurs
is the subject of mathematical analysis
found in IEI section 2.8.
Intuitively, at wavelengths long compared
to
or
,we expect the difference approximation to agree with the true
heat-flow equation,
smoothing out irregularities in temperature.
At short wavelengths the wild oscillation shows
that the difference equation
can behave in a way almost opposite
to the way the differential equation behaves.
The short wavelength discrepancy arises because difference operators
become equal to differential operators only at long wavelengths.
The divergence of the solution is a fatal problem because the subsequent
round-off error will eventually destroy the low frequencies too.
By supposing that the instability arises because the time derivative is centered at a slightly different time t+1/2 than the second x-derivative at time t, we are led to the so-called leapfrog method, in which the time derivative is taken as a difference between t-1 and t+1:
![]() |
(28) |
To avoid all these problems (and get more accurate answers as well), we now turn to some slightly more complicated solution methods known as implicit methods.