In [1]:

```
import math
# Variables:
k = 1. #m
m = 2500. #kg
T = 1500. #N-m
#Solution:
#Calculating the mass moment of inertia of the flywheel
I = m*k**2 #kg-m**2
#Calculating the angular acceleration of the flywheel
alpha = T/I #rad/s**2
#The angular speed at start
omega1 = 0
t = 10. #seconds
#Calculating the angular speed of the flywheel after t = 10 seconds from start
omega2 = omega1+alpha*t #rad/s
#Calculating the kinetic energy of the flywheel after 10 seconds from start
E = 1./2*I*omega2**2/1000 #kJ
#Results:
print " The angular acceleration of the flywheel, alpha = %.1f rad/s**2."%(alpha)
print " The kinetic energy of the flywheel, E = %d kJ."%(E)
```

In [2]:

```
import math
# Variables:
mC = 500. #kg
mD = 250. #kg
s = 100. #m
r = 0.5 #m
k = 0.35 #m
m = 3. #kg/m
#Solution:
#Velocities of the cage
u1 = 0.
v1 = 10.
v2 = 10.
u3 = 10.
v3 = 0. #m/s
#Accelerations of the cage
a1 = 1.5
a3 = -6. #m/s**2
s = 100. #m
#Calculating the time taken by the cage to reach the top
t1 = (v1-u1)/a1 #seconds
#Calculating the dismath.tance moved by the cage during time t1
s1 = (v1+u1)/2*t1 #m
#Calculating the time taken for the cage from initial velocity u3 = 10 m/s to final velocity of v3 = 0
t3 = (v3-u3)/a3 #seconds
#Calculating the dismath.tance moved by the cage during time t3
s3 = (v3+u3)/2*t3 #m
#Calculating the dismath.tance travelled during consmath.tant velocity of v2 = 10 m/s
s2 = s-s1-s3 #m
#Calculating the time taken for the cage during consmath.tant velocity
t2 = s2/v2 #seconds
#Calculating the time taken for the cage to reach the top
t = t1+t2+t3 #seconds
#Calculating the total mass of the rope for 100 metres
mR = m*s #kg
#Calculating the force to raise the cage and rope at uniform speed
F1 = (mC+mR)*9.81 #N
#Calculating the torque to raise the cage and rope at uniform speed
T1 = F1*r #N-m
#Calculating the force to accelerate the cage and rope
F2 = (mC+mR)*a1 #N
#Calculating the torque to accelerate the cage and rope
T2 = F2*r #N-m
#Calculating the mass moment of inertia of the drum
I = mD*k**2 #kg-m**2
#Calculating the angular acceleration of the drum
alpha = a1/r #rad/s**2
#Calculating the torque to accelerate the drum
T3 = I*alpha #N-m
#Calculating the total torque which must be applied to the drum at starting
T = T1+T2+T3 #N-m
#Calculating the mass of 33.35 m rope
m1 = m*33.35 #kg
#Calculating the reduction of torque
T4 = (m1*9.81+m1*a1)*r #N-m
#Calculating the angular velocity of drum
omega = v2/(2*math.pi*r) #rad/s
#Calculating the power
P = T4*omega/1000 #Power kW
#Results:
print " The time taken for the cage to reach the top t = %.2f s."%(t)
print " The total torque which must be applied to the drum during starting T = %.1f N-m."%(T)
print " The power required is %.3f kW."%(P)
#Answers differ due to rounding-off values in textbook
```

In [3]:

```
import math
# Variables:
P = 4.*1000 #W
I = 140. #kg-m**2
N1 = 240. #rpm
#Solution:
#Calculating the angular acceleration at the commencement of operation
omega1 = 2*math.pi*N1/60 #rad/s
#Calculating the energy supplied by the motor (E1) and the energy consumed in closing a revet in 1 second
E1 = 4000.
E2 = 10000. #N-m
#Calculating the loss of kinetic energy of the flywheel during the operation
E = E2-E1 #N-m
#Calculating the kinetic energy of the flywheel at the commencement of operation
KEc = 1./2*I*omega1**2 #Kinetic energy at the commencement N-m
#Calculating the kinetic energy of the flywheel at the end of operation
KEe = KEc-E #Kinetic energy at the end N-m
#Calculating the angular speed of the flywheel immediately after closing a revet
omega2 = math.sqrt(KEe*2/I) #rad/s
#Calculating the reduction of speed
ReductionofSpeed = (omega1-omega2)*60/(2*math.pi) #rpm
#Calculating the maximum rate at which the revets can be closed per minute
Rate = P*60/E2 #Maximum rate at which the revets can be closed per minute
#Results:
print " The reduction of speed is %.1f rpm."%(ReductionofSpeed)
print " The maximum rate at which rivets can be closed per minute is %d."%(Rate)
```

