In [3]:

```
import math
M = 60.0 # Moment in k-in
E1 = 1500. # in Ksi
E2 = 30000.0 # in Ksi
h1 = 5.031 # Distance between top surface and neutral axis of the beam in inch by solving 1500*(h1-3)*24 + 30000*(h1-6.25)*2 = 0
#calculation
h2 = 6.5 - h1
I1 = (1.0/12.0)*(4*6**3) + (4*6)*(h1-3)**2 # Momeny of inertia of the wooden cross section
I2 = (1.0/12.0)*(4*0.5**3) + (4*0.5)*(h2-0.25)**2 # Momeny of inertia of the steel cross section
I = I1 + I2 # Moment of inertia of whole cross section
# Material 1
s1a = -(M*h1*E1)/((E1*I1)+(E2*I2)) # Maximum compressive stress in ksi where y = h1
s1c = -(M*(-(h2-0.5))*E1)/((E1*I1)+(E2*I2)) # Maximum tensile stress in ksi where y = -(h2-0.5)
print "Maximum compressive stress in wood is", round(s1a,3)*1000, "psi"
print "Maximum tensile stress in wood is", round(s1c,3)*1000, "psi"
# Material 2
s2a = -(M*(-h2)*E2)/((E1*I1)+(E2*I2)) # Maximum tensile stress in ksi where y = -h2
s2c = -(M*(-(h2-0.5))*E2)/((E1*I1)+(E2*I2)) # Minimum tensile stress in ksi where y = -(h2-0.5)
print "Maximum tensile stress in steel is", round(s2a,3)*1000, "psi"
print "Minimum tensile stress in steel is", round(s2c,3)*1000, "psi"
```

In [5]:

```
import math
#initialisation
M = 3000 # moment in N-m
t = 0.005 # thickness of alluminiun in m
E1 = 72e09 # Modulus of elasticity of alluminium in Pa
E2 = 800e06 # Modulus of elasticity of Plastic core in Pa
b = 0.2 # Width of cross section in m
h = 0.160 # Height of cross section in m
hc = 0.150 # Height of Plastic core cross section in m
#calculation
I1 = (b/12.0)*(h**3 - hc**3) # Moment of inertia of alluminium cross section
I2 = (b/12.0)*(hc**3) # Moment of inertia of Plastic core cross section
f = (E1*I1) + (E2*I2) # Flexural rigidity of the cross section
s1_max = (M*(h/2.0)*E1)/f
s1c = -s1_max # Maximum compressive stress in alluminium core in Pa
s1t = s1_max # Maximum tensile stress in alluminium core in Pa
print "Maximum compressive stress on alluminium face by the general theory for composite beams is", s1c, "Pa"
print "Maximum tensile stress on alluminium face by the general theory for composite beams is", s1t, "Pa"
s2_max = (M*(hc/2.0)*E2)/f
s2c = -s2_max # Maximum compressive stress in Plastic core in Pa
s2t = s2_max # Maximum tensile stress in Plastic core in Pa
print "Maximum compressive stress in plastic core by the general theory for composite beams is", s2c, "Pa"
print "Maximum tensile stress in plastic core by the general theory for composite beams is", s2t, "Pa"
# Part (b) : Calculation from approximate theory of sandwitch
s1_max1 = (M*h)/(2*I1)
s1c1 = -s1_max1 # Maximum compressive stress in alluminium core in Pa
s1t1 = s1_max1 # Maximum tensile stress in alluminium core in Pa
print "Maximum compressive stress on alluminium core by approximate theory of sandwitch is", s1c1, "Pa"
print "Maximum tensile stress on alluminium core by approximate theory of sandwitch is", s1t1, "Pa"
```

In [3]:

```
import math
M = 60.0 # Moment in k-in
E1 = 1500.0 # in Ksi
E2 = 30000.0 # in Ksi
b = 4.0 # width of crosssection in inch
#calculation
# Transformed Section
n = E2/E1 # Modular ratio
b1 = n*4 # Increased width of transformed cross section
# Neutral axis
h1 = ((3*4*6)+(80*0.5*6.25))/((4*6)+(80*0.5)) # Dismath.tance between top surface and neutral axis of the beam in inch
h2 = 6.5 - h1 # in inch
# Moment of inertia
It = (1.0/12.0)*(4*6**3) + (4*6)*(h1-3)**2 + (1.0/12.0)*(80*0.5**3) + (80*0.5)*(h2-0.25)**2 # Moment of inertia of transformed cross section
# Material 1
s1a = -(M*h1)/It # Maximum tensile stress in ksi where y = h1
s1c = -(M*(-(h2-0.5)))/It # Maximum compressive stress in ksi where y = -(h2-0.5)
print "Maximum tensile stress in wood is", s1a*1000, "psi"
print "Maximum compressive stress in wood is", s1c*1000, "psi"
# Material 2
s2a = -(M*(-h2)*n)/It # Maximum tensile stress in ksi where y = -h2
s2c = -(M*(-(h2-0.5)*n))/It # Minimum tensile stress in ksi where y = -(h2-0.5)
print "Maximum tensile stress in steel", s2a*1000, "psi"
print "Minimum tensile stress in steel", s2c*1000, "psi"
```

