import math
# Variables
E = 10.*10**6 #psi
ys = 6000. #psi
# Calculations
lbyr = math.sqrt(math.pi**2*E/ys)
# Results
print 'Slenderness Ratio = %.f '%(lbyr)
import math
# Variables
fs = 3.
W = 50. #kips
l = 20. #ft
E = 30.*10**6 #psi
# Calculations
Pcr = fs*W
I = Pcr*10**3*(l*12)**2/(math.pi**2*E)
r = 2.01
lbyr = l*12/r
# Results
print 'Required I = %.1f in**4'%(I)
print 'slenderness ratio =%.f '%(lbyr)
import math
# Variables
L1 = 18. #ft
L2 = 9. #ft
I1 = 12.1 #in**4
I2 = 1.2 #in**4
E = 30.*10**6 #psi
# Calculations
r1 = 2.05
lbyr = L1*12/r1
r2 = 0.65
lbyr2 = L2*12/r2
Pcr1 = math.pi**2*E*I1/(L1*12)**2
Pcr2 = math.pi**2*E*I2/(L2*12)**2
P = Pcr1/2.5
P2 = Pcr2/2.5
# Results
print 'Design load of 1 = %.2f lb'%(round(P,-2))
print 'Design load of 2 =%.2f lb'%(round(P2,-2))
import math
# Variables
E = 30.*10**6
syp = 30000. #psi
I = 143.5 #in**4
A = 7.32 #in
# Calculations
I1 = 2*I
A1 = 2*A
L = math.sqrt(2*math.pi**2*E*I1/(syp*A1))
# Results
print 'Critical length of the column = %.0f in'%(L)
import math
# Variables
x = 30. #in
x1 = 10. #in
E = 30.*10**6
d = 0.5 #in
syp = 60000. #psi
y1 = 8. #in
y2 = 2. #in
# Calculations
ratio = 0.8
l = x+x1
lr = ratio*l
I = (math.pi*(d)**4)/64
Pcr = math.pi**2*E*I/lr**2
scr = Pcr/(math.pi*(d/2)**2)
F = Pcr*y2/(y1+y2)
# Results
print 'Stress in the critical load = %.0f psi'%(round(scr,-1))
print 'Critical force F =%.0f lb'%(F)
import math
# Variables
l = 10. #ft
Ys = 33000. #psi
E = 30.*10**6
A = 13.24 #in**4
# Calculations
r = 2.
lbyr = l*12/r
Cc = math.sqrt(2*math.pi**2*E/Ys)
fs = 5./3+3*(lbyr)/(8*Cc)+(lbyr)**3/(5*Cc**3)
Sa =((1-((lbyr)**2/(2*Cc**2)))*(Ys))/fs
Pa = Sa*A
# Results
print 'Premissible load = %.f kips'%(Pa/1000)
# note : rounding off error.
import math
from sympy import Symbol,solve
# Variables
L = 12. #ft
Po = 100. #kips
e = 2. #ft
ys = 42000. #psi
A = 11.77 #in**2
rmin = 195. #in
Zmin = 11.0 #in**3
lbyr = 74.2
stress = 18. #ksi
# Calculations
#P = (stress-(Po/A)/((1/A)+((e*12)/Zmin)))
P = Symbol("P")
eq = (((Po+P)/A) + (P*(e*L)/11))/stress - 1
P = solve(eq,P)[0]
# Results
print 'Additional Load = %.2f kips '%(P)
# Variables
l = 15. #ft
Al = 80. #kips
El = 60. #kips
Ys = 33. #ksi
e = 4. #in
# Calculations
A = 14.4
rmin = 2.54
Zxx = 54.6
lbyr = l*12/rmin
Smax = ((Al+El)/A)+El*e/Zxx
# Results
print 'Maximum stress %.1f ksi'%(Smax)
print ("10 WF 49 is the suitable one")