In [4]:

```
import math
# Variables:
m = 14.*1000 #kg
m1 = 1.25*1000 #kg
m2 = 110. #kg
d = 1. #m
r = d/2 #m
k1 = 450./1000 #m
k2 = 125./1000 #m
F = 1.2*1000 #N
eta = 0.85
v = 1.8 #m/s
a = 0.1 #m/s**2
#Solution:
#Calculating the forces oppomath.sing the motion
P1 = m*9.81*1/20+m*a+F #N
#Calculating the torque on the drum shaft to accelerate the load
T1 = P1*r #N-m
#Calculating the mass moment of inertia of the drum
I1 = m1*k1**2 #kg-m**2
#Calculating the angular acceleration of the drum
alpha1 = a/r #rad/s
#Calculating the torque on the drum to accelerate the drum shaft
T2 = I1*alpha1 #N-m
#Calculating the torque on the armature to accelerate drum and load
T3 = (T1+T2)/(40*eta) #N-m
#Calculating the mass moment of inertia of the armature
I2 = m2*k2**2 #kg-m**2
#Calculating the angular acceleration of the armature
alpha2 = a/r*40 #rad/s**2
#Calculating the torque on the armature to accelerate armature shaft
T4 = I2*alpha2 #N-m
#Calculating the torque on the motor shaft
T = T3+T4 #N-m
#Calculating the angular speed of the motor
omega = v/r*40 #rad/s
#Calculating the power developed by the motor
P = T*omega/1000 #Power developed by the motor kW
#Results:
print " The torque on the motor shaft T = %.2f N-m."%(T)
print " The power developed by the motor is %.2f kW."%(P)
```

In [5]:

```
import math
# Variables:
m = 12.0*1000
m1 = 2.0*1000
m2 = 2.5*1000 #kg
k1 = 0.4
d1 = 1.2
r1 = d1/2.0
k2 = 0.6
d2 = 1.5
r2 = d2/2.0
s = 6.0 #m
v = 9.0*1000/3600 #m/s
#Solution:
#Calculating the mass moment of inertia of the front roller
I1 = m1*k1**2 #kg-m**2
#Calculating the mass moment of inertia of the rear axle together with its wheels
I2 = m2*k2**2 #kg-m**2
#Calculating the angular speed of the front roller
omega1 = round(v/r1,2) #rad/s
#Calculating the angular speed of rear wheels
omega2 = round(v/r2,1) #rad/s
#Calculating the kinetic energy of rotation of the front roller
E1 = 1.0/2*I1*4.16**2 #N-m
#Calculating the kinetic energy of rotation of the rear axle with its wheels
E2 = 1.0/2*I2*omega2**2 #N-m
#Calculating the total kinetic energy of rotation of the wheels
E = round(E1+E2,-1) #N-m
#Calculating the kinetic energy of translation of the road roller
E3 = 1.0/2*m*v**2 #N-m
#Calculating the total kinetic energy of the road roller
E4 = E3+E #N-m
#Calculating the braking force to bring the roller to rest
F = E4/s #N
#Results:
print " The total kinetic energy of rotation of the wheels E = %.f N-m."%(E)
print " The total kinetic energy of the road roller E4 = %d N-m."%(E4)
print " The braking force required to bring the roller to rest F = %.1f N."%(F)
```

In [25]:

```
from sympy import Symbol,solve
import math
# variables
s = 4. # N/m
m = 4000. # N/m ;
x1 = 0.075 # m
x2 = 0.03 # m;
m = 5. # kg ;
R = 70. # N
g = 9.81
# calculations
Q = m*(x1 - x)
P = Q + m*g - R
x = 0.045
t = Symbol("t")
ans = -solve(0.07*(1 - math.cos(math.sqrt(800)) * t) - 0.045)[0]
a = math.acos(ans)
t = a/math.sqrt(800)
# result
print "t = %.4f s"%t
# rounding off error
```

