In [5]:

```
import math
#initialisation
d_1 = 4 # inner diameter (inch)
d_2 = 4.5 #outer diameter (inch)
P = 26000 # pressure in pound
L = 16 # Length of cylinder (inch)
my_del = 0.012 # shortening of post (inch)
#calculation
A = (math.pi/4)*((d_2**2)-(d_1**2)) #Area (inch^2)
s = P/A # stress
print "compressive stress in the post is ", round(s), "psi"
e = my_del/L # strain
print "compressive strain in the post is %e" %e
```

In [16]:

```
import math
#initialisation
W = 1500 # weight (Newton)
d = 0.008 #diameter(meter)
g = 77000 # Weight density of steel
L = 40 # Length of bar (m)
#calculation
A = (math.pi/4)*(d**2) # Area
s_max = (1500/A) + (g*L) # maximum stress
#result
print "Therefore the maximum stress in the rod is ", round(s_max,1), "Pa"
```

In [7]:

```
import math
#initialisation
d1 = 4.5 # diameter in inch
d2 = 6 # diameter in inch
A = (math.pi/4)*((d2**2)-(d1**2)) # Area
P = 140 # pressure in K
s = -P/A # stress (compression)
E = 30000 # young's modulus in Ksi
e = s/E # strain
#calculation
# Part (a)
my_del = e*4*12 # del = e*L
print "Change in length of the pipe is", round(my_del,3), "inch"
# Part (b)
v = 0.30 # Poissio's ratio
e_ = -(v*e)
print "Lateral strain in the pipe is %e" %e_
# Part (c)
del_d2 = e_*d2
del_d1 = e_*d1
print "Increase in the inner diameter is ", round(del_d1,6), "inch"
# Part (d)
t = 0.75
del_t = e_*t
print "Increase in the wall thicness is %f" %del_t, "inch"
del_t1 = (del_d2-del_d1)/2
print "del_t1 = del_t"
```

In [37]:

```
import math
#initialisation
d = 0.02 # diameter in m
t = 0.008 # thickness in m
A = math.pi*d*t # shear area
P = 110000 # prassure in Newton
#calculation
A1 = (math.pi/4)*(d**2) # Punch area
t_aver = P/A # Average shear stress
print "Average shear stress in the plate is ", t_aver, "Pa"
s_c = P/A1 # compressive stress
print "Average compressive stress in the plate is ", s_c, "Pa"
```

In [39]:

```
import math
#initialisation
P = 12.0 # Pressure in K
t = 0.375 # thickness of wall in inch
theta = 40.0 # angle in degree
d_pin = 0.75 # diameter of pin in inch
t_G = 0.625 # thickness of gusset in inch
t_B = 0.375 #thickness of base plate in inch
d_b = 0.50 # diameter of bolt in inch
#calculation
#Part (a)
s_b1 = P/(2*t*d_pin) # bearing stress
print "Bearing stress between strut and pin", round(s_b1,1), "ksi"
#Part (b)
t_pin = (4*P)/(2*math.pi*(d_pin**2)) # average shear stress in the
print "Shear stress in pin is ", round(t_pin,1), "ksi"
# Part (c)
s_b2 = P/(2*t_G*d_pin) # bearing stress between pin and gusset
print "Bearing stress between pin and gussets is", s_b2, "ksi"
# Part (d)
s_b3 = (P*math.cos(math.radians(40))/(4*t_B*d_b)) # bearing stress between anchor bolt and base plate
print "Bearing stress between anchor bolts & base plate", round(s_b3,1), "ksi"
# Part (e)
t_bolt = (4*math.cos(math.radians(40))*P)/(4*math.pi*(d_b**2)) # shear stress in anchor bolt
print "Shear stress in anchor bolts is", round(t_bolt,1), "ksi"
```

In [42]:

```
import math
#initialisation
b1 = 1.5 # width of recmath.tangular crosssection in inch
t = 0.5 # thickness of recmath.tangular crosssection in inch
b2 = 3.0 # width of enlarged recmath.tangular crosssection in inch
d = 1.0 # diameter in inch
#calculation
# Part (a)
s_1 = 16000 # maximum allowable tensile stress in Psi
P_1 = s_1*t*b1
print "The allowable load P1 is", P_1, "lb"
# Part (b)
s_2 = 11000 # maximum allowable tensile stress in Psi
P_2 = s_2*t*(b2-d)
print "allowable load P2 at this section is", P_2, "lb"
#Part (c)
s_3 = 26000 # maximum allowable tensile stress in Psi
P_3 = s_3*t*d
print "The allowable load based upon bearing between the hanger and the bolt is", P_3, "lb"
# Part (d)
s_4 = 6500 # maximum allowable tensile stress in Psi
P_4 = (math.pi/4)*(d**2)*2*s_4
print "the allowable load P4 based upon shear in the bolt is", round(P_4), "lb"
```

In [9]:

```
import math
#initialisation
R_ah = (2700*0.8 + 2700*2.6)/2 # Horizontal component at A in N
R_ch = R_ah # Horizontal component at C in N
R_cv = (2700*2.2 + 2700*0.4)/3 # vertical component at C in N
R_av = 2700 + 2700 - R_cv # vertical component at A in N
R_a = math.sqrt((R_ah**2)+(R_av**2))
R_c = math.sqrt((R_ch**2)+(R_cv**2))
Fab = R_a # Tensile force in bar AB
Vc = R_c # Shear force acting on the pin at C
s_allow = 125000000 # allowable stress in tension
t_allow = 45000000 # allowable stress in shear
#calculation
Aab = Fab / s_allow # required area of bar
Apin = Vc / (2*t_allow) # required area of pin
print "Required area of bar is %f" %Apin, "m^2"
d = math.sqrt((4*Apin)/math.pi) # diameter in meter
print "Required diameter of pin is %f" %d, "m"
```

In [ ]:

```
```