#Variable declaration
#a) INELASTIC
#for sphere 1 ,mass=m1 and initial velocity=u1
#for sphere 2 ,mass=m2 and initial velocity=u2
m1=100.#lb
u1=10.#ft/s
m2=50.#lb
u2=5.#ft/s
#Calculations
v=(m1*u1+m2*u2)/(m1+m2)
#change in kinetic energy
#initial kinetic energy = ke1
ke1=(m1*(u1**2)+m2*(u2**2))/(2*32.2)
#Kinetic Energy after inelastic colision = ke2
ke2=((m1+m2)*8.333**2)/(2*32.2)
#Change in Kinetic Energy =l
l=ke1-ke2
#b) Elastic
# for a very short time bodies will have a common velocity given by v=8.333 ft/s
# for a very short time bodies will have a common velocity given by v=8.333 ft/s
#immidiately after impact ends the velocities for both the bodies are given by v1 and v2
v1=2*v-u1
v2=2*v-u2
#c) Coeeficient of Restitution=0.6
e=0.6
ve1=(1+e)*v-e*u1
ve2=(1+e)*v-e*u2
ke3=(m1*(ve1**2)+m2*(ve2**2))/(2*32.2)
loss=ke1-ke3
#Results
print "kinetic energy before collisio0n is %.1f ft lb"%ke1
print "\na) INELASTIC"
print "velocity after collision is %.3f ft/s"%v
print "the Kinetic Energy after collision is %.1f ft lb"%ke2
print "the change in Kinetic Energy after collision is %.1f ft lb"%l
print "\nb) ELASTIC"
print "velocity of 1 after collision is %.3f ft/s"%v1
print "velocity of 2 after collision is %.3f ft/s"%v2
print "there is no loss of kinetic energy in case of elastic collision"
print "\nc) e=0.6"
print "velocity of 1 after collision is %.3f ft/s"%ve1
print "velocity of 2 after collision is %.3f ft/s"%ve2
print "the Kinetic Energy after collision is %.1f ft lb"%ke3
print "the change in Kinetic Energy after collision is %.2f ft lb"%loss
#Variable declaration
m1=15.#tons
u1=12.#m/h
m2=5.#tons
u2=8.#m/h
k=2.#ton/in
e1=0.5#coefficient of restitution
#Calculations&Results
#conservation of linear momentum
v=(m1*u1+m2*u2)/(m1+m2)
print "velocity at the instant of collision is %.2f mph"%v
e=(m1*m2*(88./60)**2*(u1-u2)**2)/(2*32.2*(u1+u2))
print "The difference between the kinetic energy before and during the impact is %.2f ft tons"%e
#energy stored in spring equals energy dissipated
#s=(1/2)*k*x**2
#s=e
#since there are 4 buffer springs ,4x**2=24 inches (2 ft=24 inches)
x=((e*12)/4)**.5
print "Maximum deflection of the spring is %.2f in"%x
# maximum force acting between pair of buffer = stiffness of spring*deflection
f=k*x
print "Maximum force acting between each buffer is %.2f tons"%f
#assuming perfectly elastic collision
#for loaded truck
v1=2*11-12
#for unloaded truck
v2=2*11-8
print "Speed of loaded truck after impact %.2f mph"%v1
print "speed of unloaded truck after impact %.2f mph"%v2
#if coefficient of restitution =o.5
#for loaded truck
ve1=(1+.5)*11-.5*12
#for unloaded truck
ve2=(1+.5)*11-.5*8
print "Speed of loaded truck after impact when e=0.5 %.2f mph"%ve1
print "Speed of unloaded truck after impact when e=0.5 %.2f mph"%ve2
#net loss of kinetic energy=(1-e**2)*energy stored in spring
l=(1-(e1**2))*2#ft tons
print "Net loss of kinetic energy is %.2f ft tons"%l
import math
#Variable declaration
m1=500.#lb ft^2
m2=1500.#lb ft^2
k=150#lb ft^2
w1=150#rpm
#Calculations&Results
N=(w1*m1)/(m1+m2)
print "Angular velocity at the instant when speeds of the flywheels are equalised is given by %.f r.p.m"%N
#kinetic energy at this instance
ke1=(1./2)*((m1+m2)/32.2)*((math.pi*N)/30)**2
print "The kinetic energy of the system at this instance is %.2f ft lb"%ke1
#initial kinetic energy
ke0=(1./2)*((m1)/32.2)*((math.pi*w1)/30)**2
print "The initial kinetic energy of the system is %.2f ft lb"%ke0
#strain energy = s
s=ke0-ke1
print "strain energy stored in the spring is %.2f ft lb which is approximately 1435 ft lb"%s
x=((1435*2)/150)**.5
print "Maximum angular displacement is %.2f in radians which is equal to 250 degrees"%x
#na1 and na are initial and final speeds of the flywheel 1 and same nb1 and nb for flywheel 2
na=2*N-w1#w1=na1
nb=2*N-0#nb1=0
print "Speed of flywheel a and b when spring regains its unstrained position are %.2f rpm and %.2f rpm respectively"%(na,nb)
import math
#Variable declaration
m1=150 #lb
l=3#ft
#number of oscillation per second is given by n
#Calculations&Results
n=(50/92.5)
print "number of oscillation per second = %.3f"%n
#length of simple pendulum is given by L=g/(2*math.pi*n)**2
L=32.2/(2*math.pi*n)**2
print "length of simple pendulum = %.2f ft"%L
# distance of cg from point of suspension is given by a
a=25./12
k=(a*(L-a))**.5#radius of gyration
moi=m1*k**2
print "The moment of inertia of rod is %.f lb ft**2"%moi
import math
#Variable declaration
n1=50/84.4
n2=50/80.3
#Calculations
L1=(32.2*12)*(84.4/(100*math.pi))**2
L2=(32.2*12)*(80.3/(100*math.pi))**2
#a1(L1-a1)=k**2=a2(L2-a2) and a1+a2=30 inches
#substituting and solving for a we get
a1=141/6.8
a2=30-a1
k=(a1*(L1-a1))**.5
moi=90*(149./144)#moi=m*k**2
#Results
print "length of equivalent simple pendulum when axis coincides with small end and big end respectively-"
print "L1=%.1f in"%L1
print "L2=%.1f in"%L2
print "distances of cg from small end and big end centers respectively are-"
print "a1=%.1f in"%a1
print "a2=%.1f in"%a2
print "Moment of inertia of rod =%.2f lb ft^2"%moi
import math
#Variable declaration
m1=150
l=8.5
g=32.2
a=83.2
n=25
#Calculations&Results
#k=(a/2*%pi*n)*(g/l)**0.5
k=(14*a*((g)**0.5))/(2*math.pi*n*(l**0.5))
k1=14.5/12
print "radius of gyration is %.2f inches which is equal to %.2f ft"%(k,k1)
moi=m1*(k1**2)
print "moment of inertia=%.f lb ft^2"%moi
#Variable declaration
m=2.5#lb
a=6#in
k=3.8#in
l=9#in
c=3#in
w=22500
#Calculations&Results
#k^2=ab
#case a) to find equivalent dynamic system
b=(k**2)/a
ma=(2.5*6)/8.42#m*a/a+b
mb=m-ma
print "Mass ma =%.2f lb will be situated at 6 inches from cg \nand mb =%.2f lb will be situated at %.2f inches " \
"\nfrom cg in the equivalent dynamical system"%(ma,mb,b)
#if two masses are situated at the bearing centres
ma1=(2.5*6)/9
mb1=m-ma1
k1=(a*c)**.5
#t=m*((k1^2)-(k^2))*w
t=((2.5*(18-3.8**2))*22500)/(32.2*12*12)
print "\ncorrection couple which must be applied in order that the two mass system is dynamically equivalent to"\
"the rod is given by %.1f lb ft"%t
#Variable declaration
m=20.#lb
g=32.2
a=200#ft/s^2
w=120#rad/s^2
k=7.#in
#Calculations
f=(m/g)*a#effective force appllied to the link
#this force acts parallel to the acceleration fg
t=(m/g)*(k/12)**2*w#couple required in order to provide the angular acceleration
#the line of action of F is therefore at a distance from G given by
x=t/f
#Results
print "Effective force applied to the link is %.3f lb and the line of action of F is therefore at a distance"\
"from G given by %.3f ft"%(f,x)
print "F is the resultant of Fa and Fb, using x as shown in figure.25 , the force F may then be resolved along" \
"the appropriate lines of action to give the magnitudes of Fa and Fb"
print "From the scaled diagram shown in figure we get,Fa=65 lb and Fb=91 lb"
#Variable declaration
m=10#ton
m2=1000#lb
a=3#ft/s^2
#Calculations
#the addition to actual mass in order to allow for the rotational inertia of the wheels and axles
m1=2*(1000./2240)*(15./21)**2#m1=m2*k**2/r**2 and 1 ton=2240 lbs
M=m+m1
F=3*(10.46/32.2)#F=M.a
f=F*2240#lb
Fa=(2*1000./2240)*(3/32.2)*(15./21)**2#total tangential force required in order to provide the angular acceleration of the wheels and axles
#Limiting friction force =uW
#u*10>0.042
u=0.042/10
#Results
print "The total tangential force required in order to provide the angular acceleration of the wheels and axles is %.3f ton"%Fa
print "If there is to be pure rolling ,u>%.4f"%u
#Variable declaration
Ia=200#lb ft2
Ib=15#lb ft2
G=5#wb==5*wa
m=150.#lb
r=8#in
#Calculations
#the equivalent mass of the geared system referred to the circumference of the drum is given by
#Me=(1./r)**2*(Ia+(G**2*Ib))
Me=(12./r)**2*(Ia+(G**2*Ib))
M=m+Me
a=(m/M)*32.2#acceleration
#if efficiency of gearing is 90% then Me=(1/r**2)*(Ia+(G**2*Ib)/n)
n=.9
Me1=(12./r)**2*(Ia+(G**2*Ib)/n)
M1=Me1+m
a1=(m/M1)*32.2
#Results
print "acceleration = %.2f ft/s2"%a
print "acceleration when gear efficiency is 0.9= %.2f ft/s2"%a1
#Variable declaration
#let
#S=displacement of car from rest with uniform acceleration a, the engine torque T assumed to remain ocnstant
#v=final speed ofcar
#G=gear ratio
#r=effective radius
#n=efficiency of transmission
#M=mass of the car
#Ia and Ib=moments of inertia of road whels and engine
#formulas => F=29.5nG ; Me= 1648+$.54nG^2 ; a=32.2 F/Me
#given
G1=22.5
G2=12.5
G3=7.3
G4=5.4
n=.82#for 1st ,2nd and 3rd gear
n4=.9#for 4th gear
#Calculations
F1=29.5*n*G1
F2=29.5*n*G2
F3=29.5*n*G3
F4=29.5*n4*G4
#on reduction and putting values we get
Me1=1648+4.54*n*G1**2
Me2=1648+4.54*n*G2**2
Me3=1648+4.54*n*G3**2
Me4=1648+4.54*n4*G4**2
a1=32.2*F1/Me1
a2=32.2*F2/Me2
a3=32.2*F3/Me3
a4=32.2*F4/Me4
#Results
print "Maximum acceleration of car on top gear is %.2f ft/s^2"%a4
print "Maximum acceleration of car on third gear is %.2f ft/s^2"%a3
print "Maximum acceleration of car on second gear is %.2f ft/s^2"%a2
print "Maximum acceleration of car on first gear is %.2f ft/s^2"%a1
import math
#Variable declaration
I=40#lb ft2
n=500#rpm
#Calculations
w=math.pi*n/30#angular velocity
wp=2*math.pi/5#angular velocity of precession
I1=I/32.2
T=I1*w*wp#gyroscopic couple
#Result
print "The couple supplied to the shaft= %.2f lb ft"%T
import math
#Variable declaration
I=250#lb ft2
n=1600#rpm
v=150#mph
r=500#ft
#Calculations&Results
w=math.pi*160/3#angular velocity of rotation
wp=(150.*88)/(60*500)#angular velocity of precession
#a) with three bladed screw
#T=I*w*wp
T=(250/32.2)*math.pi*(160./3)*wp
#b)with two bladed air screw
#T1=2*I*w*wp*sin(o)
print "The magnitude of gyroscopic couple is given by %.0f lb ft"%T
#Tix=T(1-cos(2o)) lb ft
#T1y=Tsin(2o)) lb ft
print "The component gyroscopic couple in the vertical plane =%.0f(1-cos(2x)) lb ft"%T
print "The component gyroscopic couple in the horizontal plane =%.0f(sin(2x)) lb ft"%T