In [9]:

```
import math
from numpy import linalg
# Variables:
r = 500./1000
k = 450./1000 #m
m1 = 500.
m2 = 1250. #kg
u = 0.75 #m/s
#Solution:
#Calculating the mass moment of inertia of drum
I2 = m2*k**2 #kg-m**2
#Calculating the speed of truck
#Impulse
#F = m1*v or
#F-m1*v = 0 .....(i)
#Moment of impulse
#F*r = I2*(omega2-omega2) or
#F*r = I2*(u-v)/r or
#F*r+I2*v/r = I2*u/r .....(ii)
#Solving (i) and (ii)
A = [[1, -m1],[ r, I2/r]]
B = [0, I2*u/r]
V = linalg.solve(A,B)
v = V[1]
#Calculating the energy lost to the system
E = 1./2*I2*(u**2-v**2)/r**2-1./2*m1*v**2 #Energy lost to the system, N-m
#Results:
print " The speed of the truck when the motion becomes steady, v = %.3f m/s."%(v)
print " The energy lost to the system is %d N-m."%(E)
```

In [1]:

```
from scipy.optimize import fsolve
import math
# Variables:
s = 0.7*10**6 #N/m
m1 = 10.*10**3
m2 = 15.*10**3 #kg
v1 = 1.8
v2 = 0.6 #m/s
#Solution:
#Calculating the common velocity when moving together during impact
v = (m1*v1+m2*v2)/(m1+m2)
#Calculating the kinetic energy lost to the system
E = (1./2*m1*v1**2+1./2*m2*v2**2)-1./2*(m1+m2)*v**2
#Calculating the compression of each buffer spring
x = math.sqrt(E/(2*s))
#Calculating the velocity of each truck on separation
#Final KE after separation = KE at common velocity+Half of energy stored in springs.
#And initial and final momentum must be equal.
#Simplifying the two equations
# we get
#1/2*m1*v3**2+1/2*m2*v4**2 = 1/2*(m1+m2)*v**2+1/2*E .....(i)
#m1*v3+m2*v4 = (m1+m2)*v
def f(x):
v3 = x[0]
v4 = x[1]
y = [0,0]
y[0] = 1./2*m1*v3**2+1./2*m2*v4**2-1./2*(m1+m2)*v**2-1./2*E
y[1] = m1*v3+m2*v4-(m1+m2)*v
return y
z = fsolve(f,[1,1])
v3 = z[1]
v4 = z[0]
#Results:
print " The common velocity when moving together during impact, v = %.2f m/s."%(v)
print " The kinetic energy lost to the system is %.2f kN-m."%(E/1000.)
print " The compression of each buffer spring, x = %.f mm."%(x*1000.)
print " The velocity of separation for 10 tonnes truck, v3 = %.1f m/s."%(v3)
print " The velocity of separation for 15 tonnes truck, v4 = %.1f m/s."%(v4)
# note : rounding off error
```

In [13]:

```
import math
# Variables:
m1 = 300. #kg
m2 = 500. #kg
s = 1. #m
x = 150./1000 #m
#Solution:
#Calculating the velocity with which mass m1 hits the pile
u = 0
v1 = math.sqrt(2*9.81*s+u**2) #m/s
#Calculating the common velocity after impact
v2 = 0
v = (m1*v1+m2*v2)/(m1+m2) #m/s
#Calculating the kinetic energy before impact
KEb = m1*9.81*s #Kinetic energy before impact N-m
#Calculating the kinetic energy after impact
KEa = 1./2*(m1+m2)*v**2 #Kinetic energy after impact N-m
#Calculating the energy lost in the blow
E = KEb-KEa #Energy lost in the blow N-m
#Calculating the average resistance against the pile
R = KEa/x+m1*9.81+m2*9.81
#Results:
print " The energy lost in the blow is %d N-m."%(E)
print " The average resistance against the pile R = %.3f kN."%(R/1000)
```

In [16]:

