Skip to article frontmatterSkip to article content

6.11Exercises, examples & solutions

6.11.1Exercises

Here are some exercises that deals with oscillations. Make sure you practice IDEA.

6.11.2Experiment & Simulation

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; z=0z=0 is when the mass is l0l_0 below the ceiling.

Equilibrium position of the mass mm:

F=0Fvmg=0\sum F = 0 \rightarrow F_v - mg = 0

Force of the spring: Fv=k(ll0)=kzF_v = -k(l-l_0) = -kz. Thus

kzeqmg=0zeq=mgk-kz_{eq} - mg = 0 \rightarrow z_{eq} = - \frac{mg}{k}

Equation of motion for mm: set up N2

mdvdt=kzmgm\frac{dv}{dt} = -kz -mg

Solution with z(0)=zeqz(0) = z_{eq} and v(0)=v0v(0) = v_0:

homogeneous part of the equation: mdvdt+kz=0m\frac{dv}{dt} + kz=0

zhom(t)=Acosω0t+Bsinω0tz_{hom}(t) = A \cos \omega_0 t + B \sin \omega_0 t

with ω02=km\omega_0^2 = \frac{k}{m}

special solution: zs=mgkz_s = - \frac{mg}{k}

general solution:

z(t)=zhom(t)+zs(t)=zhom(t)=Acosω0t+Bsinω0tmgkz(t) = z_{hom}(t) + z_s(t) = z_{hom}(t) = A \cos \omega_0 t + B \sin \omega_0 t - \frac{mg}{k}

initial conditions:

z(0)=zeq=mgkA=0z(0) = z_{eq} = - \frac{mg}{k} \rightarrow A=0

and

v(0)=v0v0=ω0BB=v0ω0v(0) = v_0 \rightarrow v_0 = \omega_0 B \rightarrow B=\frac{v_0}{\omega_0}

Thus, the solution is

z(t)=mgk+v0ω0sinωotz(t) = -\frac{mg}{k} + \frac{v_0}{\omega_0} \sin \omega_o t
Solution to Exercise 2

Sketch; z=0z=0 is when the mass is at l0l_0 below the ceiling. Now we have 2 springs, one with spring constant k1k_1, the other with k2k_2. Both have the same rest length l0l_0

Equilibrium position of the mass mm:

F=0Fv1+Fv2mg=0\sum F = 0 \rightarrow F_{v1} + F_{v2} - mg = 0

Forces of the springs: Fv1=k1(ll0)=k1zF_{v1} = -k_1(l-l_0) = -k_1 z and Fv2=k2(ll0)=k2zF_{v2} = -k_2(l-l_0) = -k_2 z. Thus

k1zeqk2zeqmg=0zeq=mgk1+k2-k_1 z_{eq} - k_2 z_{eq} - mg = 0 \rightarrow z_{eq} = - \frac{mg}{k_1 +k_2}

Equation of motion for mm: set up N2

mdvdt=(k1+k2)zmgm\frac{dv}{dt} = -(k_1 + k_2) z -mg

Thus we conclude, that the exercise is basically the same: all we have to do is replace kk by Ktot=k1+k2K_{tot} = k_1 + k_2

mdvdt=ktotzmgm\frac{dv}{dt} = -k_{tot} z -mg

The solution with z(0)=zeqz(0) = z_{eq} and v(0)=v0v(0) = v_0 is thus

z(t)=mgktot+v0ω0sinωotz(t) = -\frac{mg}{k_{tot}} + \frac{v_0}{\omega_0} \sin \omega_o t

with ω02=ktotm \omega_0^2 = \frac{k_{tot}}{m}

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 x=0x=0.

If the mass is positioned to the right of x=0x=0, spring 1 is extended beyond its rest length and will pull in the negative xx-direction:

Fv1=k(ll0)=kxF_{v1} = -k(l-l_0) = -kx

Spring 2 will than be shorter than its rest length and will push to the negative xx-direction:

Fv2=k(lL0)=kxF_{v2} = k(l-L_0) = -kx

Thus, equilibrium is reached when

F=Fv1+Fv2=02kx=0xeq=0\sum F = F_{v1} + F_{v2} = 0 \rightarrow -2kx=0 \rightarrow x_{eq}=0

as we anticipated.

Equation of motion for mm: set up N2

mdvdt=kxkx=2kxm\frac{dv}{dt} = -kx - kx = -2kx

Thus we conclude, that the exercise is basically the same: all we have to do is replace kk by ktot=2kk_{tot} = 2k

mdvdt=2kxm\frac{dv}{dt} = -2kx

General solution x(t)=Asinω0t+Bcosω0tx(t) = A \sin \omega_0 t + B \cos \omega_0 t with ω02=2km\omega_0^2 = \frac{2k}{m}.

Like in the previous exercises, it is now a matter of specifying the initial conditions and finding AA and BB.

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 x=0x=0 is the equilibrium position.

If the mass is positioned to the right of x=0x=0, spring 1 stille too short and will push to the right:

Fv1=k(ll0)=k(l02+xl0)=k(l02x)F_{v1} = -k(l-l_0) = -k \left (\frac{l_0}{2} + x -l_0 \right ) = k \left ( \frac{l_0}{2} - x \right )

Spring 2 will than be even shorter and will push to the negative xx-direction:

Fv2=k(l02xl0)=k(l02+x)F_{v2} = k \left (\frac{l_0}{2}-x-l_0 \right ) = -k \left (\frac{l_0}{2} + x \right )

Thus, equilibrium is reached when

F=Fv1+Fv2=0k(l02x)k(l02+x)=2kx=0xeq=0\sum F = F_{v1} + F_{v2} = 0 \rightarrow k \left ( \frac{l_0}{2} - x \right ) -k \left (\frac{l_0}{2} + x \right ) = -2kx =0 \rightarrow x_{eq}=0

as we anticipated.

Equation of motion for mm: set up N2

mdvdt=kxkx=2kxm\frac{dv}{dt} = -kx - kx = -2kx

Thus we conclude, ktot=2kk_{tot} = 2k, which is identical to the previous exercise!