Chapter4-Mechanical Behavior of Materials

Ex1-pg101

In [1]:
import math
#calculate diameterof the bar in all cases
import numpy
from numpy.linalg import inv
sigmayp=350. ##MPa
sigma3=0.
M=8. ##kN
Mt=24. ##kNm
N=2.
v=0.3

## sigma= My/I ==32M/%pid**3
## tau= Mt*r/J ==16Mt/%pid**3
##sigma1=(16*(M+sqrt(M**2+Mt**2)))/(%pi*d**3)
##sigma2=(16*(M-sqrt(M**2+Mt**2)))/(%pi*d**3)

##solution a: max principal stress theory
##(16*(M+sqrt(M**2+Mt**2)))/(%pi*d**3)=sigmayp/N

a=(16.*(M+math.sqrt(M**2.+Mt**2.)))/math.pi
print(a)
b=sigmayp*10**6./N
print(b)
d=(a/b)**(1/3.)
print'%s %.5f %s'%("diameter of the bar in meter is= ",d,"")

##solution b:max shearing stress theory

c=(32.*math.sqrt(M**2.+Mt**2.))/math.pi
print(c)
d=(c/b)**(1/3.)
print'%s %.5f %s'%("diameter of the bar in meter is= ",d,"")

##solution c:max principal strain theory
##epsilon1=(sigma1-v(sigma2+sigma3))/E=epsilonyp/N=sigmayp/EN    Or
##sigma1-v(sigma2+sigma3)=b    given
##sigma1=b+v(sigma2+sigma3)    substituting the values of the sigma 1,2 and 3 we get
##(16*(M+sqrt(M**2+Mt**2)-vM-v*sqrt(M**2+Mt**2)))/(%pi*d**3)=b
e=(16.*(M+math.sqrt(M**2.+Mt**2.)-v*M-v*math.sqrt(M**2.+Mt**2.)))/math.pi
print(e)
d=(e/b)**(1/3.)
print'%s %.5f %s'%("diameter of the bar in meter is= ",d,"")

##solution d:max energy of distortion theory

f=(16.*math.sqrt(4*M**2.+3.*Mt**2.))/math.pi
print'%s %.5f %s'%("f",f,"")
d=(f/b)**(1/3.)
print'%s %.5f %s'%("diameter of the bar in meter is= ",d,"")
print("all the values are converted into meter")
169.586448419
175000000.0
diameter of the bar in meter is=  0.00990 
257.685565975
diameter of the bar in meter is=  0.01138 
118.710513893
diameter of the bar in meter is=  0.00879 
f 226.85113 
diameter of the bar in meter is=  0.01090 
all the values are converted into meter

Ex3-pg107

In [7]:
import math
#calculate max principal stress
sigmau1=300.  ##MPa
sigmau2=700.  ##MPa
b=0.105 ##m outer diameter
a=0.100 ##m inner diameter

##sigma1==(-sigma2)==tau

sigma3=0.

##Mt=J*tau/r= (%pi*(b**2-a**2))/2*b
##Mt=((%pi*(b**4-a**4))/(2*b))*tau         equation a
q=(math.pi*(b**4.-a**4.))/(2.*b)

##solution a: max principal stress theory
tau=sigmau1
Mt=q*tau*10**6.
print'%s %.2f %s'%("max principal stress in Nm is= ",Mt,"")

##solution b:max shearing stress theory
## |sigma1-sigma2|=sigmau1
## 2*sigma1==sigmau1==2*tau  or

Mt=q*tau*10**6
print'%s %.2f %s'%("max shearing stress in Nm is= ",Mt,"")

##solution c:Coulomb- mohr theory
##(tau/sigmau1)-(-tau/sigmau2)=1
tau=1*((sigmau1*sigmau2)/(sigmau1+sigmau2))
print'%s %.2f %s'%("tau in MPa is= ",tau,"")
Mt=q*tau*10**6
print'%s %.2f %s'%("Coulomb- mohr in Nm is= ",Mt,"")
max principal stress in Nm is=  96718.98 
max shearing stress in Nm is=  96718.98 
tau in MPa is=  210.00 
Coulomb- mohr in Nm is=  67703.29 