```
import math
from numpy import linalg
# Variables:
m1 = 0.7
m2 = 2.4 #kg
k1 = 270./1000
k2 = 185./1000
h1 = 0.25
DL = 0.2
CM = 0.275 #m
#Solution:
#Calculating the angular velocity of hammer just before impact
h = h1*(1-math.cos(20*math.pi/180))
omega = math.sqrt(m1*9.81*h*2/(m1*k1**2)) #rad/s
#Calculating the relative linear velocity
RLV = 0.8*omega*CM
#Calculating the values of angular velocities
#The two equations we get in terms of omegaA and omegaB are
#DL*omegaA-CM*omegaB = RLV .....(i)
#m1*k1**2*(omega-omegaB) = .275/.2*m2*k2**2*omegaA or
#2.21*omegaA+omegaB = 2.01 .....(ii)
A = [[DL, -CM],[ 2.21, 1]]
B = [RLV,2.01]
V = linalg.solve(A,B)
#Results:
print " The angular velocity of the anvil A, omegaA = %.2f rad/s."%(V[0])
print " The angular velocity of the hammer B, omegaB = %.2f rad/s, i.e. %.2f rad/s, in the reverse direction."%(V[1],
V[1]*-1)
```

In [10]:

```
from numpy import linalg
import math
# Variables:
m = 30. #kg
AG = 1
GB = 150./1000
k1 = 1.1
k2 = 350./1000 #m
theta = 60.*math.pi/180 #rad
t = 0.005 #s
a = AG
b = GB
#Solution:
#Calculating the mass moment of inertia of the pendulum about the point of suspension A
IA = m*k1**2 #kg-m**2
#Calculating the mass moment of inertia ofthe pendulum about centre of gravity G
IG = m*k2**2 #kg-m**2
#Calculating the angular velocity of the pendulum
h1 = a-a*math.cos(theta)
omega = math.sqrt(2*m*9.81*h1/IA) #rad/s
#Calculating the striking velocity of the pendulum
v = omega*(a+b) #m/s
#Calculating the angular velocity of the pendulum just after the breakage of the specimen
omega1 = math.sqrt(omega**2-2*54/IA)
#Calculating the linear velocity of G just before the breakage of specimen
vG = omega*AG #m/s
#Calculating the linear velocity of G just after the breakage of specimen
vGdash = omega1*AG #m/s
#Calculating the impulses at pivot A and knife edge B
#F1+F2 = m*(vG-vGdash) .....(i)
#b*F2-a*F1 = IG*(omega-omega1) .....(ii)
A = [[1, 1],[-a, b]]
B = [[m*(vG-vGdash)], [IG*(omega-omega1)]]
V = linalg.solve(A,B)
F1 = V[0]
F2 = V[1]
#Calculating the angle of swing of the pendulum after impact
theta1 = math.cos(a-1./2*IA*omega1**2/(m*9.81))/a #radians
#Calculating the average force exerted at the pivot
Fp = F1/t #N
#Calculating the average force exerted at the knife edge
Fk = F2/t #N
#Results:
print " The striking velocity of the pendulum, v = %.2f m/s."%(v)
print " Impulse at the pivot A, F1 = %.1f N."%(F1)
print " Impulse at the knife edge B, F2 = %.1f N."%(F2)
print " Angle of swing of the pendulum after impact, theta = %.2f degree."%(theta1*180/math.pi)
print " Average force exerted at the pivot is %d N."%(round(Fp,-1))
print " Average force exerted at the knife edge is %d N."%(Fk)
# note : python linalg solve gives slightly different answer but accurate.
```

In [18]:

```
from numpy import linalg
import math
# Variables:
T = 150. #N-m
m1 = 60. #kg
m2 = 20. #kg
k1 = 140./1000 #m
k2 = 80./1000 #m
N1 = 750. #rpm
N2 = 0. #rpm
#Sloution:
#Calculating the angular speeds
omega1 = 2*math.pi*N1/60
omega2 = 0 #rad/s
#Calculating the mass moment of inertia of the rotor on motor
I1 = m1*k1**2 #kg-m**2
#Calculating the mass moment of inertia of the parts attached to machine
I2 = m2*k2**2 #kg-m**2
#Calculating the speed after engagement of the clutch and the time taken
#We know that impulsive torque = change in angular momentum
#T*t = I1*(omega1-omega) or I1*omega+T*t = I1*omega1 .....(i)
#T*t = I2*(omega-omega2) or I2*omega-T*t = I2*omega2 .....(ii)
A = [[I1, T],[ I2, -T]]
B = [I1*omega1,I2*omega2]
V = linalg.solve(A,B)
omega = V[0] #rad/s
t = V[1] #s
#Calculating the kinetic energy lost during the operation
E = I1*I2*(omega1-omega2)**2/(2*(I1+I2)) #N-m
#Results:
print " The speed after engagement, omega = %.1f rad/s."%(omega)
print " The time taken, t = %.2f s."%(t)
print " The kinetic energy lost during the operation, E = %d N-m."%(E)
```

