Computational Physics - Department of Physics

(Axel Boer) #1

8.6 Physics examples 259


In Fig. 8.3 we exhibit the development of the difference between the calculated energy and
the exact energy att= 0 after two periods and withN= 1000 andN= 10000 mesh points. This
figure demonstrates clearly the need of developing tests forchecking the algorithm used. We
see that even forN= 1000 there is an increasing difference between the computed energy
and the exact energy after only two periods.


-3e-11

-2.5e-11

-2e-11

-1.5e-11

-1e-11

-5e-12

0

0 2 4 6 8 10 12 14

∆E(t)

T

N= 1000

-3e-15

-2.5e-15

-2e-15

-1.5e-15

-1e-15

-5e-16

0

5e-16

0 2 4 6 8 10 12 14

∆E(t)

T

N= 10000

Fig. 8.3Plot of∆E(t) =E 0 −EcomputedforN= 1000 andN= 10000 time steps up to two periods. The initial
positionx 0 = 1 m and initial velocityv 0 = 0 m/s. The mass and spring tension are set tok=m= 1.

Free download pdf