Ex4-pg109

In [8]:
import math
#calculate laod and intertia
a=0.05 ## m
Fm=90. ##kN
sigmacr=210. ## MPa
sigmayp=280. ## MPa

##sigmaa=Ma*c/I         equation 1
##Ma=0.025*Fa
c=0.025
I=(a**4.)/12.
print'%s %.7f %s'%("I",I,"")
##sigmaa=((0.025*Fa)*c)/I  substituting the values


##sigmam=Fm/A           equation 2
sigmam=Fm/(a*a)
print'%s %.2f %s'%("in kilo Pa is= ",sigmam,"")

##(((1200*Fa)/sigmacr)+(sigmam/sigmayp))=1
Fa=(1.-(sigmam/sigmayp))*(sigmacr/1200.)
print'%s %.2f %s'%("load Fa in N is= ",Fa,"")                         ##wrong ans in textbook
I 0.0000005 
in kilo Pa is=  36000.00 
load Fa in N is=  -22.32 

Ex5-pg110

In [4]:
import math
#calculate the value of pressure 
r=0.04 ##m
t=5. ##mm
sigmae=250. ##MPa
sigmay=300. ##MPa

##sigmathetamax=(p*r)/t =8*p        max values of tangential stresses
##sigmathetamin=((-p/4)*r)/t =-2*p   min values of tangential stresses
##sigmazamax=(p*r)/2*t =4*p       axial principal stresses
##sigmazmin=((-p/4)*r)/2*t =-p

##sigmathetaa=(sigmathetamax-sigmathetamin)/2= 5p    alternating and mean stresses
##sigmathetam=(sigmathetamax+sigmathetamin)/2= 3p
##sigmaza=(sigmazamax-sigmazmin)/2 =2.5p
##sigmazm=(sigmazamax+sigmazmin)/2 =1.5p

##sqrt(sigmathetaa**2-sigmathetaa*sigmaza+sigmaza**2)=sigmaea
##sqrt(sigmathetam**2-sigmathetam*sigmazm+sigmazm**2)=sigmaem

##sqrt(25p**2-12.3p**2+6.25p**2)=sigmaea
##sqrt(9p**2-4.5p**2+2.25p**2)=sigmaem           solving this equation we get
sigmaea=4.33 ##p
sigmaem=2.60 ##p

p=1./((sigmaea/sigmae)+(sigmaem/sigmay))
print'%s %.2f %s'%("the value of p in MPa is= ",p,"")
the value of p in MPa is=  38.48 

Ex6-pg112

In [3]:
import math
import numpy
from numpy.linalg import inv
#find alternating and mean values of stresses and sigma and cycle
a=([[700 ,14 ,0], [14, -350, 0],[0, 0, -350]])
print(a)
c=([[-660, -7, 0], [-7 ,-350, 0], [0, 0, -350]])
print(c)
sigmau=2400. ##MPa
K=1.
sigmae=800. ##MPa
Nf=1. ##cycles for SAE
Nff=10**3 ##cycles for Gerber
Ne=10**8 ##cycles

sigmaxa=(700.+660.)/2.
print'%s %.2f %s'%("alternating and mean values of stresses in MPa is= ",sigmaxa,"")
sigmaxm=(700-660)/2.
print'%s %.2f %s'%("alternating and mean values of stresses in MPa is= ",sigmaxm,"")
sigmaya=(-350+350)/2.
print'%s %.2f %s'%("alternating and mean values of stresses in MPa is= ",sigmaya,"")
sigmaym=(-350-350)/2.
print'%s %.2f %s'%("alternating and mean values of stresses in MPa is= ",sigmaya,"")
sigmazm=(-350-350)/2.
print'%s %.2f %s'%("alternating and mean values of stresses in MPa is= ",sigmazm,"")
tauxya=(14+7)/2.
print'%s %.2f %s'%("alternating and mean values of stresses in MPa is= ",tauxya,"")
tauxym=(14-7)/2.
print'%s %.2f %s'%("alternating and mean values of stresses in MPa is= ",tauxym,"")

