<jupyter_start><jupyter_text>Impact PreliminariesWe have to import the mathematical functions used in the following. Also, we want to define a function to help with the formatting of our results.<jupyter_code>from math import atan2, cos, pi, sin, sqrt
def format(desc, val, units):
    print("%-35s %9g %s"%(desc+":", val, units))<jupyter_output><empty_output><jupyter_text>Data of the problemThe data of our problem is as follows<jupyter_code>g  = 10.00
m1 = 75.00
k  = 0.400E6
m2 = m1/3.0
h  = 1.400
format("Acceleration of gravity", g, "m/s^2")
format("Stiffness of suspension system", k, "N/m")
format("Mass of suspended body", m1, "kg")
format("Mass of falling body", m2, "kg")
format("Height of fall", h, "m")<jupyter_output>Acceleration of gravity:                   10 m/s^2
Stiffness of suspension system:        400000 N/m
Mass of suspended body:                    75 kg
Mass of falling body:                      25 kg
Height of fall:                           1.4 m<jupyter_text>Solution The initial velocityThe potential energy of the falling body is converted to kinetic energy at the moment of impact,$$m_2gh = \frac12 m_2v_2^2 \Rightarrow v_2 = \sqrt{2gh}$$<jupyter_code>v2 = sqrt(2*g*h)
format("Impact velocity of fallen body", v2, "m/s.")<jupyter_output>Impact velocity of fallen body:        5.2915 m/s.<jupyter_text>The initial velocity of the system of mass $m=m_1+m_2$ is given by conservation of momentum,$$m_2v_2 = mv \Rightarrow v=v_2\frac{m_2}{m}$$<jupyter_code>m = m1+m2
v = v2*m2/m
format("Mass of compound system", m, "kg")
format("Initial velocity, compound system", v, "m/s")<jupyter_output>Mass of compound system:                  100 kg
Initial velocity, compound system:    1.32288 m/s<jupyter_text>Equation of motionThe equation of motion to be solved is not homegeneous, because we have a static force due to the presence of the fallen body...$$m\ddot{x}+kx=gm_2$$and the general integral is hence$$x(t) = A \cos(\omega t) + B \sin(\omega t) +\frac{gm_2}{k}.$$<jupyter_code>w2 = k/m
w  = sqrt(w2)
format("Natural frequency", w, "rad/s")<jupyter_output>Natural frequency:                    63.2456 rad/s<jupyter_text>Initial conditionsThe initial conditions are$$x_0 = 0,\qquad \dot{x}_0 = v_2\frac{m_2}{m},$$so that we have$$A\cdot1+B\cdot0+\Delta_{st}=0, \qquad   -\omega A\cdot0 + \omega B\cdot1=v,$$ that gives$$A = -\Delta_{st}, \qquad B = \frac{v}{\omega}$$and eventually$$x(t) = \Delta_{st}\left(1-\cos(\omega t)\right) + \frac{v}{\omega} \sin(\omega t).$$<jupyter_code>dst = g*m2/k
A   = -dst
B   = v/w
format("Static displacement", dst*1000, "mm")
format("Cosine coefficient", A*1000, "mm")
format("Sine coefficient", B*1000, "mm")<jupyter_output>Static displacement:                    0.625 mm
Cosine coefficient:                    -0.625 mm
Sine coefficient:                     20.9165 mm<jupyter_text>Maximum displacementThe maximum displacement is found considering the response as\begin{align*}  x(t) &= \Delta_{st} + C\cos(\omega t-\phi),\quad\text{with } C=\sqrt{A^2+B^2},\\x_\text{max} &= \Delta_{st}+C\cdot1.\end{align*}<jupyter_code>xmx = dst+sqrt(A*A+B*B)
format("Maximum displacement", xmx*1000, "mm")<jupyter_output>Maximum displacement:                 21.5508 mm<jupyter_text>Time of maximum displacementThe phase difference is given by the expression$$\phi=\arctan\frac{B}{A}$$ and we have the maximum displacement when $$\cos(\omega t^* - \phi) = 1,$$ i.e.,$$\omega t^* - \phi = 2n\pi\Rightarrow t^* = \frac{\phi+2n\pi}{\omega}=\frac{\phi}{\omega}+nT_N$$ with $n=-\infty,\ldots,\infty$ and $T_N$ the natural period of vibration of the compound system.We have to find the smallest positive value of $t^*$ to answer the question of the exercise...<jupyter_code>phi = atan2(B, A)
format("Phase difference", phi*180/pi,"deg")<jupyter_output>Phase difference:                     91.7115 deg<jupyter_text>The phase difference being positive, the smallest positive $t^*$ is simply $$t^*=\frac{\phi}{\omega}.$$<jupyter_code>tmx = phi/w
format("Time of first maximum, t*", tmx,"s")<jupyter_output>Time of first maximum, t*:          0.0253088 s<jupyter_text>Let's verify that the displacement computed at $t^*$ effectively is $x_\text{max}$...<jupyter_code>print("*** Verification"," "*24,"***")
format("Maximum displacement", xmx*1000, "mm")
xtmx = dst*(1-cos(tmx*w)) + B*sin(tmx*w) 
format("Displacement @ t*", xtmx*1000, "mm")<jupyter_output>*** Verification                          ***
Maximum displacement:                 21.5508 mm
Displacement @ t*:                    21.5508 mm<jupyter_text>Plotting our resultsFirst of all, the period of vibration, we plot one period, then we compute a sequence ofpoints on the time axis and a sequence of samples of the displacements and one of samplesof the velocities (divided by $\omega$ to have dimensionally and numerically  homogeneous results)<jupyter_code>T = 2*pi/w
ts = [i*T/50 for i in range(51)]
x = [dst*(1-cos(w*t))+B*sin(w*t) for t in ts]
v = [dst*sin(w*t)+B*cos(w*t) for t in ts]
t = ts<jupyter_output><empty_output><jupyter_text>The actual plotsPreparing the required libraries and a few lines of code, using the sequences of data we've justcomputed.<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use(['fivethirtyeight', './00_mplrc'])

plt.plot(t,x, label="$x(t)$")
plt.plot(t,v, label="$v(t)/\\omega$")
plt.xlabel("$t$/s")
plt.ylabel("$x$/m")
plt.xticks((0,0.025,0.050,0.075,0.100))
plt.legend(loc=0)
plt.title('Displacement and pseudo-velocity')
plt.show()
# incantation to properly format the notebook
from IPython.display import HTML
HTML(open("00_custom.css", "r").read())<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15073334511397773, 'fraction_numerical': 0.03746244919597102, 'mean_word_length': 4.173674588665448, 'pattern_counts': {'":': 1, '<': 40, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '236199', 'license': 'MIT', 'n_tokens_mistral': 2115, 'n_tokens_neox': 1930, 'n_words': 559, 'path': 'dati_2015/ha03/01_Impact.ipynb', 'repo_name': 'shishitao/boffi_dynamics', 'size': '5659'}