In [2]:
from math import sqrt
m = 20.0 # kg
k = 800.0 # N/m
p_max = 1200.0 # N
Delta_t = 0.02 # s
h = 0.01 # s
w = sqrt(k/m) # rad/s
# appproximated
Delta_moment = p_max*Delta_t/2 # N \times s = kg m / s
initial_velocity = Delta_moment/m # m / s
amplitude_of_motion = initial_velocity/w # m
print('Max displacement ≈ %.3f mm' % (amplitude_of_motion*1000))
In [3]:
c = 0 # N / (m/s) — undamped system
h = 0.01 # s
κ = k + 3*c/h + 6*m/h**2
x0 = 0.0
v0 = 0.0
p0 = 0.0
p1 = 1200.0
p2 = 0.0
a0 = (p0 - k*x0 - c*v0) / m
dp1 = (p1-p0) + c*(a0*h/2+3*v0) + m*(3*a0+6*v0/h)
dx1 = dp1/κ
dv1 = 3*dx1/h - 3*v0 - a0*h/2
x1 = x0+dx1
v1 = v0+dv1
a1 = (p1 - k*x1 - c*v1) / m
dp2 = (p2-p1) + c*(a1*h/2+3*v1) + m*(3*a1+6*v1/h)
dx2 = dp2/κ
dv2 = 3*dx2/h - 3*v1 - a1*h/2
x2 = x1+dx2
v2 = v1+dv2
print("x(t₂) ≈ %.3f mm" % (x2*1000))
print("v(t₂) ≈ %.3f mm/s" % (v2*1000))
print('x_{max} ≈ %.3f mm' % (sqrt(x2**2+v2**2/w**2)*1000))
In [4]:
from IPython.display import HTML
display(HTML(open('01.css').read()))