## Examlple 8.8.1, Page No:275¶

In [5]:
import math

#Variable Decleration
p=125 #Pressure in psi
r=24 #Radius of the vessel in inches
t=0.25 #Thickness of the vessel in inches
E=29*10**6 #Modulus of Elasticity in psi
v=0.28 #poisson ratio

#Calcualtions
#Part 1
sigma_c=p*r*t**-1 #Circumferential Stress in psi
sigma_l=sigma_c/2 #Longitudinat Stress in psi
e_c=E**-1*(sigma_c-(v*sigma_l)) #Circumferential Strain using biaxial Hooke's Law
delta_r=e_c*r #Change in the radius in inches

#Part 2
sigma=(p*r)*(2*t)**-1 #Stress in psi
e=E**-1*(sigma-(v*sigma)) #Strain using biaxial Hooke's Law
delta_R=e*r #Change inradius of end-cap in inches

#Result
print "Stresses are sigma_c=",round(sigma_c),"psi and sigma_l=",round(sigma_l),"psi"
print "Change of radius of cylinder=",round(delta_r,5),"in"
print "Stresses are sigma=",round(sigma),"psi"
print "Change in radius of end cap=",round(delta_R,5),"in"
Stresses are sigma_c= 12000.0 psi and sigma_l= 6000.0 psi
Change of radius of cylinder= 0.00854 in
Stresses are sigma= 6000.0 psi
Change in radius of end cap= 0.00358 in

## Example 8.8.2, Page No:280¶

In [21]:
import math
import matplotlib.pyplot as plt
%matplotlib inline

#Variable Decleration
P=40 #Force in kN
b=0.050 #Width in m
h=0.040 #Depth in m

#Calculations
#Part 1
A=b*h #Area in m^2
I=(b*h**3)*12**-1 #Moment of inertia in m^4
c=h*0.5 #m
sigma_max=(P*A**-1)+(P*c**2*I**-1) #Maximum stress in MPa
sigma_min=(P*A**-1)-(P*c**2*I**-1) #Minimum stress in MPa

#Result
print "The Maximum and Minimum Stress are"
print "Max=",sigma_max/1000,"MPa and Min=",sigma_min/1000,"MPa"

#Plotting
x=[20,0,-20]
S=[-sigma_min/1000,0,sigma_max/1000]
plt.plot(S,x)
plt.ylabel("Distance from Neutral Axis in mm")
plt.xlabel("Stress in MPa")
plt.title("Stress Distribution Diagram")
plt.show()
The Maximum and Minimum Stress are
Max= 80.0 MPa and Min= -40.0 MPa

## Example 8.8.3, Page No:281¶

In [27]:
import math

#Variabel Decleration
b=6 #Width in inches
h=10 #Depth in inches
P1=6000 #Force in lb
P2=3000 #Force in lb
L=4 #Length in ft
M=6000 #Moment in lb.ft
y=5 #Depth in inches
M2=-12000 #Moment in lb.ft

#Calculations
A=b*h #Area in in^2
I=b*h**3*12**-1 #Moment of inertia in in^4
T=(P1*L+P2*L*3)*(6)**-1 #Tension in the cable in lb

#Computation of largest stress
sigma_B=(P*A**-1)-(M*y*12*I**-1) #Maximum Compressive Stress caused by +ve BM in psi
sigma_C=(P2*A**-1)-(M2*-y*12*I**-1) #Maximum Compressive Stress caused by -ve BM in psi

sigma_max=max(-sigma_B,-sigma_C) #Maximum Compressive Stress in psi

#Result
print "The maximum Stress is",round(sigma_max),"psi"
The maximum Stress is 1603.0 psi

## Example 8.8.4, Page No:297¶

In [22]:
import math

#Variable Decleration
theta=(60*pi)/180 #Angle in radians (Twice as declared)
sigma_x=30 # Stress in x in MPa
sigma_y=60 #Stress in y in MPa
tau_xy=40 #Stress in MPa

