Question 12.2.3: Use the Crank-Nicolson method with h = 0.1 and k = 0.01 to a...
Use the Crank-Nicolson method with h = 0.1 and k = 0.01 to approximate the solution to the problem
\frac{\partial u}{\partial t}(x, t)-\frac{\partial^{2} u}{\partial x^{2}}(x, t)=0, \quad 0<x<1 \quad 0<t ,
subject to the conditions
u(0, t) = u(1, t) = 0, 0 < t,
and
u(x, 0) = sin(πx), 0 ≤ x ≤ 1.
Learn more on how we answer questions.
Choosing h = 0.1 and k = 0.01 gives m = 10, N = 50, and λ = 1 in Algorithm 12.3. Recall that the Forward-Difference method gave dramatically poor results for this choice of h and k, but the Backward-Difference method gave results that were accurate to about 2 \times 10^{-3} for entries in the middle of the table. The results in Table 12.5 indicate the increase in accuracy of the Crank-Nicolson method over the Backward-Difference method, the best of the two previously discussed techniques.
Table 12.5
\begin{array}{llll}\hline x_{i} & {w_{i, 50}} & {u\left(x_{i}, 0.5\right)} & \left|w_{i, 50}-u\left(x_{i}, 0.5\right)\right| \\\hline 0.0 & 0 & 0 & \\0.1 & 0.00230512 & 0.00222241 & 8.271 \times 10^{-5} \\0.2 & 0.00438461 & 0.00422728 & 1.573 \times 10^{-4} \\0.3 & 0.00603489 & 0.00581836 & 2.165 \times 10^{-4} \\0.4 & 0.00709444 & 0.00683989 & 2.546 \times 10^{-4} \\0.5 & 0.00745954 & 0.00719188 & 2.677 \times 10^{-4} \\0.6 & 0.00709444 & 0.00683989 & 2.546 \times 10^{-4} \\0.7 & 0.00603489 & 0.00581836 & 2.165 \times 10^{-4} \\0.8 & 0.00438461 & 0.00422728 & 1.573 \times 10^{-4} \\0.9 & 0.00230512 & 0.00222241 & 8.271 \times 10^{-5} \\1.0 & 0 & 0 & \\\hline\end{array}