In [21]:

```
import math
# Variables:
M = 75. #kg
r = 0.3 #m
G = 6.
IA = 100. #kg-m**2
IB = 5. #kg-m**2
eta = 90./100
#Solution:
#Calculating the equivalent mass of the geared system
me = 1/r**2*(IA+G**2*IB) #kg
#Calculating the total equivalent mass to be accelerated
Me = me+M #kg
#Calculating the acceleration when it is allowed to fall freely
F = M*9.81 #Accelerating force provided by the pull of gravity N
a = F/Me #m/s**2
#Calculating the equivalent mass of the geared system when the efficiency is 90%
me1 = 1/r**2*(IA+G**2*IB/eta) #kg
#Calculating the total equivalent mass to be accelerated
Me1 = me1+M #kg
#Calculating the acceleration when the efficiency is 90%
F1 = M*9.81 #Accelerating force by the pull of gravity N
a1 = F1/Me1 #m/s**2
#Results:
print " The acceleration of the mass M if it is allowed to fall freely, a = %.3f m/s**2."%(a)
print " The acceleration of the mass M when the efficiency of the gearing system is 0.9, a = %.3f m/s**2."%(a1)
```

In [1]:

```
import math
# variables
T = 100. #N-m ;
IA = 2. # kg-m**2 ;
IB = 32. # kg-m**2
# calculations
G = math.sqrt(IB/IA)
alphaB = G*100/(IA*G**2 + 32)
alphaA = G*alphaB
# results
print "G = %.f"%G
print "alpha B = %.2f rad/s**2"%alphaB
print "alpha A = %.f rad/s**2"%alphaA
```

In [2]:

```
import math
# variables
m = 1500. #kg ;
d = 600.
mm = 0.6 #m
r = 0.3 #m ;
IA = 8. #kg-m 2 ;
IB = 1. # kg-m 2 ;
n = 0.85
v = 24. #km/h ;
F = 300. #N ;
TB = 200. #N-m ;
sintheta = 0.25
# calculatins
tW = n * TB
P = 170./r
G = round((14 + math.sqrt(14**2 + 4 * 168.4))/2)
Amax = (P*G - 3980)/ (1590+9.44*G**2)
v = 6.67 #m/s
speed = v/r
W = G*speed
power = TB*W/1000
#Result
print "G = %.f "%G
print "maximum acceleration : %.2f m/s"%Amax
print "speed of the road wheels : %.f rad/s"%W
print "power of the engine : %.1f kW"%power
```

In [3]:

```
import math
# variables
TB = 1000. # N-m ;
v1 = 27.8 #m/s ;
v2 = 76.4 #m /s ;
d = 0.9 # m
r = 0.45 # m ;
G = 3.3 ;
v = 47.2 # m/s ;
P = 50 * 10**3 # W ;
M = 1000 #kg ;
m = 40. # kg ;
k = 0.25 #m ;
IB = 1. # kg-m**2
# calculation
IA = 4 * m* k**2
F = round(P/v,-1)
Tw = G*1000
FT = Tw/r
C1 = round(-(2325./(2*121.5)*math.log((121.5+v1)/(121.5-v1))),1)
t = round((2325./(2*121.5)*math.log((121.5+v2)/(121.5-v2)))-4.5,1)
# result
print "the time taken for the speed to rise : %.1f s"%t
```

In [4]:

