import math
from sympy import symbols,cos,sin
#Variable declaration
Sx=50 # Stress in x(MPa)
n=-1
Sy=n*10 # Stress in y(MPa)
txy=40 # Shearing stress(MPa)
#Calculation
# Case(a) Principal axes
phy1=(53.1)/2.0 # Angle(degree)
phy2=(233.1)/2.0 # Angle(degree)
# Case(b) Principal stresses
Smax=20+math.sqrt(30**2+40**2) # Maximum principal stress(MPa)
Smin=20-math.sqrt(30**2+40**2) # Maximum principal stress(MPa)
Sxl=(50-10)/(2.0) + ((50+10)/(2.0))*cos(53.1*((math.pi)*2)/(360.0)) +40*sin(53.1*((math.pi)*2)/(360.0))
# Case(c) Maximum shearing stress
tmax=math.sqrt(30**2+40**2) # Maximum shearing stress(MPa)
Sl=(50-10)/2.0 # Normal stress on each of four walls(MPa)
# Result
print ('Case(a) Principal planes = %lf degree' %phy1)
print ('Case(a) Principal planes = %lf degree' %phy2)
print ('Case(b) Maximum principal stress = %lf MPa' %Smax)
print ('Case(b) Minimum principal stress = %lf MPa' %Smin)
print ('Case(c) Maximum shearing stress = %lf MPa' %tmax)
import math
from sympy import symbols
#Variable declaration
P=150 # Horizontal force(lb)
T=(150*18)/(1000.0) # Force couple system(kip.in)
Mx=(150*10)/(1000.0) # Force couple system(kip.in)
sx=0 # Stress at x
M=1.5 # Torque(kip.in)
c=0.6 # Radius(in)
n=-1
#Calculation
#Case(a) Stresses S x , S y , T xy at Point H
sy=round(((M)*(c))/((1/4.0)*(math.pi)*(pow(0.6,4))),2) # Stress(ksi)
txy=round(((T)*(c))/((1/2.0)*(math.pi)*(pow(0.6,4))),2) # Shearing stress(ksi)
#Case(b) Principal Planes and Principal Stresses
phyp1=(n*61)/2.0 # Angle(degree)
phyp2=180-61 # Angle(degree)
Smax=8.84/2.0 + math.sqrt(4.42**2 + 7.96**2) # Maximum stress(ksi)
Smin=8.84/2.0 - math.sqrt(4.42**2 + 7.96**2) # Minimum stress(ksi)
# Result
print ('Case(a) Normal stress = %lf ksi' %sy)
print ('Case(a) Shearing stress = %lf ksi' %txy)
print ('Case(b) Principal plane angle = %lf degree' %phyp1)
print ('Case(b) Principal plane angle = %lf degree' %phyp2)
print ('Case(c) Maximum stress at point H = %lf ksi' %Smax)
print ('Case(c) Minimum stress at point H = %lf ksi' %Smin)
import math
from sympy import symbols
#Variable declaration
n=-1
Sx=50 # Force at x(MPa)
Sy=n*10 # Force at y(MPa)
OC=20 # Force(MPa)
CA=50 # Force(MPa)
BC=50 # Force(MPa)
#Calculation
# Case(a) Construction of Mohr’s Circle
Save=(Sx+Sy)/2.0 # Average stress(MPa)
CF=50-20 # Force(MPa)
FX=40 # Force(MPa)
R=math.sqrt(30**2 + 40**2) # Radius of circle(MPa)
# case(b) Principal Planes and Principal Stresses
Smax=OC+CA # Maximum stress(MPa)
Smin=OC-BC # Minimum stress(MPa)
phyp=(53.1)/2.0 # Angle(degree)
# case(c) Maximum Shearing Stress
tmax=50 # Maximum shearing stress(MPa)
Save=20 # Maximum normal stress(MPa)
# Result
print ('Case(a) radius of circle = %lf MPa' %R)
print ('Case(b) Maximum principal stress = %lf MPa' %Smax)
print ('Case(b) Minimum principal stress = %lf MPa' %Smin)
print ('Case(c) Maximum shearing stress = %lf MPa' %tmax)
print ('Case(c) Minimum shearing stress = %lf MPa' %Save)
import math
from sympy import symbols,cos,sin
#Variable declaration
sx=100 # Force(MPa)
sy=60 # Force(MPa)
CF=20 # Force(MPa)
FX=48 # Force(MPa)
OC=80 # Force(MPa)
CA=52 # Force(MPa)
BC=52 # Force(MPa)
# Calculation
#Construction of Mohr’s Circle
R=math.sqrt(20**2+48**2) # Radius of circle(MPa)
#Case(a) Principal Planes and Principal Stresses
phyp=(67.4)/2.0 # Angle(degree)
Smax=OC+CA # Maximum stress(MPa)
Smin=OC-BC # Min stress(MPa)
#Case(b) Stress Components on Element Rotated 30
phy=180-60 # Angle(degree)
Sxl=80-(52*(cos(52.6*(math.pi*2)/(360.0))))
Syl=80+(52*(cos(52.6*(math.pi*2)/(360.0))))
txlyl=52*(sin(52.6*(math.pi*2)/(360.0)))
# Result
print ('Case(a) Principal planes angle = %lf MPa' %phyp)
print ('Case(b) Maximum principal stress = %lf MPa' %Smax)
print ('Case(b) Minimum principal stress = %lf MPa' %Smin)
print ('Case(c) Stress in x direction = %lf MPa' %Sxl)
print ('Case(c) Stress in y direction = %lf MPa' %Syl)
print ('Case(c) Stress in x and y direction = %lf MPa' %txlyl)
import math
from sympy import symbols,sin
#Variable declaration
S0=8 # Stress(ksi)
Sx=8 # Stress in x direction(ksi)
Sy=0 # Stress in y direction(ksi)
Smax=10 # Maximum stress(ksi)
# Calculation
#Construction of Mohr’s Circle
Save=(1/2.0)*(Sx+Sy) # Average stress(ksi)
R=10-4 # Radius of mohr's circle(ksi)
#Calculation
#Case(a) Shearing Stress t0
phyp=(48.2)/2.0 # Angle(degree)
t0=R*sin(48.2*((math.pi)*2)/(360.0)) # Shearing stress(ksi)
#Case(b) Maximum Shearing Stress
tmax=R # Maximum shearing stress(ksi)
phyx=(90-48.2)/(2.0)
#Result
print ('Case(a) Shearing stress t0 for which the largest normal stress is 10 ksi = %lf ksi' %t0)
print ('Case(b) Maximum shearing stress = %lf ksi' %tmax)
import math
from sympy import symbols
#Variable declaration
n=-1
Sx=6
Sy=3.5
OC=4.75
CA=3.25
BC=3.25
#Calculation
# Case(a) Principal Planes and Principal Stresses
Save=(Sx+Sy)/2.0 # Average stress(ksi)
R=math.sqrt(1.25**2 + 3**2) # Radius of circle(ksi)
Sa=OC+CA # Principal stress(ksi)
Sb=OC-BC # Principal stress(ksi)
phyp=(67.4)/2.0
# Case(b) Maximum shearing stress
tmax=(1/2.0)*(Sa) # Maximum torque(ksi)
#Result
print ('Case(a) Principal stress at A = %lf ksi' %Sa)
print ('Case(a) Principal stress at B = %lf ksi' %Sb)
print ('Case(b) Principal plane = %lf ksi' %phyp)
print ('Case(c) Maximum shearing stress = %lf ksi' %tmax)
import math
from sympy import symbols
#Variable declaration
#Mohr’s Circle
Sx=80 # Stress at x(MPa)
sy=-40 # Stress at y(MPa)
CF=60 # Stress(MPa)
FX=25 # Stress(MPa)
OC=20 # Stress(MPa)
CA=65 # Stress(MPa)
BC=65 # Stress(MPa)
Save=(1/2.0)*(sx+sy) # Stress average(MPa)
R=math.sqrt(60**2+25**2) # radius of mohr's circle(MPa)
Sy=250 # Tensile strength(MPa)
tm=65 # Stress(MPa)
#Principal Stresses
sa=OC+CA # Stress at A(MPa)
sb=OC-BC # Stress at B(MPa)
#Calculation
#Case(a) Maximum-Shearing-Stress Criterion #
ty=(1/2.0)*(Sy) # Shearing stress at yield(MPa)
FS1=(ty/tm) # Factor of safety
#Case(b) Maximum-Distortion-Energy Criterion
FS2=round(math.sqrt((250**2)/(85.0**2+45.0**2+85.0*45)),2) # Factor of safety
# Result
print ('Case(a) Factor of safety with respect to maximum shearing stress criteria = %lf ' %FS1)
print ('Case(b) Factor of safety with respect to maximum-distortion-energy criterion = %lf ' %FS2)
import math
from sympy import symbols,cos,sin
#Variable declaration
p=180 # Internal gage pressure(psi)
t=(5/16.0) # Length(in)
r=(15-t) # Distance(in)
#Calculation
#Case(a) Spherical Cap
s=((p)*(r))/(2.0*t) # Stress(psi)
tmax=(1/2.0)*((p*r)/(t)) # Maximum shearing stress(psi)
#Case(b) Cylindrical Body of the Tank
t=3/8.0 # Distance(in)
r=15-t # Distance(in)
s1=(p*r)/(t) # Stress(psi)
s2=(1/2.0)*s1 # Stress(psi)
Save=(1/2.0)*(s1+s2) # Stress average(psi)
R=(1/2.0)*(s1-s2) # Stress(psi)
#Stresses at the Weld
Sw=round(Save-(R*cos(50*(((math.pi)*2)/360.0))),-1) # Stress at the weld(psi)
tw=round(R*sin(50*(((math.pi)*2)/360.0)),0) # Shearing stress at the weld(psi)
# Result
print ('Case(a) Normal stress = %lf ' %s)
print ('Case(a) Maximum shearing stress = %lf ' %tmax)
print ('Case(b) Stress in direction perpendicular to helical weld = %lf ' %Sw)
print ('Case(b) Stress in direction parallel to helical weld = %lf ' %tw)
import math
from sympy import symbols
#Variable declaration
n=-1
Sx=6 # Stress in x direction()
Sy=3.5 # Stress in y direction()
BC=3.25
#Calculation
#Case(a) Principal Axes and Principal Strains
Ex=4*(pow(10,-6)) # Distance(u)
Ey=0 # Distance(u)
OC=(Ex+Ey)/(2.0) # Radius(u)
OY=200 # Radius(u)
R=math.sqrt(200**2 + 200**2) # Radius(u)
Ea=200 + 283 # Strain at point A(u)
Eb=200 - 283 # Strain at point A(u)
#Case(b) Maximum shearing strain
ymax=283*2 # Maximum shearing strain(u)
El=200 # Normal strain(u)
# Result
print ('Case(a) Principal strain = %lf u' %Ea)
print ('Case(a) Principal strain = %lf u' %Eb)
print ('Case(b) Maximum shearing strain = %lf u ' %ymax)
print ('Case(b) Normal strain = %lf u' %El)
import math
from sympy import symbols
#Variable declaration
Ea=400*(pow(10,-6)) # Principal strain(in./in)
Eb=-50*(pow(10,-6)) # Principal strain(in./in)
v=0.30 # Poisson's ratio
n=-1
#Calculation
#Case(a) Maximum In-Plane Shearing Strain
Ymaxinplane=Ea-Eb # Maximum in-plane shearing strain(rad)
#Case(b) Maximum Shearing Strain
Ec=n*(v/(1.0-v))*(Ea+Eb) # Strain(in./in) # Maximum shearing strain(rad)
# Result
print ('Case(a) Maximum in plane shearing strain = %lf rad' %Ymaxinplane)
print ('Case(b) Maximum shearing strain = %lf u' %Ec)
import math
from sympy import symbols
#Variable declaration
s1=symbols('s1') # Variable declaration
s2=symbols('s2') # Variable declaration
E1=255*(pow(10,-6)) # Strain(in./in)
E2=60*(pow(10,-6)) # Strain(in./in)
G=11.2*(pow(10,6)) # Modulus of rigidity(psi)
#Calculation
#Gage Pressure Inside Tank
ymax=E1-E2 # Maximum in plane shearing strain(rad)
tmax=(round(G*ymax,0))/(pow(10,3)) # Shearing stress(ksi)
p=(2184*4*0.75)/12.0 # Gage pressure(psi)
#Principal Stresses and Maximum Shearing Stress
s2=round(2*tmax,2) # Principal Stress(ksi)
s1=round(2*s2,2) # Principal Stress(ksi)
tmax=(1/2.0)*(s1) # Shearing stress(ksi)
# Result
print ('Case(a) Gage pressure inside the tank = %lf psi' %p)
print ('Case(b) Principal stress = %lf ksi' %s2)
print ('Case(b) Principal stress = %lf ksi' %s1)
print ('Case(b) Maximum shearing stress = %lf ksi' %tmax)
import math
from sympy import symbols,solve
#Variable declaration
E1=40 # Strain(u)
E2=980 # Strain(u)
E3=330 # Strain(u)
exp1=symbols('exp1') # Variable declaration
exp2=symbols('exp2') # Variable declaration
exp3=symbols('exp3') # Variable declaration
ex=symbols('ex') # Variable declaration
ey=symbols('ey') # Variable declaration
yxy=symbols('yxy') # Variable declaration
v=0.29
n=-1
#Calculation
#Strain Components ex, ey, yxy
exp1=ex*1 + ey*0 + yxy*0*1-40 # Strain equations
exp2=ex*(pow(0.5,2)) + ey*(pow(0.866,2)) + yxy*(0.866*0.5)-980 # Strain equations
exp3=ex*(pow(-0.5,2)) + ey*(pow(0.866,2)) + yxy*(0.866*-0.5)-330 # Strain equations
Sol=solve((exp1,exp2,exp3),ex,ey,yxy) #
#Principal Strains
Eave=(1/2.0)*(860+40) # Strain(u)
R=math.sqrt(375**2+410**2) # Radius(u)
phyp=(42.4)/2.0 # Angle(degree)
Ea=-106 # Strain(u)
Eb=1006 # Strain(u)
Ec=n*(v/(1-v))*(Ea+Eb) # Strain(u)
#Maximum Shearing Strain
Ymax=(1006+368)
# Result
print ('Case(a) Strain component are :-')
print(Sol)
print ('Case(b) Principal strains = %lf ksi' %Ea)
print ('Case(b) Principal strains = %lf ksi' %Eb)
print ('Case(b) Principal strains = %lf ksi' %Ec)
print ('Case(c) Maximum shearing strain = %lf ksi' %Ymax)