In [1]:

```
import math
import numpy
#initialisation
L = 8.0 # length of beam in ft
h = 6.0 # Height of beam in inch
e = 0.00125 # elongation on the bottom surface of the beam
y = -3.0 # Dismath.tance of the bottom surface to the neutral surface of the beam in inch
#Calculations
r = -(y/e) # Radius of curvature
print "radius of curvature is", round(r), "inch"
k = 1/r # curvature in in-1
print "curvature", round(k,5), "ft-1"
theta = numpy.degrees(numpy.arcsin(((L*12.0)/(2.0*r)))) # angle in degree
print "Angle of twist", round(theta,3), "degree"
my_del = r*(1-math.cos(math.radians(theta))) #Deflection in inch
print "Deflection in the beam is ", round(my_del,4), "inch"
```

In [10]:

```
import math
#initialisation
d = 0.004 # thickness of wire in m
R0 = 0.5 # radius of cylinder in m
E = 200e09 # Modulus of elasticity of steel
s = 1200e06 # proportional limit of steel
#calculation
M = (math.pi*E*d**4)/(32*(2*R0+d)) # Bending moment in wire in N-m
print "Bending moment in the wire is ", round(M,2), "N-m"
s_max = (E*d)/(2*R0+d) # Maximum bending stress in wire in Pa
print "Maximum bending stress in the wire is %e" %(s_max), "Pa"
```

In [11]:

```
import math
#initialisation
L = 22 # Span of beam in ft
q = 1.5 # Uniform load intensity in k/ft
P = 12 # Concentrated in k
b = 8.75 # width of cross section of beam in inch
h = 27 # height of cross section of beam in inch
Ra = 23.59 # Reaction at point A
Rb = 21.41 # Reacyion at point B
Mmax = 151.6 # Maximum bending moment
#calculation
S = (b*h**2)/6 # Section modulus
s = (Mmax*12)/S # stress in k
st = s*1000 # Tensile stress
print "Maximum tensile stress in the beam", round(st), "psi"
sc = -s*1000 # Compressive stress
print "Maximum compressive stress in the beam", round(sc), "psi"
```

In [5]:

```
import math
#initialisation
q = 3200.0 # Uniform load intensity in N/m
b = 0.3 # width of beam in m
h = 0.08 # Height of the beam in m
t = 0.012 # thickness of beam in m
Ra = 3600.0 # Reaction at A in N
Rb = 10800.0 # Reaction at B in N
Mpos = 2025.0 # Moment in Nm
Mneg = -3600.0 # Moment in Nm
#calculation
y1 = t/2.0
A1 = (b-2*t)*t
y2 = h/2
A2 = h*t
A3 = A2
c1 = ((y1*A1)+(2*y2*A2))/((A1)+(2*A2))
c2 = h - c1
Ic1 = (b-2*t)*(t**3)*(1.0/12.0)
d1 = c1-(t/2.0)
Iz1 = (Ic1)+(A1*(d1**2))
Iz2 = 956600e-12
Iz3 = Iz2
Iz = Iz1 + Iz2 + Iz3 # Moment of inertia of the beam cross section
# Section Modulli
S1 = Iz / c1 # for the top surface
S2 = Iz / c2 # for the bottom surface
# Maximum stresses for the positive section
st = Mpos / S2
print "Maximum tensile stress in the beam in positive section is", st, "Pa"
sc = -Mpos / S1
print "Maximum compressive stress in the beam in positive section is", sc, "Pa"
# Maximum stresses for the negative section
snt = -Mneg / S1
print "Maximum tensile stress in the beam in negative section is", snt, "Pa"
snc = Mneg / S2
print "Maximum compressive stress in the beam in negative section is", snc, "Pa"
# Conclusion
st_max = st
sc_max = snc
```

In [6]:

```
import math
#initialisation
L = 12 # Length of beam in ft
q = 420 # Uniform load intensity in lb/ft
s = 1800 # Allowable bending stress in psi
w = 35 # weight of wood in lb/ft3
#calculation
M = (q*L**2*12)/8 # Bending moment in lb-in
S = M/s # Section Modulli in in3
# From Appendix F
q1 = 426.8 # New uniform load intensity in lb/ft
S1 = S*(q1/q) # New section modulli in in3
# From reference to appendix F, a beam of cross section 3*12 inch is selected
print ("Beam of crosssection 3*12 is sufficient")
```

