Information Technology Reference
In-Depth Information
and use this to show that
u .t nC1 / u .t n /
t
1
2 .f . u .t n / C f. u .t nC1 // C O.t 2 /:
D
(f) Use these observations to derive the Crank-Nicolson scheme
u nC1 t
2
t
2
f. u nC1 / D u n C
f. u n /:
(2.70)
(g) Implement the explicit Euler, the implicit Euler and the Crank-Nicolson scheme
for the exponential growth problem
u 0 D u ;
u .0/ D 1:
Make a table comparing the accuracy of these solutions at T D 5.Dividethe
errors of the solutions computed by the two Euler schemes by t , and the error
of the Crank-Nicolson solution by t 2 : Use the results to argue that the error
of the Euler schemes is O.t/ and the error of the Crank-Nicolson scheme is
O.t 2 /:
(h) Repeat the experiments above for the initial value problem
u 0 D u .1 u /;
u .0/ D 10;
T D 1:
Are the conclusions regarding accuracy the same?
(i) Although the Crank-Nicolson scheme is more accurate than the explicit Euler
scheme, it suffers from the fact that an equation has to be solved at each time
step. The purpose of our next scheme is to maintain the error O.t 2 / but for
an explicit computation, i.e., we want to avoid having to solve an equation at
each time step.
In the derivation of the Crank-Nicolson scheme above, we observed that, in
general,
u .t nC1 / u .t n /
t
1
2 .f . u .t n / C f. u .t nC1 // C O.t 2 /:
D
The problem here is that we need to evaluate f. u .t nC1 //, and this leads to a
possibly 28 nonlinear equation. But note that
28 The equation is nonlinear whenever f is nonlinear, and f is linear if we can write it in the form
f. u / D a u C b
for given constants a and b
I
otherwise it is nonlinear.
 
Search WWH ::




Custom Search