import math
# Variables
L = 50. #ft
Do = 2 #in
Di = 1.5 #in
Mt = 10000. #lb in
G = 12.*10**6
# Calculations
Tmax = 16*Mt*Do/(math.pi*(Do**4-Di**4))
angle = (Mt*L*12*32)*57.3/(G*math.pi*(Do**4-Di**4))
# Results
print 'Maximum shearing strees = %.f psi'%(round(Tmax,-1))
print 'twist angle = %.1f degrees'%(angle)
import math
# Variables
d = 4. #ft
T = 5000. #psi
angle = 0.1 #degrees
# Calculations
T1 = (math.pi*d**3)*T/16
T2 =angle*math.pi*G*math.pi*d**4/(180*12*32)
# Results
if (T1<T2):
print 'Safe torque = %.2f lb in'%(T1)
else:
print 'Safe torque = %.2f lb'%(T2)
# note : anwer is wrong in book. plz check.
from numpy import linalg
# Variables
Ds = 1. #in
Db = 1.5 #in
Ls = 4. #in
Lb = 6. #in
Gs = 12.*10**6 #psi
Gb = 6.4*10**6 #psi
T = 10000. #lb in
# Calculations
A = [[1,1],[(Ls*12/(Gs*Ds**4)),(-Lb*12/(Gb*Db**4))]]
b = [T,0]
c = linalg.solve(A,b)
Tab = c[0]
Tbc = c[1]
# Results
print 'Torque in section AB = %.f lb in'%(Tab)
print 'Torque in section AB = %.f lb in'%(Tbc)
# note : Answers are slightly different because of inbuilt solve function of python.
import math
# Variables
T = 10000. #lb in
G = 12.*10**6
Dab = 1.5 #in
Lab = 4. #in
Dcd = 1. #in
Lcd = 3. #in
# Calculations
F = T/2
Tab = F*Lab
angle = ((T*32*12*Lcd/(G*math.pi*Dcd**4))+2*(Tab*32*12*Lab/(G*math.pi*Dab**4)))*(180/math.pi)
# Results
print 'angle of twist = %.0f degrees'%(angle)
import math
# Variables
Tallowable = 5000. #psi
power = 250. #hp
n = 1800. #rpm
# Calculations
T = 63000*power/n
d = (16*T/(math.pi*Tallowable))**(1/3.)
# Results
print 'Torque = %.2f lb in'%(T)
print 'diameter =%.2f in'%(d)
import math
# Variables
ds = 2. #in
n = 315. #rpm
Gs = 12.*10**6
Lab = 5. #in
Lbc = 15. #in
Pa = 10. #hp
Pc = 40. #hp
Pb = 50. #hp
# Calculations
Tab = 63000*Pa/n
Tbc = 63000*Pc/n
angle = ((32*Tbc*Lbc*12/(math.pi*ds**4*G))-(32*Tab*Lab*12/(math.pi*ds**4*G)))*(180/math.pi)
# Results
print 'angle of twist of gear C releative to a = %.2f degrees'%(angle)
import math
# Variables
k1 = 6.*10**6 #lb in/rad
k2 = 3.*10**6 #lb in/rad
k3 = 2.*10**6 #lb in/rad
T = 10000. #lb in
# Calculations
ke = 1/((1/k1)+(1/k2)+(1/k3))
angle = T*180/(ke*math.pi)
# Results
print 'equivalent spring constant = %.2e lb in/rad'%(ke)
print 'angle of twist d/a = %.2f degrees'%(angle)
import math
# Variables
k1 = 2.*10**6 #lb in/rad
k2 = 3.*10**6 #lb in/rad
T = 20000. #lb in
# Calculations
ke = k1+k2
angle = T*180/(ke*math.pi)
# Results
print 'equivalent spring consmath.tant = %.2e lb in/rad'%(ke)
print 'angle of twist at B = %.3f degrees'%(angle)
import math
# variables
n = 10 # coils
P = 1200. # axial load lb
R = 2.
K = 1.33 # factor
d = 1.
# Calculations
Tmax = round(K*(16*P*R)/(math.pi*d**3),-2)
delta = 64*P*R**3*n/(12*10**6*d**4)
# Results
print "Stress = %d psi"%Tmax
print "The deflection = %.3f in"%delta
# Variables
di = 0.2 #in
dm = 2. #in
n = 10.
F = 10. #lb
G = 12.*10**6
# Calculations
k = G*di**4/(64*dm**3*n)
ke = 1/((1/(k+k))+(1/k)+(1/k))
delta = F/ke
# Results
print 'elongation = %.2f in'%(delta)
import math
# Variables
d = 0.5 #in
n = 315. #rpm
t1 = 5000. #psi
r1 = 8. #in
r2 = 4. #in
n1 = 6.
n2 = 4.
# Calculations
t2 = r2*t1/r1
T = r1*n1*(math.pi/4)*d**2*t1+r2*n2*(math.pi/4)*d**2*t2
hp = T*n/63000
# Results
print 'Premissible horsepower = %.f hp'%(hp)