6.11.1Exercises¶
Here are some exercises that deals with oscillations. Make sure you practice IDEA.
6.11.2Experiment & Simulation¶
Find a rubber band and use nothing but a mass (that you are not allowed to weigh) that you can tie one way or the other to the spring, a ruler, and the stopwatch/clock on your mobile.
Set up an experiment to find the mass , the spring constant , and the damping coefficient .
Don’t forget to make a physics analysis first, a plan of how to find both and .

Figure 3:From Wikimedia Commons: bands, CC-SA 4.0; apple, CC-BY 2.0, ; phone, PD; ruler, CC-BY 4.0.
If the force acting on a particle is conservative, a potential energy can be defined. The sum of kinetic and potential energy is then constant: (mechanical) energy is conserved.
However, if the force is not a conservative one, mechanical energy is not conserved. The force will perform work on the particle. The total energy, if we include the work done, is still conserved. In many real life cases, the work done by non-conservative forces shows up as heat.
Energy conservation of a mass-spring
First, we will consider a mass , suspended on a spring (rest length en spring constant ). The spring is at a fixed position at one end, while the mass is attached at the other end. is displaced by an amount and then released without initial velocity.
Task:
Set up the analysis of this problem. It can be solved analytically.
- Make a sketch
- Set up a model
- Solve the model
- Show that energy is conserved: the sum of kinetic and potential energy is constant.
- Make a python programme that outputs a plot of the kinetic, potential and total energy as a function of time.
Friction: work done and energy conservation We could introduce a frictional force that will result in damping of the oscillation. A common example is having a friction that is proportional to the velocity of the mass and works against the direction of motion:
with a proportionality constant. Note that we are taking the problem as one-dimensional.
We could solve this problem analytically, but it is illustrative to do it numerically as we can then easily compute the work done the friction force.
So, the task is:
- Make a sketch
- Set up a model
- Make a python programme that outputs a plot of the kinetic, potential and total mechanical energy (that is the sum of kinetic and potential energy) as a function of time.
- Compute the work done by the friction force and plot this also as function of time.
Take the following parameters: cm, cm, kg, N/m, Ns/m
It is instructive to change the time step while keeping the total time (that is ) constant. You will notice that for ‘large’ time steps, it seems that energy is not conserved (of course taking into account the work done by the friction force), but that by making the time step smaller conservation of energy seems to be more and more obeyed. This is a consequence of numerical errors. The laws of physics are clear: energy must be conserved.
Source
import numpy as np
import matplotlib.pyplot as plt
# initiate the required variables / add additional ones if needed
# change the values if needed
N = 1000 #replace this by the value you need for your problem
dt = 1e-1 #replace this by the value you need for your problem
m = 1 #replace this by the value you need for your problem
k = 1 #replace this by the value you need for your problem
b = 0.1 #replace this by the value you need for your problem
l0 = 0.2 #replace this by the value you need for your problem
i = 0
t = 0*np.linspace(0,N,N+1)
v = 0*np.linspace(0,N,N+1)
x = 0*np.linspace(0,N,N+1)
Ekin = 0*np.linspace(0,N,N+1)
Epot = 0*np.linspace(0,N,N+1)
Etot = 0*np.linspace(0,N,N+1)
# provide the initial conditions
x0 = 0.01 #replace this by the actual initial condition
v0 = 0 #replace this by the actual initial condition
x[0] = x0
v[0] = v0
# define the function F/m
def force(x, v):
force = # TODO #replace this line with the actual F/m - expression
return force
# compute the trajectory and velocity
while i < N:
t[i+1] = (i+1)*dt
v[i+1] = v[i] + force(x[i],v[i])*dt
x[i+1] = x[i] + (v[i]+v[i+1])*dt/2.0
i = i+1
for i in range(0,N):
Ekin[i] = # TODO
Epot[i] = # TODO
Etot[i] = # TODO
# plot the results
plt.subplot(121)
plt.plot(t,v,'r-')
plt.xlabel('$t$ (s)')
plt.ylabel('$v$ (m/s)')
plt.subplot(122)
plt.plot(t,x,'b-')
plt.xlabel('$t$ (s)')
plt.ylabel('$x$ (m)')
# set the spacing between subplots
plt.subplots_adjust(left=0.1,
bottom=0.1,
right=2,
top=0.9,
wspace=0.4,
hspace=0.4)
# show the plots
plt.show()
# plot the results
plt.plot(t[0:N-1],Ekin[0:N-1],'r-',t[0:N-1],Epot[0:N-1],'b-',t[0:N-1],Etot[0:N-1],'g-')
plt.xlabel('$t$ (s)')
plt.ylabel('$E$ (J)')
# show the plots
plt.show()
Source
# work done
W = 0*np.linspace(0,N,N+1)
for i in range(0,N):
W[i+1] = W[i] + # TODO
plt.plot(t,W,'b-',t,Etot,'g-',t,Etot-W,'r-')
plt.xlabel('$t$ (s)')
plt.ylabel('$E$ (J)')
plt.grid()
plt.show()
6.11.3Answers¶
Solution to Exercise 1
Sketch; is when the mass is below the ceiling.
Equilibrium position of the mass :
Force of the spring: . Thus
Equation of motion for : set up N2
Solution with and :
homogeneous part of the equation:
with
special solution:
general solution:
initial conditions:
and
Thus, the solution is
Solution to Exercise 2
Sketch; is when the mass is at below the ceiling. Now we have 2 springs, one with spring constant , the other with . Both have the same rest length
Equilibrium position of the mass :
Forces of the springs: and . Thus
Equation of motion for : set up N2
Thus we conclude, that the exercise is basically the same: all we have to do is replace by
The solution with and is thus
with
Solution to Exercise 3
Again, we have two springs acting on the mass. However, they are no on opposite sides. We expect on symmetry arguments that the equilibrium will be in the middle, i.e at .
If the mass is positioned to the right of , spring 1 is extended beyond its rest length and will pull in the negative -direction:
Spring 2 will than be shorter than its rest length and will push to the negative -direction:
Thus, equilibrium is reached when
as we anticipated.
Equation of motion for : set up N2
Thus we conclude, that the exercise is basically the same: all we have to do is replace by
General solution with .
Like in the previous exercises, it is now a matter of specifying the initial conditions and finding and .
Solution to Exercise 4
Again, we have two springs acting on the mass. Now they don’t fit both with their rest length. The will be compressed and try to lengthen. However, based on symmetry we still do expect that is the equilibrium position.
If the mass is positioned to the right of , spring 1 stille too short and will push to the right:
Spring 2 will than be even shorter and will push to the negative -direction:
Thus, equilibrium is reached when
as we anticipated.
Equation of motion for : set up N2
Thus we conclude, , which is identical to the previous exercise!