import math
##initialization of variables
#find the depth of clay bed
l=20. ##cm
dL=1. ##m
dl=0.004 ##cm
##calculations
L=l*dL/dl ##m
##results
print'%s %.2f %s'%('The depth of the clay bed is ',L,' m')
import math
##initialization of variables
#find the total extension of the rod and draw the force and extension diagrams
A=1. ##unit area
E=2.*10**6 ##kg/cm^2
## calculations
db=3000.*90./(A*E)
dc=db+5000.*60./(A*E)
dd=dc+4000.*30./(A*E)
##results
print'%s %.2e %s %.2e %s %.2e %s '%('The extension of the rod in part AB is ',db,' cm'and'in part BC is ',dc,' cm'and' \n and in part CD is ',dd,' cm')
import math
##initialization of variables
#findthe extension under its own weight
A=3. ##cm^2
L=18. ##m
E= 2*10**6 ##kg/cm^2
r=7833. ##kg/m^3
##calculations
e=r*(L*100)**2./(2*E*10**6)
## results
print'%s %.4f %s'%('The elongation is ',e,' cm')
import math
##initialization of variables
#find the extension under a concertrated load of 3 tonne at the bottom
## linked to 5_3
P=3 ##tonne
E=2*10**6 ##kg/cm^2
d_0= 1. ##cm
d_l=2.8 ##cm
## calculations
e=4*P*1000.*d_l*10**3/(d_l**2*math.pi*E*(1-((d_l-d_0)/d_l)))
##results
print'%s %.2f %s'%('The total elongation is ',e,' cm')
import math
##initialization of variables
import numpy
from numpy import linalg
import scipy as Sci
from scipy import linalg
P=10 ##tonne
import numpy as np
E=2*10**6 ##kg/cm^2
## calculations
## We have to solve linear system Ax=B
A=numpy.matrix([[1, 1, 1, 0], [3, 1, -3, 0],[-2, 2, 0, -E],[0, -1, 2, -E]])
B=numpy.matrix([[P*10**3],[0],[0],[0]])
x=numpy.dot(np.linalg.inv(A),B)
W1=x[0,0]/1000.
W2=x[1,0]/1000.
W3=x[2,0]/1000.
th=x[3,0]
##results
print'%s %.2f %s %.2f %s %.2f %s '%('The load taken by each rod is',W1,' tonne'and'',W2,' tonne'and'',W3,'tonne')
print'%s %.3e %s'%('\n and the slope is theta = ',th,' radians')
import math
## initialization of variables
#calculate the safe load taken by the column
b=30. ## cm
h=30. ##cm
n=6.
A=36. ##cm^2
ss_s=1500. ##kg/cm^2
ss_c=60. ##kg/cm^2
Er=15. ## Elasticity ratio
## calculations
L=A*Er*ss_c+(b*h-A)*ss_c
## results
print'%s %.2f %s'%('The safe load is ',L,'.kg')
#find the stress in steel and concerete after redisturbution of stress in steel and cncerete
## initiaization of variables
import math
gs_b=10. ##cm
gs_h=10. ##cm
d_b=2. ##cm
d_h=2. ##cm
As= 1. ##cm^2
s=10000. ##kg/cm^2
## part (a)
Es=2*10**6 ##kg/cm^2
Ec=2*10**5 ##kg/cm^2
## calculations
e=s/Es
Ac=gs_b*gs_h-(d_b*d_h)
e_c=e*Es*As/(Ec*Ac+Es*As)
s_c=Ec*e_c
e_s=e-e_c
s_s=Es*e_s
## results
print'%s %.2f %s %.2f %s '%('part (a) \n The stress in steel and concrete are respectively ',s_s,''and '',s_c,' kg/cm^2')
## part(b)
P=8000. ##kg
## calculations
e_c=(e*Es*As-P)/(Ec*Ac+Es*As)
e_s=e-e_c
s_c=Ec*e_c
s_s=Es*e_s
## results
print'%s %.2f %s %.2f %s'%('\n part (b) \n The stress in steel and concrete are respectively ',s_s,''and '',s_c,'kg/cm^2')
##calculate temperature which sleeve must be heated if the room temperature is 10c
#and pressure and find axial force necessary to separate the two room temperature and the temperature at which sleeve will easily come off
## initialization
import math
d=10 ##cm
D=9.99 ##cm
t=3 ##mm
E=1.0*10**6 ##kg/cm^2
a=2.02*10**-5 ## degree/celcius
## part(a)
Tr=10. ##degree C
T=(d-D)/D*1/a
print'%s %.2f %s'%('part(a) \n The sleeve must be heated to ',T+Tr,' degree C or more for this purpose')
##part(b)
s_th=a*T*E
p=s_th*t*2./(d*10.)
print'%s %.2f %s'%('\n part(b) \n The pressure developed between the rod and sleeve is',p,' kg/cm^2')
## part(c)
f=0.2
o=10. ## overlap: cm
A=math.pi*d*o
F=f*p*A
print'%s %.2f %s'%('\n part (c) \n The axial force required is ',F,' kg')
##part (d)
## linked to part c
T2=20. ##degree C
a2=1.17*10**-5 ## /degree C
Ts=(a-a2)*(T2-Tr)*E
Ts=s_th-Ts
p2=p*Ts/s_th
F2=F*Ts/s_th
print'%s %.2f %s'%('\n part(d)\n The pressure developed between the rod and sleeve is',p2,' kg/cm^2')
print'%s %.2f %s'%('\n The axial force required is ',F2,' kg')
##part(e)
T3=Tr+(s_th/((a-a2)*10**6))
print'%s %.2f %s'%('\n part(e) \n The temperature at which the sleeve comes off easily is ',T3,' C')
print('calculations in the text: rounding off errors')
import math
##initialization of variables
#calculate the radius of curvature of this strip at temperautre of 93.3
T1=37.8 ## degre C
t=0.355 ##mm
T2=93.3 ## degree C
L=2 ##cm
m=1
n=1.53
a=1.86*10**-5
##calculations
R=2*t*(3*(1+m)**2.+(1+m*n)*(m**2+(m*n)**-1))
R=R/(6.*a*(T2-T1)*(1+m**2)) ## mm
R=R/10.
D=L**2./(8.*R)
## results
print'%s %.2f %s'%('The radius of curvature is ',R,' cm')
print'%s %.4f %s'%('\n The deflection is',D ,' cm')
import math
## initialization of variables
#find the energy stored in bolt
L=5. ##cm
D=1.8 ##cm
l=2.5 ##cm
d=1.5 ##cm
F=1 ##tonne
E=2.1*10**6 ##kg/cm^2
## calculations
s1=F*1000.*4./(D**2*math.pi)
s2=F*1000.*4./(d**2*math.pi)
U1=1/2.*s1**2./E
U1=U1*L*D**2*math.pi/4.
U2=1/2.*s2**2./E
U2=U2*l*d**2*math.pi/4.
U=U1+U2
## results
print'%s %.1f %s'%('The energy stored in the bolt is ',U,' kg-cm')
import math
## initialization of variables
#calculate which of the two ways will give stronger joint
t=16. ##mm
Pt=1500. ##kg/cm^2
Ps=1025. ##kg/cm^2
Pb=2360. ##kg/cm^2
##part (a)
p=6. ##cm
r=24. ##mm
d=r/10.+0.15
Ft=t*(p-d)*Pt/10.
Fs=math.pi*d**2*Ps/4.
Fb=d*t*Pb
x=min(Ft,Fs,Fb)
effA=x*100./(p*t/10.*Pt)
##part (b)
p=9. ##cm
r=30. ##mm
d=r/10.+0.2
Ft=t*(p-d)*Pt/10.
Fs=math.pi*d**2*Ps/4.
Fb=d*t*Pb
x=min(Ft,Fs,Fb)
effB=x*100./(p*t/10.*Pt)
## results
print'%s %.2f %s %.2f %s '%('The efficiencies corresponding to cases a and b are ',effA,'' and '',effB,'')
print('\n Hence part b is better than part a')