In [3]:

```
import math
import numpy
#initialisation
q = 3000.0 # Uniform load intensity in N/m
a = 26.57 # tilt of the beam in degree
b = 0.1 # width of the beam
h = 0.15 # height of the beam
L = 1.6 # Span of the beam
#calculation
qy = q*math.cos(math.radians(a)) # Component of q in y direction
qz = q*math.sin(math.radians(a)) # Component of q in z direction
My = (qz*L**2.0)/8.0 # Maximum bending moment in y direction
Mz = (qy*L**2.0)/8.0 # Maximum bending moment in z direction
Iy = (h*b**3.0)/12.0 # Moment of inertia along y
Iz = (b*h**3.0)/12.0 # Moment of inertia alon z
s = ((3*q*L**2)/(4*b*h))*((math.sin(math.radians(a))/b)+(math.cos(math.radians(a))/h))
sc = -s # Maximum compressive stress
st = s # Maximum tensile stress
print "Maximum compressive stress in the beam is", sc, "Pa"
print "Maximum tensile stress in the beam is", st, "Pa"
# Neutral axis
l = (h/b)**2
t = math.sin(math.radians(a)/math.cos(math.radians(a)))
j = l*(math.sin(math.radians(a)/math.cos(math.radians(a))))
be = math.degrees((numpy.arctan((j)))) # Inclination of Neutral axis to z axis
print "Inclination of Neutral axis to z axis is", round(be,2), "degree"
```

In [5]:

```
import math
import numpy
#initialisation
L = 12.0 # Length of the beam in ft
P = 10.0 # Load in k acting in vertical direction
#Part (a)
h = 24.0 # Height of beam in inch
Iz = 2100 # Moment of inertia along z axis in in4
Iy = 42.2 # Moment of inertia along y axis in in4
#calculation
s_max = (P*(h/2.0)*L*12)/Iz # Maximum stress in Ksi
print "Maximum tensile stress in the beam at the top of the beam", round(s_max*1000), "psi"
print "Maximum compressive stress in the beam at the bottom of the beam", round(-s_max*1000), "psi"
#Part (b)
a = 1 # Angle between y axis and the load
My = -(P*math.sin(math.radians(a)))*L*12 # Moment along y-axis in K-in
Mz = -(P*math.cos(math.radians(a)))*L*12 # Moment along z-axis in K-in
ba = math.radians(numpy.arctan(((My*Iz)/(Mz*Iy)))) # Orientation of neutral axis
z = -3.5
y = 12.0 # Coordinates of the point A and B where maximum stress occur
s = ((My*z)/Iy)-((Mz*y)/Iz) # Stress in Ksi
sa = s # Tensile stress at A
sb = -s # Compressive stress in B
print "The tensile stress at A is", round(sa*1000), "psi"
print "The compressive stress at B is", round(sb*1000), "psi"
```

In [16]:

```
import math
import numpy
#initialisation
M = 15 # Bending moment in k-in
t = 10 # Angle between line of action of moment and z-axis
# Properties of cross section
c = 0.634 # Location of centroid on the axis of symmetry
Iy = 2.28 # Moment of inertia in y-direction in in4
Iz = 67.4 # Moment of inertia in z-direction in in4
ya = 5
za = -2.6+0.634 # Coordinates of point A
yb = -5
zb = 0.634 # Coordinates of point B
My = M*math.sin(math.radians(t)) # Moment along y-axis
Mz = M*math.cos(math.radians(t)) # Moment along z-axis
sa = ((My*za)/Iy)-((Mz*ya)/Iz) # Bending stress at point A in ksi
sb = ((My*zb)/Iy)-((Mz*yb)/Iz) # Bending stress at point B in ksi
print "The bending stress at point A is", round(sa*1000), "psi"
print "The bending stress at point B is", round(sb*1000), "psi"
# Neutral axis
j = (Iz/Iy)*(math.sin(math.radians(t)/math.cos(math.radians(t))))
be = numpy.degrees(numpy.arctan((j))) # Inclination of neutral axis to z-axis in degree
print "Inclination of neutral axis to z-axis is", round(be,1), "degree"
```

In [7]:

```
import math
#initialization
b = 5 # in inch
b1 = 4 # in inch
h = 9 # in inch
h1 = 7.5 # in inch
sy = 33 # stress along y axis in ksi
#Calculations
M = (sy/12.0)*((3*b*h**2)-(b+(2*b1))*(h1**2)) # Bending moment acting in k-in
#Result
print "the magnitude of the moment M is", round(M), "k-in"
```