#Calcualtions
sigma_xdash=0.5*(sigma_x+sigma_y)+0.5*(sigma_x-sigma_y)*cos(theta)+tau_xy*sin(theta) #Stress at x' axis in MPa
sigma_ydash=0.5*(sigma_x+sigma_y)-0.5*(sigma_x-sigma_y)*cos(theta)-tau_xy*sin(theta) #Stress at y' axis in MPa
tau_x_y=-0.5*(sigma_x-sigma_y)*sin(theta)+tau_xy*cos(theta) #Stress at x'y' in shear in MPa
#Result
print "The new stresses at new axes are as follows"
print "sigma_x'=",round(sigma_xdash,1),"MPa sigma_y'=",round(sigma_ydash,1),"MPa"
print "And tau_x'y'=",round(tau_x_y),"MPa"
The new stresses at new axes are as follows
sigma_x'= 72.1 MPa sigma_y'= 17.9 MPa
And tau_x'y'= 33.0 MPa

## Example 8.8.5, Page No:297¶

In [2]:
import math

#Variable Decleration
sigma_x=8000 #Stress in x in psi
sigma_y=4000 #Stress in y in psi
tau_xy=3000 #Stress in xy in psi

#Calculations
R=sqrt(((sigma_x-sigma_y)*0.5)**2+tau_xy**2) #Resultant Stress in psi

#Principal Stresses
sigma1=(sigma_x+sigma_y)*0.5+R #Principal Stress in psi
sigma2=(sigma_x+sigma_y)*0.5-R #Principal Stress in psi

#Principal Direction
theta1=arctan(2*tau_xy*(sigma_x-sigma_y)**-1)*0.5*180*pi**-1 #Principal direction in degrees
theta2=theta1+90 #Second pricnipal direction in degrees

#Normal Stress
sigma_xdash=0.5*(sigma_x+sigma_y)+0.5*(sigma_x-sigma_y)*cos(2*theta1*pi*180**-1)+tau_xy*sin(2*theta1*pi*180**-1)

#Result
print "The principal stresses are as follows"
print "sigma1=",round(sigma1),"psi and sigma2=",round(sigma2),"psi"
print "The corresponding directions are"
print "Theta1=",round(theta1,1),"degrees and Theta2=",round(theta2,1),"degrees"

#NOTE:The answer in the textbook for principal stresses is off by 4 units in each case
The principal stresses are as follows
sigma1= 9606.0 psi and sigma2= 2394.0 psi
The corresponding directions are
Theta1= 28.2 degrees and Theta2= 118.2 degrees

## Example 8.8.6, Page No:298¶

In [24]:
import math

#Variable Decleration
sigma_x=40 #Stress in x in MPa
sigma_y=-100 #Stress in y in MPa
tau_xy=-50 #Shear stress in MPa

#Calculations
tau_max=sqrt(((sigma_x-sigma_y)*0.5)**2+tau_xy**2) #Maximum in-plane shear in MPa

#Orientation of Plane
theta1=arctan(-((sigma_x-sigma_y)*(2*tau_xy)**-1))*180*pi**-1*0.5 #Angle in Degrees
theta2=theta1+90 #Angle in degrees

#Plane of max in-plane shear
tau_x_y=-0.5*(sigma_x-sigma_y)*sin(2*theta1*pi*180**-1)+tau_xy*cos(2*theta1*pi*180**-1)

#Normal Stress
sigma=(sigma_x+sigma_y)*0.5 #Stress in MPa

#Result
print "The maximum in-plane Shear is",round(tau_x_y),"MPa"
The maximum in-plane Shear is -86.0 MPa

## Example 8.8.7, Page No:305¶

In [32]:
import math

#Vairable Decleration
sigma_x=40 #Stress in x in MPa
sigma_y=20 #Stress in y in MPa
tau_xy=16 #Shear in xy in MPa

#Calculations
sigma=(sigma_x+sigma_y)*0.5 #Normal Stress in MPa
R=sqrt(((sigma_x-sigma_y)*0.5)**2+tau_xy**2) #Resultant Stress in MPa