In [18]:

```
import math
#initialisation
P = 12000 # Lataeral load at the upper end in N
h = 2.5 # Height of post in m
Mmax = P*h # Maximum bending moment in Nm
#calculation
# Part (a) : Wood Post
s1 = 15e06 # Maximum allowable stress in Pa
S1 = Mmax/s1 # Section Modulli in m3
d1 = ((32.0*S1)/math.pi)**(1.0/3.0) # diameter in m
print "the minimum required diameter d1 of the wood post is", round(d1,3), "m"
# Part (b) : Alluminium tube
s2 = 50e06 # Maximum allowable stress in Pa
S2 = Mmax/s2 # Section Modulli in m3
d2 = (S2/0.06712)**(1.0/3.0) # diameter in meter.....(1)
print "minimum required outer diameter d2 of the aluminum tube is", round(d2,3),"m"
```

In [1]:

```
import math
#initialisation
q = 2000.0 # Uniform load intensity in lb/ft
s = 18000.0 # Maximum allowable load in Psi
Ra = 18860.0 # Reaction at point A
Rb = 17140.0 # Reaction at point B
#calculation
x1 = Ra/q # Distance in ft from left end to the point of zero shear
Mmax = (Ra*x1)-((q*(x1**2))/2.0) # Maximum bending moment in lb-ft
S = (Mmax*12.0)/s # Section Modulli in in3
# Trial Beam
Ra_t = 19380.0 # Reaction at point A
Rb_t = 17670.0 # Reaction at point B
#in Python the value for x1 differes by some points and hence the subsequent results differ
x1_t = Ra_t/q # Distance in ft from left end to the point of zero shear
Mmax_t = (Ra_t*x1_t)-((q*(x1_t**2))/2.0) # Maximum bending moment in lb-ft
S_t = (Mmax_t*12.0)/s # Section Modulli in in3
# From table E beam 12*50 is selected
print "Beam of crosssection 12*50 is selected with section modulli", round(S_t,2), "in^3"
```

In [15]:

```
import math
#initialisation
g = 9810 # Specific weight of water in N/m3
h = 2 # Height of dam in m
s = 0.8 # Dismath.tance between square cross section in m
sa = 8e06 # Maximum allowable stress in Pa
#Calculations
b = ((g*(h**3)*s)/sa)**(1.0/3.0) # Dimension of croossection in m
#Result
print "the minimum required dimension b of the posts", round(b,3), "m"
```

In [10]:

```
import math
#initialisation
L = 3 # Span of beam in ft
q = 160 # Uniform load intensity in lb/in
b = 1 # Width of cross section
h = 4 # Height of cross section
# Calculations from chapter 4
Mc = 17920 # Bending moment in ld-in
Vc = -1600 # Loading in lb
I = (b*(h**3))/12.0 # Moment of inertia in in4
sc = -(Mc*1)/I # Compressive stress at point C in psi
Ac = 1*1 # Area of section C in inch2
yc = 1.5 # dismath.tance between midlayers od section C and cross section of beam
Qc = Ac*yc # First moment of C cross section in inch3
tc = (Vc*Qc)/(I*b) # Shear stress in Psi
print "Normal stress at C", sc, "psi"
print "Shear stress at C", tc, "psi"
```

In [11]:

```
import math
#initialisation
s = 11e06 # allowable tensile stress in pa
t = 1.2e06 # allowable shear stress in pa
b = 0.1 # Width of cross section in m
h = 0.15 # Height of cross section in m
a = 0.5 # in m
#Calculations
P_bending = (s*b*h**2)/(6.0*a) # Bending stress in N
P_shear = (2*t*b*h)/3.0 # shear stress in N
Pmax = P_bending # Because bending stress governs the design
#Result
print "the maximum permissible value Pmax of the loads", Pmax, "N"
```

In [20]:

```
import math
#initialisation
d2 = 4 # Outer diameter in inch
d1 = 3.2 # Inner diameter in inch
r2 = d2/2 # Outer radius in inch
r1 = d1/2 # inner radius in inch
P = 1500 # Horizontal force in lb
#calculation
# Part (a)
t_max = ((r2**2+(r2*r1)+r1**2)*4*P)/(3*math.pi*((r2**4)-(r1**4))) # Mximum shear stress in Psi
print "Maximum shear stress in the pole is", round(t_max), "psi"
# Part (b)
d0 = math.sqrt((16*P)/(3*math.pi*t_max)) # Diameter of solid circular cross section in meter
print "Diameter of solid circular cross section is ", round(d0,2), "m"
```

