import math
#Variable Decleration
n=20 #Modular Ratio
sigma_wd=8*10**6 #Maximum bending stress in wood in Pa
sigma_st=120*10**6 #Maximum bending stress in steel in Pa
#Cross Sectional Details
Awd=45 #Area of wood in mm^2
y_wd=160 #Neutral Axis of from bottom of the wooden section in mm
Ast=15 #Area of steel in mm^2
y_st=5 #Neutral Axis of the Steel section in mm
#Dimensions
ww=150 #width of wooden section in mm
dw=300 #depth of wooden section in mm
ws=75 #width of steel section in mm
ds=10 #depth of steel section in mm
#Calculations
y_bar=(Awd*y_wd+Ast*y_st)*(Ast+Awd)**-1 #Location of Neutral axis from the bottom in mm
#Moment of inertia
I=(ww*dw**3*12**-1)+(ww*dw*(y_wd-y_bar)**2)+(n*ws*ds**3*12**-1)+(n*ws*ds*(y_bar-y_st)**2) #mm^4
c_top=dw+ds-y_bar #Distance from NA to top fibre in mm
c_bot=y_bar #Distance from NA to bottom fibre in mm
#The solution will be in different order
M1=sigma_wd*I*10**-12*c_top**-1 #Maximum Bending Moment in N.m
M2=sigma_st*I*10**-12*c_bot**-1 #Maximum Bending Moment in N.m
M=min(M1,M2) #Maximum allowable moment in N.m
#Result
print "The Maximum Allowable moment that the beam can support is",round(M,1),"kN.m"
import math
#Variable Decleration
dw=8 #Depth of wooden section in inches
da=0.4 #Depth og aluminium section in inches
w=2 #Width of the section in inches
n=40*3**-1 #Modular Ratio
Ewd=1.5*10**6 #Youngs modulus of wood in psi
Eal=10**7 #Youngs Modulus of aluminium in psi
V_max=4000 #Maximum shear in lb
b=24 #Inches
L=72 #Length in inches
P=6000 #Load on the beam in lb
#Calculations
I=w*dw**3*12**-1+2*(n*w*da**3*12**-1+n*da*4.2**2) #Moment of Inertia in in^4
#Part 1
Q=(w*dw*0.5)*2+(n*da)*(dw*0.5+da*0.5) #First Moment in in^3
tau_max=V_max*Q*I**-1*w**-1 #Maximum Shear Stress in psi
#Part 2
delta_mid=(P*b)*(48*Ewd*I)**-1*(3*L**2-4*b**2)
#Result
print "The maximum shear stress allowable is",round(tau_max),"psi"
print "The deflection at the mid-span is",round(delta_mid,4),"in"
import math
import numpy as np
#Variable Decleration
b=300 #Breadth in mm
d=500 #Depth in mm
Ast=1500 #Area of steel in mm^2
n=8 #Modular Ratio
M=70*10**3 #Bending Moment in N.m
#Calculations
#Let the LHS be C
C=2*n*Ast*b**-1*d**-1 #The LHS computation
h=np.roots([d**-2,C*d**-1,-C])
#Taking only real root
h=h[1] #mm
sigma_co_max=(2*M)/(b*h*(d-h*3**-1)) #Maximum Compressive Stress in GPa
sigma_st_max=M/((d-h*3**-1)*Ast) #Maximum Stress in Steel in GPa
#Result
print "The maximum stress in compression is",round(sigma_co_max*10**3,2),"MPa"
print "The maximum stress in streel is",round(sigma_st_max*10**3,1),"MPa"
import math
#Variable Decleration
sigma_co_w=12 #Maximum stress in compression in MPa
sigma_st_w=140 #Maximum stress in steel in MPa
M=90 #Moment in kN.m
n=8 #Modular Ratio
#Calculations
#h=0.4068d
#bd^2=0.04266
b=(0.04266/(1.5**2))**0.3333 #Breadth in m
d=1.5*b #Depth in m
h=0.4068*d #Height in m
#Area of steel
Ast=((M*10**3)/((d-h*3**-1)*sigma_st_w*10**3))*10**3 #Area of steel in mm^2
#Result
print "The dimensions of the beam are"
print "b=",round(b*1000),"mm and d=",round(d*1000),"mm"
print "Area of steel=",round(Ast),"mm^2"
import math
import numpy as np
#Variable Decleration
A1=75*10**3 #Area 1 in mm^2
A3=19.20*10**3 #Area 3 in m^2
w=750 #Width in mm
w1=350 #Width in mm
d=444.45 #Depth in mm
sigma_co_w=12*10**6 #Maximum Permissible Bending stress in concrete in Pa
sigma_st_w=140*10**6 #Maximum Permissible Bending stress in steel in Pa
n=8 #Modular Ratio
#Calculations
#After simplfying the equation we get the following
H=np.roots([200,-200**2+A1+A3,-A1*50+100**2*200-600*A3])
h=max(H) #Depth of NA in mm
#Moment Of Inertia
I=w*h**3*3**-1-(w1*(h-100)**3*3**-1)+A3*d**2 #Moment of inertia in mm^4
M1=sigma_co_w*I*h**-1*(10**-3)**4*10**3 #Largest Bending Moment in concrete in N.m
M2=sigma_st_w*I*(n*d)**-1*(10**-3)**4*10**3 #Largest Bending Moment in Steel in N.m
M=min(M1,M2) #Largest Bending Moment that can be supported safely in N.m
#Result
print "The largest Bending Moment that can be supported is",round(M*10**-3,1),"kN.m"