import math
## initialization o variables
#find the shear force on each rivet and suitable diameter of rivets
p=5. ##cm
D=10. ##cm
d=2. ##mm
T= 10. ##kgm
ss= 785. ##kg/cm^2
## calculations
P= 2.*T/(math.pi*D**2)
P=P*5*100.
## results
print'%s %.2f %s'%('Force per rivet is ',P,' kg')
print'%s %.2f %s'%('\n The diameter of rivet, using a permissible stress of',ss,' kg/cm^2 = 0.227 cm')
import math
## initialization of variables
#what is maximum torque
D=5. ##cm
Y=3500. ##kg/cm^2
##part (a)
Ta=350. ##kg-m
tau=Y/2.
Ip=Ta*D*100./(2.*tau)
d1=Ip*32./math.pi
d1=(D**4-d1)**(1/4.)
##part (b)
Tb= 700. ##kg-m
Ip=Tb*D*100./(2.*tau)
d2=Ip*32./math.pi
d2=(D**4-d2)
T=tau*math.pi*(D**4)*2./(32.*D)
## results
print'%s %.2f %s'%('The maximum diameter corresponding to the case a is ',d1,' cm')
print'%s %.2f %s'%('\n Since the daimeter for the case (b) is coming out to be negative, \n The maximum torque transmitted is ',T/100,' kg-m')
import math
## initialization of variables
#find the weight of students
A=3 ##cm^2
E= 2*10**6 ##kg/cm^2
nu= 0.25
l= 60. ##m
L=150. ##cm
d=0.5 ##cm
dd=10 ##cm
D=180 ##cm
##calculations
K=(l*100./(A*E))+(L*D/2.*D*32.*2.*(1.+nu)/(E*math.pi*dd**4*2))
P=d/K
## results
print'%s %.2f %s'%('The weight of the students that entered the length is',P,' kg')
import math
## initialization of variables
#find the stress in the cable and the shaft
## linked to 6_5
A=3. ##cm^2
E= 2.*10**6 ##kg/cm^2
nu= 0.25
l= 60. ##m
L=150. ##cm
d=0.5 ##cm
dd=10 ##cm
D=180. ##cm
##calculations
K=(l*100./(A*E))+(L*D/2.*D*32.*2.*(1+nu)/(E*math.pi*dd**4*2.))
P=d/K
Ts=P/A
fs=dd*D*P*32./(math.pi*4.*dd**4)
## results
print'%s %.2f %s'%('The tensile stress is ',Ts,'kg/cm^2')
print'%s %.2f %s'%('\n Maximum shear stress is ',fs,' kg/cm^2')
import math
## initialization of variables
#find the value of x and length of the suspension arm and D
F=500. ##kg
k=25. ##kg/cm
dd=15. ##cm
ss=3500. ##kg/cm^2
L=2. ##m
G=8.*10**5 ##kg/cm^2
## calculations
x=math.sqrt(math.pi*G/(25.*L*32.*100.))
d=x*16.*(F+dd*k)/(ss*math.pi)
x2=x*d**2.
## results
print'%s %.2f %s'%('d=',d,' cm')
print'%s %.2f %s'%('\n x=',x,' cm')
## Text: not exact
import math
##initialization of variables
#find the horse power
d=5. ##cm
rpm1=300. ##rpm
rpm2=30000. ##rpm
s=1000. ##kg/cm^2
##calcuations
T=(d/2.)*math.pi*10**2*s/32.
hp1= 2*math.pi*rpm1*T/4500.
hp2=hp1*100.
## results
print'%s %.2f %s %.2f %s'%('Horse power at 300 rpm and 30000 rpm are respecively ',hp1/10,''and '',hp2/10,' h.p.')
print('wrong/approximate answers in the text')
import math
## initialization of variables
#selct solid transmits and diameter required find
hp=300. ##h.p.
N1=30. ##rpm
N2=30000. ##rpm
fs=600. ##kg/cm^2
## calculations
T1=4500.*hp*100./(2.*math.pi*N1)
T2=T1/1000.
D1=16.*T1/(math.pi*fs)
D1=D1**(1/3.)
D2=16.*T2/(math.pi*fs)
D2=D2**(1/3.)
## results
print'%s %.2f %s %.2f %s '%('Diameters required are ',D1,''and '',D2,'cm')
print('wrong calculations in the text')
import math
## initialization of variables
#find the strain energy per unit volume stored and the energy if the lenght 5cm
d=10. ##cm
t =1. ##mm
T= 100. ##kg-m
L=5. ##m
G=8*10**5 ##kg/cm^2
##calculations
r=d/2.
fs=T*r*100./(r**2*2*math.pi*L*t*10**-1)
U=fs**2/(2*G)
U1=U*(math.pi*L*100.)
## results
print'%s %.2f %s'%('Energy per unit volume = ',U,' kg-cm/cm^3')
print'%s %.2f %s'%('\n Total strain energy= ',U1,' kg-cm')
import math
##initialization of variables
#find the actual deflection of closely coiled comperssion spring
D=10. ##cm
d= 1. ##cm
n=20.
P=60. ##kg
G=8*10**5 ##kg/cm^2
##calculations
n=n-0.75*2
delta=P*n*math.pi*D**3*32./(4.*math.pi*G)
## results
print'%s %.2f %s'%('The deflection is ',delta,' cm')
import math
##initialization of variables
#find the shear stress in the wire
## linked to 6_14
D=10. ##cm
d= 1. ##cm
n=20.
P=60. ##kg
G=8*10**5 ##kg/cm^2
## calculations
m=D/d
fs=8.*P*D/(d**3*math.pi)
fs1=fs*(1+0.615/m+3./(4.*m-4.))
## results
print'%s %.2f %s %.2f %s '%('The shear stress with and without correction facor are \n respectively ',fs,''and '',fs1,'kg/cm^2')
import math
##initialization of variables
#find their angles of twist and maximum stresses
## circle
D=1. ##unit diameter
Ip=D**4/32.
Zp=D**3/16.
##Square
s=math.sqrt(math.pi/4.)*D
Is=0.886*D**4/32.
Zs=0.7383*D**3/16.
##Rectangle
a=math.sqrt(math.pi/2.)*D
b=math.sqrt(math.pi/8.)*D
Ir=0.719*D**4/32.
Zr=0.616*D**3/16.
## Trianle
t=math.sqrt(math.pi/math.sqrt(3))*D
It=0.725*D**4/32.
Zt=0.622*D**3/16.
##Ellipse
A=D/math.sqrt(2)
B=D/math.sqrt(8)
Ie=A**3*B**3/(A**2+B**2)
Ze=A*B**2/2.
##Normalization
Is=Is/Ip
Ie=Ie/Ip
It=It/Ip
Ir=Ir/Ip
Zs=Zs/Zp
Ze=Ze/Zp
Zt=Zt/Zp
Zr=Zr/Zp
Ip=1.
Zp=1.
##results
print'%s %.2f %s %.2f %s %.2f %s %.2f %s %.2f %s '%('Z:: Circle:Square:Ellipse:Triangle:Rectangle = ',Zp,'' and '',Zs,'' and '',Ze,'' and '',Zt,' 'and '',Zr,'')
print'%s %.2f %s %.2f %s %.2f %s %.2f %s %.2f %s '%('\n I:: Circle:Square:Ellipse:Triangle:Rectangle = ',Ip,'' and '',Is,'' and '',Ie,'' and '',It,'' and '',Ir,'')
import math
##initialization of variables
#find the maximum torque that can be transmitted without yeilding
yp=2450. ##kg/cm^2
d=0.4 ##cm
ys=4200. ##kg/cm^2
sa=1.6 ##mm
sb=7. ##mm
## calculations
sa=sa/10.
sb=sb/10.
T1=yp*math.pi*d**3/16.
T2=ys*0.303*sa**2*sb
## results
print'%s %.2f %s'%('The maximum torque that can be transitted by the screw-driver is ',T2,' kg-cm')
import math
##initialization of variables
#find the maximum stress in the walls
b=5. ##cm
h=10. ##cm
tL=3. ##mm
tl=1.5 ##mm
T=100. ##kg-cm
## calculations
tl=tl/10.
fs=T*100./(2.*b*h*tl)
## results
print'%s %.2f %s'%('The maximum stress is ',fs,' kg/cm^2')
import math
##initialization of variables
#compare its strength with hollow circular shaft of same thickness
b=5. ##cm
h=10. ##cm
tL=3. ##mm
tl=1.5 ##mm
T=100. ##kg-cm
## calculations
D=2.*(b+h)/math.pi
AR=b*h
AC=math.pi*D**2/4.
r=AC/AR
## results
print'%s %.2f %s'%('The ratio is 1:',r,'')
import math
##initialization of variables
#find the value of maximum shear stress and angle of twist
G=8*10**5 ##kg/cm^2
##part (a)
T =20. ##kg-m
t1=0.9 ##cm
t2=0.5 ##cm
b1=6.8 ##cm
b2=14.2 ##cm
I0=1/3.*(2.*b1*t1**3+b2*t2**3)
Zt=I0/max(t1,t2)
fs=T*100./Zt
Phi=T*100./(G*I0)
print('part (a)')
print'%s %.2f %s %.5f %s '%('\n The maximum shear stress and twist rate are respectively \n ',fs,' kg/cm^2'and'',Phi, ' radians/cm ')
##part (b)
t1=1. ##cm
t2=1. ##cm
b1=10. ##cm
b2=9. ##cm
I0=1/3.*(b1*t1**3+b2*t2**3)
Zt=I0/max(t1,t2)
fs=T*100./Zt
Phi=T*100/(G*I0)
print('\n part (b)')
print'%s %.2f %s %.5f %s '%('\n The maximum shear stress and twist rate are respectively \n ',fs,'kg/cm^2'and '',Phi,'radians/cm ')
##part (c)
t1=0.76 ##cm
t2=0.48 ##cm
b1=8. ##cm
b2=14.04 ##cm
I0=(1/3.)*(2*b1*t1**3+b2*t2**3)
Zt=I0/max(t1,t2)
fs=T*100./Zt
Phi=T*100./(G*I0)
print('\n part (c)')
print'%s %.2f %s %.5f %s ' %('\n The maximum shear stress and twist rate are respectively \n ',fs,' kg/cm^2'and '',Phi,'radians/cm ')
##part(d)
t=1 ##cm
b=19 ##cm
I0=1/3.*t**3*b
Zt=I0/t
fs=T*100./Zt
Phi=T*100./(G*I0)
print('\n part (d)')
print'%s %.2f %s %.5f %s '%('\n The maximum shear stress and twist rate are respectively \n ',fs,' kg/cm^2'and '',Phi,'radians/cm ')
print('Twist rate: answers differ by a scale of 10. wrong answers in the text')
import math
## initialization of variables
#caclualte Maximum +ve residual stress occurs at r and'radius
D=5. ##cm
d=2. ##cm
t_y=3000. ##kg/cm^2
## calculations
R=D/2.
r=d/2.
Tep=2.*math.pi*R**3*t_y/3.-math.pi*r**3.*t_y/6.
t_er=2*Tep/(math.pi*R**3)
t_er1=t_er*r/R
prs=t_y-t_er1
nrs=t_er-t_y
## results
print'%s %.2f %s %.2f %s '%('Maximum +ve residual stress occurs at ',r,' cm' and'radius and is equal to \n ',prs,' kg/cm^2')
print'%s %.2f %s %.2f %s '%('\n Maximum -ve residual stress occurs at ',R,' cm'and' radius and is equal to \n ',-nrs,' kg/cm^2')