Information Technology Reference
In-Depth Information
explicit (upper), exact, implicit (lower), N = 25, T = 1.0
0
−1
−2
−3
−4
−5
−6
−7
−8
−9
−10
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
t
Fig. 2.3
The figure shows the numerical solution generated by an explicit scheme (
upper curve
),
the analytical solution (
middle
), and the solution generated by an implicit scheme (
lower
). All the
solutions are plotted by drawing a
straight line
between the computed values. This is also done for
the analytical solution, which is therefore correct only at t
0
;t
1
t
N
In Fig.
2.3
we have plotted the two numerical solutions and the exact solution for t
ranging from 0 to 1: In the numerical computations we used N
D
25: We note that
both numerical solutions behave well.
But let us look a bit closer at what happens when we reduce the number of
time steps, i.e., we increase the size of t: In Table
2.1
, we compare the numerical
solution generated by the implicit and explicit scheme at time t
D
1:
We see from Table
2.1
that the implicit scheme gives reasonable solutions for
any t; whereas the explicit scheme runs into serious trouble as N becomes smaller
than 11.
The Explicit Scheme
We can see this effect directly from the explicit scheme. Suppose y
n
<0;and recall
that
y
nC1
D
y
n
C
ty
n
:
Hence, in order for y
nC1
to be negative, we must have
y
n
C
ty
n
<0;