Computational Physics - Department of Physics

(Axel Boer) #1

6.8 Exercises 211


0

0.2

0.4

0.6

0.8

1

0 0.2 0.4 0.6 0.8 1

u(x)

x

Numerical solution
Analytical solution

Fig. 6.4Numerical solution obtained withn= 10 compared with the analytical solution.


0

0.2

0.4

0.6

0.8

1

0 0.2 0.4 0.6 0.8 1

u(x)

x

Numerical solution
Analytical solution

Fig. 6.5Numerical solution obtained withn= 10 compared with the analytical solution.


Table 6.2log 10 values for the relative error and the step lengthhcomputed atx= 0. 5.
n log 10 (h)εi=log 10 (|(vi−ui)/ui|)
10 -1.04 -2.29
100 -2.00 -4.19
1000 -3.00 -6.18
104 -4.00 -8.18
105 -5.00 -9.19
106 -6.00 -6.08

Free download pdf