#Part 1
sigma1=sigma+R #Principal Stress in MPa
sigma2=sigma-R #Principal Stress in MPa
theta=arctan(tau_xy*((sigma_x-sigma_y)*0.5)**-1)*180*pi**-1*0.5 #Orientation in degrees

#Part 2
tau_max=18.87 #From figure in MPa

#Part 3
sigma_xdash=sigma+tau_max*cos((100-theta*2)*pi*180**-1) #Stress in MPa
sigma_ydash=sigma-tau_max*cos((100-theta*2)*pi*180**-1) #Stress in MPa
tau_x_y=tau_max*sin((100-2*theta)*pi*180**-1) #Shear stress in MPa

#Result
print "The principal Stresses are"
print "Sigma1=",round(sigma1,1),"MPa and Sigma2=",round(sigma2,1),"MPa"
print "The Principal Plane is at",round(theta),"degrees"
print "The  Maximum Shear Stress is",tau_max,"MPa"
print "Sigma_x'=",round(sigma_xdash),"MPa and Sigma_y'=",round(sigma_ydash,2),"MPa"
print "Tau_x'y'=",round(tau_x_y,2),"MPa"
The principal Stresses are
Sigma1= 48.9 MPa and Sigma2= 11.1 MPa
The Principal Plane is at 29.0 degrees
The  Maximum Shear Stress is 18.87 MPa
Sigma_x'= 44.0 MPa and Sigma_y'= 15.98 MPa
Tau_x'y'= 12.63 MPa

## Example 8.8.9, Page No:316¶

In [37]:
import math

#Variabel Decleration
sigma_w=120 #Working Stress in MPa
tau_w=70 #Working Shear in MPa

#Calcualtions
#Section a-a
M=3750 #Applied moment at section a-a in N.m
T=1500 #Applied Torque at section a-a in N.m

#After carrying out the variable based computation we compute d
d1=((124.62)/(sigma_w*10**3*pi))**0.3333 #Diameter of the shaft in m
d2=((65.6)/(tau_w*10**3*pi))**0.3333 #Diameter of the shaft in m
d=max(d1,d2) #Diameter of the shaft to be selected in m

#Result
print "The diameter of the shaft to be selected is",round(d*1000,1),"mm"
The diameter of the shaft to be selected is 69.2 mm

## Example 8.8.10, Page No:318¶

In [45]:
import math

#Variable Decleration
t=0.01 #Thickness of the shaft in m
p=2 #Internal Pressure in MPa
r=0.45 #Mean radius of the vessel in m
tw=50 #Working shear stress in MPa

#Calculation
sigma_x=(p*r)/(2*t) #Stress in MPa
sigma_y=(p*r)/t #Stress in MPa

R=100-67.5 #From the diagram in MPa
tau_xy=sqrt((R**2-(sigma_y-67.5)**2)) #Stress in MPa

J=2*pi*r**3*t #Polar Moment of inertia in mm^4

T=1000*(tau_xy*J)/r #Maximum allowable Torque in kN.m

#Result
print "The largest allowable Torque is",round(T),"kN.m"
The largest allowable Torque is 298.0 kN.m

## Example 8.8.11, Page No:320¶

In [60]:
import math

#Variable Decleration
L=15 #Length of the shaft in inches
r=3.0/8.001 #Radius of the shaft in inches
T=540 #Torque applied in lb.in

#Calculations
V=30 #Transverse Shear Force in lb
M=15*V #Bending Moment in lb.in
I=(pi*r**4)/4.0 #Moment of Inertia in in^4
J=2*I #Polar Moment Of Inertia in in^4

#Part 1
sigma=(M*r)/I #Bending Stress in psi
tau_t=10**-3*(T*r)/J #Shear Stress in ksi

sigma_max1=13.92 #From the Mohr Circle in ksi

#Part 2
Q=(2*r**3)/3.0 #First Moment in in^3
b=2*r # in

tau_V=10**-3*(V*Q)/(I*b) #Shear Stress in ksi
tau=tau_t+tau_V #Total Shear in ksi

