Simple Nature - Light and Matter

(Martin Jones) #1
the time ∆t= ∆x/vrequired to move a predetermined distance
∆x, we pick ∆tand determine the distance traveled in that time,
∆x=v∆t. Also, we can no longer updatevbased on conservation of
energy, since we don’t have any easy way to keep track of how much
mechanical energy has been changed into heat energy. Instead, we
recalculate the velocity using ∆v=a∆t.

1 import math
2 k=39.4784 # chosen to give a period of 1 second
3 m=1.
4 b=0.211 # chosen to make the results simple
5 x=1.
6 v=0.
7 t=0.
8 dt=.01
9 n=1000
10 for j in range(n):
11 x=x+vdt
12 a=(-k
x-bv)/m
13 if (v>0) and (v+a
dt<0) :
14 print("turnaround at t=",t,", x=",x)
15 v=v+a*dt
16 t=t+dt


turnaround at t= 0.99 , x= 0.899919262445
turnaround at t= 1.99 , x= 0.809844934046
turnaround at t= 2.99 , x= 0.728777519477
turnaround at t= 3.99 , x= 0.655817260033
turnaround at t= 4.99 , x= 0.590154191135
turnaround at t= 5.99 , x= 0.531059189965
turnaround at t= 6.99 , x= 0.477875914756
turnaround at t= 7.99 , x= 0.430013546991
turnaround at t= 8.99 , x= 0.386940256644
turnaround at t= 9.99 , x= 0.348177318484

The spring constant, k= 4π = 39.4784 N/m, is designed so
that if the undamped equationf= (1/ 2 π)


k/mwas still true, the
frequency would be 1 Hz. We start by noting that the addition of a
small amount of damping doesn’t seem to have changed the period
at all, or at least not to within the accuracy of the calculation.^10
You can check for yourself, however, that a large value ofb, say 5
N·s/m, does change the period significantly.
We release the mass fromx= 1 m, and after one cycle, it only
comes back to aboutx= 0.9 m. I choseb= 0.211 N·s/m by fiddling

(^10) This subroutine isn’t as accurate a way of calculating the period as the
energy-based one we used in the undamped case, since it only checks whether
the mass turned around at some point during the time interval ∆t.
Section 3.3 Resonance 177

Free download pdf