import math
#Variable Decleration
Le=7 #Effective length in m
P=450 #Applied axial Load in kN
FOS=3 #Factor of safety
sigma_pl=200*10**6 #Stress allowable in Pa
E=200*10**9 #Youngs Modulus in Pa
end_cond=0.7 #End Condition factor to be multiplied
#Calculations
Pcr=P*FOS #Critical Load in kN
A=Pcr*sigma_pl**-1*10**9 #Area in mm^2
#Part 1
I1=10**15*(Pcr*Le**2)*(pi**2*E)**-1 #Moment of Inertia Required in mm^4
#From table selecting appropriate Section W250x73
#Part 2
I2=10**15*(Pcr*end_cond**2*Le**2)*(pi**2*E)**-1 #Moment of Inertia Required in mm^4
#From table selecting appropriate Section W200x52
#Lightest Section that meets these criterion is W250x58 section
#Result
print "From the above computation we select W250x58 section"
import math
#Variabel Decleration
E=200*10**9 #Youngs Modulus in Pa
sigma_yp=380*10**6 #Stress allowable in Pa
Le=10 #Length in m
end_cond=0.5 #Support condition factor to be ,ultiplied to length
A=15.5*10**-3 #Area in m^2
#Calculations
Cc=sqrt((2*pi**2*E)*sigma_yp**-1) #Slenderness Ratio
#Part 1
S_R1=142.9 #Slenderness ratio
sigma_w=(12*pi**2*E)/(23*S_R1**2) #Allowable Working Stress in Pa
P=sigma_w*A #Maximum Allowable Load in kN
#Part 2
S_R2=79.37 #Slenderness ratio
N=5*3**-1+((3*S_R2)/(8*Cc))-(S_R2**3*(8*Cc**3)**-1) #Factor Of Safety
sigma_w2=(1-(S_R2**2*0.5*Cc**-2))*(sigma_yp*N**-1) #Allowable working Stress in Pa
P2=sigma_w2*A #Allowable Load in kN
#Part 3
S_R3=55.56 #Slenderness Ratio
N3=5*3**-1+((3*S_R3)/(8*Cc))-(S_R3**3*(8*Cc**3)**-1) #Factor Of Safety
sigma_w3=(1-(S_R3**2*0.5*Cc**-2))*(sigma_yp*N3**-1) #Allowable working Stress in Pa
P3=sigma_w3*A #Allowable Load in kN
#Result
print "The results for Part 1 are"
print "Maximum Allowable Load P=",round(P*10**-3),"kN"
print "Part 2"
print "Maximum Allowable Load P=",round(P2*10**-3),"kN"
print "Part 3"
print "Maximum Allowable Load P=",round(P3*10**-3),"kN"
import math
import numpy as np
#Variabel Decleration
E=29*10**6 #Youngs Modulus in psi
sigma_yp=36*10**3 #Stress in psi
L=25 #Length in ft
A=17.9 #Area in in^2
Iz=640 #Moment of inertia in in^4
Sz=92.2 #Sectional Modulus in in^3
P=150*10**3 #Load in lb
e=4 #Eccentricity in inches
#Calculations
#Part 1
a=1.09836
sigma_max=P*A**-1+(P*e*Sz**-1)*a #Maximum Stress in psi
#Part 2
#After simplification we get the equation to compute N
N=2.19 #Trial and Error yields
#Part 3
v_max=e*((np.cos(sqrt((P*L**2*12**2)*(4*E*Iz)**-1)))**-1-1)
#Result
print "The maximum compressive stress in the Column is",round(sigma_max,2),"psi"
print "The factor of safety is",N
print "The maximum lateral dfelection is",round(v_max,3),"in"
import math
#Variable Decleration
Le=7 #Effective Length in m
N=2 #Factor of Safety
h_max=400 #Maximum depth in mm
E=200 #Youngs Modulus in GPa
sigma_yp=250 #Maximum stress in yielding in MPa
P1=400 #Load 1 in kN
P2=900 #Load 2 in kN
x1=75 #Distance in mm
x2=125 #Distance in mm
#Calculations
e=(P2*x2-P1*x1)*(P1+P2)**-1 #Eccentricity in mm
P=N*(P1+P2) #Applied load after factor of safety is considered in kN
#Part 1 is not computable
I=415*10**-6 #Moment of inertia from the table in mm^4
#Part 2
P_cr=pi**2*E*10**9*I*Le**-2 #Critical load for buckling in kN
FOS=P_cr*10**-3/(P1+P2) #Factor of safety against buckling in y-axis
#Result
print "The critical load for buckling is",round(P_cr*10**-3),"kN"
print "The factor of safety is",round(FOS,1)