sigma_max2=tau #Maximum stress in ksi

#Result
print "The maximum normal stress in case 1 is",sigma_max1,"ksi"
print "The Maximum normal stress in case 2 is",round(sigma_max2,2),"ksi"
The maximum normal stress in case 1 is 13.92 ksi
The Maximum normal stress in case 2 is 6.61 ksi

## Example 8.8.12, Page No:330¶

In [16]:
import math

#Variable Decleration
ex=800*10**-6 #Strain in x
ey=200*10**-6 #Strain in y
y_xy=-600*10**-6 #Strain in xy

#Calculations
e_bar=(ex+ey)*0.5 #Strain
R=sqrt(2*300**2)*10**-6 #Resultant

#Part 1
e1=e_bar+R #Strain in Principal Axis
e2=e_bar-R #Strain in Principal Axis

#Part 2
alpha=15*180**-1*pi #From the Mohr Circle in degrees
e_xbar=e_bar-(R*cos(alpha)) #Strain in x
e_ybar=e_bar+(R*cos(alpha)) #Strain in y

shear_strain=2*R*sin(alpha) #Shear starin

#Result
print "The principal Strains are"
print "e1=",round(e1,6),"e2=",round(e2,6)
print "The starin components are"
print "ex'=",round(e_xbar,6),"ey'=",round(e_ybar,6),"y_x'y'=",round(shear_strain,6)
The principal Strains are
e1= 0.000924 e2= 7.6e-05
The starin components are
ex'= 9e-05 ey'= 0.00091 y_x'y'= 0.00022

## Example 8.8.13, Page No:331¶

In [20]:
import math

#Variable Decleration
e_x=800*10**-6 #Strain in x
e_y=200*10**-6 #Strain in y
y_xy=-600*10**-6 #Strain in xy
v=0.30 #Poissons Ratio
E=200 #Youngs Modulus in GPa
R_e=424.3*10**-6 #Strain
e_bar=500*10**-6 #Strain

#Calculations
#Part 1
R_sigma=10**-6*R_e*(E*10**9/(1+v)) #Stress in MPa
sigma_bar=10**-6*e_bar*(E*10**9/(1-v)) #Stress in MPa

#Part 2
sigma1=sigma_bar+R_sigma #Principal Stress in MPa
sigma2=sigma_bar-R_sigma #Principal Stress in MPa

#Result
print "The principal Stresses are as follows"
print "Sigma1=",round(sigma1),"MPa and Sigma2=",round(sigma2,1),"MPa"
The principal Stresses are as follows
Sigma1= 208.0 MPa and Sigma2= 77.6 MPa

## Example 8.8.14, Page No:336¶

In [32]:
import math

#Variable Decleration
e_a=100*10**-6 #Strain
e_b=300*10**-6 #Strain
e_c=-200*10**-6 #Strain
E=180 #Youngs Modulus in GPa
v=0.28 #Poissons Ratio

#Calculations
y_xy=(e_b-(e_a+e_c)*0.5) #Strain in xy
e_bar=(e_a+e_c)*0.5 #Strain
R_e=sqrt(y_xy**2+(150*10**-6)**2) #Resultant Strain

#Corresponding Parameters from Mohrs Diagram
sigma_bar=(E/(1-v))*e_bar*10**3 #Stress in MPa
R_sigma=(E/(1+v))*R_e*10**3 #Resultant Stress in MPa

#Principal Stresses
sigma1=sigma_bar+R_sigma #MPa
sigma2=sigma_bar-R_sigma #MPa

theta=arctan(y_xy/(150*10**-6))*180*pi**-1*0.5 #Degrees

#Result
print "The Principal Stresses are as follows"
print "Sigma1=",round(sigma1,1),"MPa and Sigma2=",round(sigma2,2),"MPa"
print "The plane orientation is",round(theta,2),"degrees"
The Principal Stresses are as follows
Sigma1= 41.0 MPa and Sigma2= -66.05 MPa
The plane orientation is 33.4 degrees