In [3]:

```
import math
#initialisation
b = 0.165 # in m
h = 0.320 # in m
h1 = 0.290 # in m
t = 0.0075 # in m
V = 45000.0 # Vertical force in N
#calculation
I = (1.0/12.0)*((b*(h**3))-(b*(h1**3))+(t*(h1**3))) # Moment of inertia of the cros section
t_max = (V/(8.0*I*t))*((b*(h**2))-(b*(h1**2))+(t*(h1**2))) # Maximum shear stress in Pa
t_min = ((V*b)/(8*I*t))*(h**2-h1**2) # Minimum shear stress in Pa
T = ((t*h1)/3.0)*(2*t_max + t_min) # Total shear force in Pa
t_avg = V/(t*h1) # Average shear stress in Pa
#Result
print "Maximum shear stress in the web is", round(t_max,2), "Pa"
print "Minimum shear stress in the web is", round(t_min,2), "Pa"
print "Total shear stress in the web is", round(T,2), "N"
```

In [24]:

```
import math
#initialisation
V = 10000 # Vertical shear force in lb
b = 4 # in inch
t = 1 # in inch
h = 8 # in inch
h1 = 7 # in inch
#calculation
A = b*(h-h1) + t*h1 # Area of cross section
Qaa = ((h+h1)/2.0)*b*(h-h1) + (h1/2.0)*(t*h1) # First moment of cross section
c2 = Qaa/A # Position of neutral axis in inch
c1 = h-c2 # Position of neutral axis in inch
Iaa = (b*h**3)/3.0 - ((b-t)*h1**3)/3.0 # Moment of inertia about the line aa
I = Iaa - A*c2**2 # Moment of inertia of crosssection
Q1 = b*(h-h1)*(c1-((h-h1)/2.0)) # First moment of area above the line nn
t1 = (V*Q1)/(I*t) # Shear stress at the top of web in Psi
Qmax = (t*c2)*(c2/2.0) # Maximum first moment of inertia below neutral axis
t_max = (V*Qmax)/(I*t) # Maximum Shear stress in Psi
#Result
print "Shear stress at the top of the web is", round(t1), "psi"
print "Maximum Shear stress in the web is", round(t_max), "Psi"
```

In [25]:

```
import math
#initialisation
Af = 40*180 # Area of flange in mm2
V = 10500 # Shear force acting on cross section
F = 800 # Allowable load in shear
df = 120 # Dismath.tance between centroid of flange and neutral axis in mm
#calculation
Q = Af*df # First moment of cross section of flange
I = (1.0/12.0)*(210*280**3) - (1.0/12.0)*(180*200**3) # Moment of inertia of entire cross section in mm4
f = (V*Q)/I # Shear flow
s = (2*F)/f # Spacing between the screw
#Result
print "The maximum permissible longitudinal spacing s of the screws is", round(s,1), "mm"
```

In [26]:

```
import math
#initialisation
L = 60 # Length of beam in inch
d = 5.5 # dismath.tance from the point of application of the load P to the longitudinal axis of the tube in inch
b = 6 # Outer dimension of tube in inch
A = 20 # Area of cross section of tube in inch
I = 86.67 # Moment of inertia in in4
P = 1000 # in lb
theta = 60 # in degree
Ph = P*math.sin(math.radians(60)) # Horizontal component
Pv = P*math.cos(math.radians(60)) # Vertical component
#Calculations
M0 = Ph*d # Moment in lb-in
y = -3 # Point at which maximum tensile stress occur in inch
N = Ph # Axial force
M = 9870 # Moment in lb-in
st_max = (N/A)-((M*y)/I) # Maximum tensile stress in Psi
yc = 3 # in inch
M1 = 5110 # moment in lb-in
sc_left = (N/A)-((M*yc)/I) # Stress at the left of point C in Psi
sc_right = -(M1*yc)/I # Stress at the right of point C in Psi
sc_max = min(sc_left,sc_right) # Because both are negative quantities
#Result
print "The maximum compressive stress in the beam is", round(sc_max), "psi"
print "The maximum tensile stress in the beam is", round(st_max), "psi"
```