sigmaea=math.sqrt(((sigmaxa-sigmaya)**2.+(sigmaya-sigmaxa)**2.+6.*(tauxya)**2.)/2.)
print'%s %.2f %s'%("in MPa is =",sigmae,"")
sigmaem=math.sqrt(((sigmaxm-sigmaym)**2.+(sigmaym-sigmaxm)**2.+6.*(tauxym)**2.)/2.)
print'%s %.2f %s'%("in MPa is= ",sigmaem,"")

##solution a: 
sigmacr=sigmaea/(1-(sigmaem/2400.))
print'%s %.3f %s'%("sigmacr",sigmacr,"")
b=math.log(sigmau/sigmae)/math.log(1./Ne)
print'%s %.3f %s'%("b",b,"")

Ncr=1.*(sigmacr/2400.)**(1./b)
print'%s %.3f %s'%("in cycles is= ",Ncr,"")

##solution b:
sigmacr=sigmaea/(1.-(sigmaem/sigmau)**2.)
print'%s %.3f %s'%("in MPa is= ",sigmacr,"")
b=math.log(2160./sigmae)/math.log(10**3./Ne)
print'%s %.3f %s'%("b",b,"")

Ncr=Nff*(sigmacr/(0.9*2400))**(-11.587)
print'%s %.3e %s'%("in cycles is= ",Ncr,"")
[[700, 14, 0], [14, -350, 0], [0, 0, -350]]
[[-660, -7, 0], [-7, -350, 0], [0, 0, -350]]
alternating and mean values of stresses in MPa is=  680.00 
alternating and mean values of stresses in MPa is=  20.00 
alternating and mean values of stresses in MPa is=  0.00 
alternating and mean values of stresses in MPa is=  0.00 
alternating and mean values of stresses in MPa is=  -350.00 
alternating and mean values of stresses in MPa is=  10.50 
alternating and mean values of stresses in MPa is=  3.50 
in MPa is = 800.00 
in MPa is=  370.05 
sigmacr 804.248 
b -0.060 
in cycles is=  91502934.807 
in MPa is=  696.809 
b -0.086 
in cycles is=  4.934e+08 

Ex7-pg115

In [2]:
import math
#calculate Inertia and deflection of a point in meter and impact factor and pressure and static deflection of the beam and impact facotr
W=180. ##N
h=0.1 ##m
L=1.16 ##m
w=0.025 ##m
d=0.075 ##m
E=200. ##GPa
k=180. ##kN/m

I=w*d**3.
print'%s %.5f %s'%("I",I,"")
##deltast=(W*L**3)/(48*E*I)       equation 1
deltast=(W*L**3*12.)/(48.*E*10**9.*I)
print'%s %.5f %s'%("deflection of a point in meter is= ",deltast,"")

##deltastmax=Mc/I                equation 2
deltastmax=(W*L*12*0.0375)/(4*I)
print'%s %.2f %s'%("deflection of a point in Pa is= ",deltastmax,"")

##solution a:
a=1+math.sqrt(1.+((2.*h)/deltast))
print'%s %.2f %s'%("imapct factor is= ",a,"")
deltamax=deltast*a
print'%s %.2f %s'%("in meter is =",deltastmax,"")
sigmamax=deltastmax*a
print'%s %.2f %s'%("in Pa is= ",sigmamax,"")

##solution b:
deltast=deltast+(90./180000.)
print'%s %.5f %s'%("static deflection of the beam in meter is= ",deltast,"")
a=1+math.sqrt(1.+((2.*h)/deltast))
print'%s %.2f %s'%("imapct factor is= ",a,"")
deltamax=deltast*a
print'%s %.3f %s'%("in meter is =",deltamax,"")
sigmamax=deltastmax*a
print'%s %.2f %s'%("in Pa is= ",sigmamax,"")
#round off error
I 0.00001 
deflection of a point in meter is=  0.00003 
deflection of a point in Pa is=  2227200.00 
imapct factor is=  78.51 
in meter is = 2227200.00 
in Pa is=  174848357.07 
static deflection of the beam in meter is=  0.00053 
imapct factor is=  20.39 
in meter is = 0.011 
in Pa is=  45415592.13