import math
#Initilization of variables
D=15 #cm #External Diameter
t=2 #cm #Thickness
L=6 #m #Length of cyclinder
E=80*10**9 #Pa
alpha=1*1600**-1
sigma_c=550*10**6 #Pa #compressive stress
#Calculations
d=D-2*t #m #Internal Diameter
A=pi*4**-1*(D**2-d**2)*10**-4 #m**2 #Areaof Tube
I=pi*64**-1*(D**4-d**4)*10**-4 #m**4 #M.I of tube
k=(I*A**-1)**0.5 #m #Radius of Gyration
P_e=pi**2*E*I*(L**2)**-1 #Euler's Load
P_R=sigma_c*A*(1+alpha*(L*k**-1)**2)**-1 #According to Rankine's Formula
#The Answer in Textbook is incorrect for P_R
#Now again from Rankine's Formula
#As K=I*A**-1,so substituting in below equation
#Thus Stress calculated from Euler's Formula cannot exceed the yield stress of 550 MPa
L=(pi**2*E*k**2*(550*10**6)**-1)**0.5*10**-2 #m #Length of cyclinder
#Result
print"The Length of strut is",round(L,2),"cm"
import math
#Initilization of variables
L=1.5 #m #Length of steelbar
b=2 #cm #bredth of steelbar
d=0.5 #cm #depth of steelbar
sigma=320 #MPa #Yield point
E=210 #GPa #modulus of Elasticity of steelbar
#Calculations
I_min=b*d**3*12**-1*10**-8 #m**4 #Moment of Inertia
P=pi**2*E*10**9*I_min*(L**2)**-1 #N #N #Crippling Load
#Let dell=Central Deflection
#M=P*dell #Max Bending moment
#After substituting value in above equation we get
#M=191.9*dell
A=b*d*10**-4 #m**2 #Area of steel bar
sigma_1=P*A**-1*10**-6 #Mpa #Direct stress
Z=b*d**3*10**-6 #Section modulus
#sigma_2=M*Z**-1 #N/m**2 #Bending stress
#After substituting value in above equation we get
#sigma_2=dell*2302.8*10**6 #N/m**2
#sigma=sigma_1+sigma_2
#Now substituting value of Bending stress and direct stress in above equation we get
#320*10**6=1.919*10**6+2302.8*10**6*dell
dell=((320*10**6-1.919*10**6)*(2302.8*10**6)**-1)*10**2 #cm #Central Deflection
#Result
print"Maximum Central Deflection is",round(dell,2),"cm"
import math
#Initilization of variables
dell=1 #cm #Deflection
FOS=4 #Factor of safety
E=210 #GPa #Modulus of Elasticity of steel bar
W=40 #KN #Load
#Flange Dimensions
b=30 #cm #width of flange
d=5 #cm #depth of flange
#Web Dimensions
d_1=100 #cm #Depth of web
t_1=2 #cm #Thcikness of web
#Calculations
I_xx=(0.3*1.1**3-0.28*1**3)*12**-1 #m**4 #M.I about x-x axis
I_yy=2*0.05*0.3**3*12**-1+1*0.02**3*12**-1 #m**4 #M.I about y-y axis
#From the equation of deflection we get
L=(dell*10**-2*384*E*10**9*I_xx*(5*40*10**3)**-1)**0.25 #m #Length of beam
P=pi**2*210*I_yy*10**9*4*(L**2)**-1 #N #crippling Load
S=P*4**-1 #N #Safe Load
#Result
print"The Safe Load is",round(S,2),"N"
import math
#Initilization of variables
L=4 #m #Length of column
W=250 #KN #Safe Load
FOS=5 #Factor of safety
#d=0.8*D #Internal diameter is 0.8 times Extarnal Diameter
sigma_c=550 #MPa #Compressive stress
alpha=1*1600**-1 #constant
#Calculations
P=W*FOS #N #Crippling Load
#A=pi*4**-1(D**2-d**2) #m**2 #Area of hollow cyclinder
#After substituting value of d we get
#A=pi*0.09*D**2
#I=pi*64**-1*(D**4-d**4) #m**4 #Mo,ent Of Inertia
#After substituting value of d we get d we get
#I=0.009225*pi*D**4
#K=(I*A**-1)**0.5 #Radius of Gyration
#After substituting value of I and A and further simplifying we get
#K=0.32*D
#Now using the Relation we get
#P=sigma_c*A*(1+alpha*(l_e*k)**2)**-1 #Rankines Formula
#Now Substituting values in above equation we get
#125*10**4=550*10**6*pi*0.09*D**2*(1+1*1600**-1*((2*0.32)**2)**-1)**-1
#Further simplifying and rearranging we get
#D**4-0.008038*D**2-0.0001962397=0
a=1
b=-0.008038
c=-0.0001962397
X=b**2-4*a*c
D_1=((-b+X**0.5)*(2*a)**-1)**0.5*10**2
D_2=((-b-X**0.5)*(2*a)**-1)**0.5
#Thus Diameter cannot be negative, discard value of D_2
d=0.8*D_1
#Result
print"The Minimum Diameter is",round(d,2),"cm"
import math
#Initilization of variables
d=0.04 #m #Internal Diameter of tube
D=0.05 #m #External Diameter of tube
P_1=240*10**3 #N #Compressive Load
P_2=158*10**3#N #Failure Load
L=2 #m #Length of tube
l=3 #m #Length of strut
#Calculations
A=pi*4**-1*(D**2-d**2) #m**2 #Areaof Tube
I=pi*64**-1*(D**4-d**4) #m**4 #M.I of tube
k=(I*A**-1)**0.5 #m #Radius of Gyration
sigma_c=P*A**-1 #Pa #Compressive stress
l_e=L*2**-1 #m #According to given condition i.e Both ends fixed
#Now from crippling Load Equation we get
alpha=((sigma_c*A*P_2**-1-1)*((l_e*k**-1)**2)**-1)*10**4
#Now Crippling Load when L=3 m Is used as strut
l_e_2=l*(2**0.5)**-1
P_3=sigma_c*A*(1+alpha*10**-4*(l_e_2*k**-1)**2)**-1
print"The Value of constant value alpha is",round(alpha,2)
print"The Crippling Load of Tube is",round(P_3,2),"N"
import math
#Initilization of variables
D=0.038 #m #External diameter
d=0.035 #m #Internal diameter
P=20*10**3 #N #Load
E=210*10**9 #Pa
e=0.002 #m #Eccentricity
L=1.5 #m #Lenght of tube
#Calculations
A=pi*4**-1*(D**2-d**2) #m**2 column
I=pi*64**-1*(D**4-d**4) #m**4 #M.I of column
m=(P*(E*I)**-1)**0.5
#Let X=secmL*2**-1
X=(1*(cos(m*L*2**-1))**-1)
M=P*e*X #N-m #MAx Bending Moment
sigma_1=P*A**-1*10**-6 #Pa #Direct stress
sigma_2=M*0.019*I**-1*10**-6 #Pa #Bending stress
sigma_c_max=(sigma_1+sigma_2) #MPa #Max compressive stress
#Result
print"The Max stress developed is",round(sigma_c_max,2),"MPa"
import math
#Initilization of variables
L=5 #m #Length of column
D=0.2 #m #External Diameter
d=0.14 #m #Internal diameter
P=200*10**3 #N #Load
e=0.015 #m #Eccentricity
E=95 *10**9 #Pa
#Calculations
L_2=L*2**-1 #m #half length of column
A=pi*4**-1*(D**2-d**2) #m**2 column
I=pi*64**-1*(D**4-d**4) #m**4 #M.I of column
m=(P*(E*I)**-1)**0.5
#Let X=secmL*2**-1
X=(1*(cos(m*L_2*2**-1))**-1)
M=P*e*X #N-m #MAx Bending Moment
sigma_1=P*A**-1*10**-6 #Pa #Direct stress
sigma_2=M*0.1*I**-1*10**-6 #Pa #Bending stress
sigma_c_max=(sigma_1+sigma_2) #MPa #Max compressive stress
print"The Max stress developed is",round(sigma_c_max,2),"MPa"
import math
#Initilization of variables
L=3 #m #Length of strut
b=0.04 #m #Width of rectangle
d=0.10 #m #Depth if rectangle
P=100*10**3 #N #Axial thrust
w=10*10**3 #N #Uniformly Distributed Load
E=210*10**9 #Pa
#Calculations
A=b*d #m**2 #Area of strut
I=b*d**3*12**-1 #m**4 #M.I
m=(P*(E*I)**-1)**0.5
#Let X=secmL*2**-1
X=(1*(cos(m*L*2**-1))**-1)
M=w*E*I*P**-1*(X-1)*3**-1 #N*m #Max Bending Moment
sigma_1=P*A**-1 #Pa #Direct stress
sigma_2=M*0.05*I**-1 #Pa #Bending stress
sigma_c_max=sigma_1+sigma_2 #Max compressive stress
#If the Eccentricity of thrust is neglected
M_2=w*L**2*(3*8)**-1 #Max Bending moment
sigma_2_2=M_2*0.05*I**-1 #Pa #Bending stress
sigma_c_max_2=(sigma_1+sigma_2_2)*10**-6 #Pa
#Let Y=Percentage error
Y=((sigma_c_max-sigma_c_max_2*10**6)*sigma_c_max**-1)*100
#Result
print"Max stress induced is",round(sigma_c_max_2,2),"MPa"
print"The Percentage Error is",round(Y,3),"%"