```
import math
# variables
G = 9
IA = 0.6 #kg-m2
IB = 45. # kg-m 2 ;
TB = 100. # N-m;
n = 0.95;
N = 160. # r.p.m. ;
N1 = 0
N2 = 60. # r.p.m. ;
TA = 30. # N-m
W1 = 0
# calculations
P = 2*math.pi*N*TB/(60*n)
t = 60. # time
TA = 30.
TB1 = G*TA*n
B = TB1 - TB
alphaB = B/91.2
W2 = 2*math.pi*N2/60
t = (W2 - W1)/alphaB
G1 = (7.27 + math.sqrt(7.27**2+4*78.95))/2
# result
print "the power which the motor must develop : %.f W"% P
print "final angular speed : %.1f s"%t
print "maximum angular acceleration : %.3f "%G1
```

In [10]:

```
import math
# Variables:
d = 1.5 # m
r = d/2 # m
d1 = 1. # m
kM = 90./1000
kI = 225./1000
kD = 600./1000
kP = 450./1000 #m
NM = 900. # rpm
N1 = 275. # rpm
ND = 50. #rpm
mM = 200. # kg
mI = 375. # kg
mD = 2250. # kg
mP = 200. # kg
m1 = 1150. # kg
m2 = 650. #kg
FI = 150. # N-m
FD = 1125. # N-m
FP = 150. #N-m
F1 = 500. # N
F2 = 350. #N
a = 0.9 #m/s**2
#Solution:
#Calculating the speed of guide pulley
NP = ND*d/d1 #rpm
#Calculating the gear ratio for intermediate gear and motor
G1 = N1/NM
#Calculating the gear ratio for drum and motor
G2 = round(ND/NM,3)
#Calculating the gear ratio for the guide pulley and motor
G3 = NP/NM
#Calculating the mass moment of inertia of the motor
IM = mM*kM**2 #kg-m**2
#Calculating the mass moment of inertia of the intermediate gear
II = mI*kI**2 #kg-m**2
#Calculating the mass moment of inertia of the drum and shaft
ID = mD*kD**2 #kg-m**2
#Calculating the mass moment of inertia of the guide pulley
IP = mP*kP**2 #kg-m**2
#Calculating the angular acceleration of the drum
alphaD = a/r #rad/s**2
#Calculating the angular acceleration of the motor
alphaM = alphaD*NM/ND #rad/s**2
#Calculating the equivalent mass moment of inertia of the system
I = IM+G1**2*II+G2**2*ID+2*G3**2*IP #kg-m**2
#Calculating the torque at motor to accelerate the system
T1 = round(I*alphaM,1) #N-m
#Calculating the torque at motor to overcome friction at intermediate gear
#drum and two guide pulleys
T2 = round(G1*FI+G2*FD+2*G3*FP,1) #N-m
#Calculating the tension in the rimath.sing rope between the pulley and drum
Q1 = m1*9.81+m1*a+F1 #N
#Calculating the tension in the falling rope between the pulley and drum
Q2 = m2*9.81-m2*a-F2 #N
#Calculating the torque at drum
TD = round((Q1-Q2)*r) #N-m
#Calculating the torque at motor to raise and lower cages and ropes and to overcome frictional resistance
T3 = G2*TD #N-m
#Calculating the total motor torque required
T = T1+T2+T3 #N-m
#Results:
print " The total motor torque required, T = %.1f N-m."%(T)
# rounding off error.
```

In [25]:

```
import math
# Variables:
m1 = 50. #kg
m2 = 25. #kg
u1 = 3. #m/s
u2 = 1.5 #m/s
#Solution:
#When the impact is inelastic
#Calculating the common velocity after impact
v = (m1*u1+m2*u2)/(m1+m2) #m/s
#Calculating the loss of kinetic energy during impact
EL = m1*m2/(2*(m1+m2))*(u1-u2)**2 #N-m
#When the impact is elastic
#Calculating the velocity of the first sphere immediately after impact
v1 = 2*v-u1 #m/s
#Calculating the velocity of the second sphere immediately after impact
v2 = 2*v-u2 #m/s
#Calculating the loss of kinetic energy
EL1 = 0
#When the coefficient of restitution e = 0.6
e = 0.6
#Calculating the velocity of the first sphere immediately after impact
v12 = (1+e)*v-e*u1 #m/s
#Calculating the velocity of the second sphere immediately after impact
v22 = (1+e)*v-e*u2 #m/s
#Calculating the loss of kinetic energy
EL2 = m1*m2/(2*(m1+m2))*(u1-u2)**2*(1-e**2) #N-m
#Results:
print " The common velocity after impact when the impact is inelastic, v = %.1f m/s."%(v)
print " The loss of kinetic energy during impact, EL = %.2f N-m."%(EL)
print " The velocity of the first sphere immediately after impact when the impact is elastic, v1 = %d m/s."%(v1)
print " The velocity of the second sphere immediately after impact, v2 = %.1f m/s."%(v2)
print " The loss of kinetic energy, EL = %d."%(EL1)
print " The velocity of the first sphere immediately after impact When the coefficient of \
restitution is 0.6, v1 = %.1f m/s."%(v12)
print " The velocity of the second sphere immediately after impact, v2 = %.1f m/s."%(v22)
print " The loss of kinetic energy during impactm EL = %d N-m."%(EL2)
```

In [14]:

```
import math
# Variables:
m1 = 15.*1000 #kg
m2 = 5.*1000 #kg
u1 = 20.*1000/3600 #m/s
u2 = 12.*1000/3600 #m/s
s = 1000.*10**3 #N/m
e = 0.5
#Solution:
#Calculating the common speed
v = (m1*u1+m2*u2)/(m1+m2) #m/s
#Calculating the difference in kinetic energies before impact and during impact
d = m1*m2/(2*(m1+m2))*(u1-u2)**2 #Difference in kinetic energies N-m
#Equating the difference between kinetic energies to the strain energy stored in the springs
x = math.sqrt(d*2/(4*s))*1000 #mm
#Calculating the speed of the loaded wagon immediately after impact ends
v11 = 2*v-u1 #m/s
#Calculating the speed of the empty wagon immediately after impact ends
v21 = 2*v-u2 #m/s
#Calculating the speeds of the wagons taking into account the coefficient of restitution e = 0.5
v12 = (1+e)*v-e*u1 #m/s
v22 = (1+e)*v-e*u2 #m/s
#Calculating the amount of energy dissipated during impact
EL = m1*m2/(2*(m1+m2))*(u1-u2)**2*(1-e**2) #N-m
#Results:
print " The magnitude of common speed v = %d m/s."%(v)
print " The maximum deflection of each buffer spring during impact x = %d mm."%(x)
print " The speed of the loaded wagon immediately after the impact ends v1 = %.2f m/s."%(v11)
print " The speed of the empty wagon immediately after the impact ends v2 = %.2f m/s."%(v21)
print " When coefficient of restitution is taken into account v1 = %.3f m/s."%(v12)
print " When coefficient of restitution is taken into account v2 = %.3f m/s."%(v22)
print " The amount of energy dissipated during impact EL = %d N-m."%(EL)
# rounding off error. please check.
```

In [4]:

```
import math
# Variables:
IA = 22.5 #kg-m**2
IB = 67.5 #kg-m**2
q = 225. #N-m/rad
NA = 150. #rpm
NB = 0. #rpm
#Calculating the angular speed of the flywheel
omegaA = 2*math.pi*NA/60 #rad/s
#Calculating the angular speed of both the flywheels at the instant their speeds are equal
omega = IA*omegaA/(IA+IB) #rad/s
#Calculating the kinetic energy of the system at that instant
E2 = 1./2*(IA+IB)*omega**2 #N-m
#Calculating the kinetic energy of the flywheel A
E1 = 1./2*IA*omegaA**2 #N-m
#Calculating the strain energy stored in the spring
E = E1-E2 #Strain energy stored in the spring N-m
#Calculating the maximum twist of the spring
theta = math.sqrt(E*2/q) #radians
thetad = theta*180/math.pi #Maximum twist degrees
#Calculating the speed of each flywheel when the spring regains its initial unstrained condition
N = 60*omega/(2*math.pi)
NA1 = 2*N-NA #rpm
NB1 = 2*N-NB #rpm
#Results:
print " The strain energy stored in the spring is %d N-m."%(E)
print " The maximum twist of the spring theta = %.1f degrees."%(thetad)
print " The speed of flywheel A when the spring regains its initial unstrained condition NA1 = %d rpm \
\ni.e. %d rpm in the opposite direction."%(NA1,-NA1)
print " The speed of flywheel B when the spring regains its initial unstrained condition NB1 = %d rpm."%(NB1)
```