from __future__ import division
#given
#initial gauge length of the specimen
l0=50*10**-3 #m
#initia l gauge diameter of the specimen
d0=12*10**-3 #m
#extended gauge length of fracture
lf=58*10**-3 #m
#reduced gauge diameter
df=7*10**-3 #m
#initial an final cross sectional areas are
A_i=3.14/4*d0**2 #m**2
A_f=3.14/4*df**2 #m**2
#various applied loads are in k N
P1=0
P2=5
P3=10
P4=15
P5=20
P6=25
P7=30
P8=32
P9=33
P10=32
P11=31
P12=35
P13=40
P16=130
#corresponding to these load we have recorded elongation as
delta1=0
delta2=0.011
delta3=0.022
delta4=0.035
delta5=0.048
delta6=0.059
delta7=0.073
delta8=0.088
delta9=0.100
delta10=0.125
delta11=0.150
delta12=0.230
delta13=0.400
delta16=8.000
#stress and strain corresponding to these loads and elongations are
sigma1=P1/A_i
strain1=delta1/l0
sigma2=P2/A_i
strain2=delta2/l0
sigma3=P3/A_i
strain3=delta3/l0
sigma4=P4/A_i
strain4=delta4/l0
sigma5=P5/A_i
strain5=delta5/l0
sigma6=P6/A_i
strain6=delta6/l0
sigma7=P7/A_i
strain7=delta7/l0
sigma8=P8/A_i
strain8=delta8/l0
sigma9=P9/A_i
strain9=delta9/l0
sigma10=P10/A_i
strain10=delta10/l0
sigma11=P11/A_i
strain11=delta11/l0
sigma12=P12/A_i
strain12=delta12/l0
sigma13=P13/A_i
strain13=delta13/l0
sigma16=P16/A_i
strain16=delta16/l0
#part(a)
#modulus of elasticity
E=(sigma4-sigma1)/(strain4-strain1)/10**3 #G Pa
#part(b)
#ultimate stress (maximum)
ultimate_sigma=P16/A_i*10**3/10**6 #M N/m**3
#part (c)
#upper yield point at C (shown in fig 10.3)
u_yield=P9/A_i*1000/10**6 #M N/m**2
#lower yield point at D (shown in fig 10.3)
l_yield=P11/A_i*1000/10**6 #M N/m**2
#part(d)
#percentage reduction in area
percent_A=(d0**2-df**2)/d0**2*100 #%
#part (e)
#percentage elongation
percent_l=(lf-l0)/l0*100 #%
#part(f)
#apparent breaking stress
app_breaking_stress=P16*1000/A_i/10**6 #M N/m**2
#actual breaking stress
actual_breaking_stress=P16*1000/A_f/10**6 #M N/m**2
print """the modulus of elasticity is %0.3f G Pa
the ultimate (maximum) stress is %0.3f M n/m**2
upper yield point is %0.3f M N/m**2
lower yield point is %0.3f M n/m**2
percentage reduction in area is %0.3f
percentage elongation in length %0.3f
apparent breaking stress is %0.3f M n/mm**2
actual breaking point is %0.3f M n/m**2"""%(E,ultimate_sigma,u_yield,l_yield,percent_A,percent_l,app_breaking_stress,actual_breaking_stress)
#given
#initial length of the specimen
h0=24.02*10**-3 #m
#initial gauge diameter of the specimen
d0=18.74*10**-3 #m
#final length of specimen
hf=18.70*10**-3 #m
#final diameter
df=21.54*10**-3 #m
#initial an final cross sectional areas are
A_i=3.14/4*d0**2 #m**2
A_f=3.14/4*df**2 #m**2
#various applied loads are in k N
P1=0
P2=5
P3=10
P4=15
P5=20
P6=25
P7=30
P8=35
P9=40
P10=45
P11=50
P12=55
P13=60
P14=65
P15=70
P16=75
P17=80
P18=85
P19=131
#corresponding to these load we have recorded contraction as
delta1=0
delta2=0.004
delta3=0.008
delta4=0.012
delta5=0.015
delta6=0.017
delta7=0.020
delta8=0.023
delta9=0.025
delta10=0.028
delta11=0.032
delta12=0.036
delta13=0.040
delta14=0.044
delta15=0.049
delta16=0.054
delta17=0.061
delta18=0.069
#stress and strain corresponding to these loads and elongations are
sigma1=P1/A_i
strain1=delta1/h0
sigma2=P2/A_i
strain2=delta2/h0
sigma3=P3/A_i
strain3=delta3/h0
sigma4=P4/A_i
strain4=delta4/h0
sigma5=P5/A_i
strain5=delta5/h0
sigma6=P6/A_i
strain6=delta6/h0
sigma7=P7/A_i
strain7=delta7/h0
sigma8=P8/A_i
strain8=delta8/h0
sigma9=P9/A_i
strain9=delta9/h0
sigma10=P10/A_i
strain10=delta10/h0
sigma11=P11/A_i
strain11=delta11/h0
sigma12=P12/A_i
strain12=delta12/h0
sigma13=P13/A_i
strain13=delta13/h0
sigma14=P14/A_i
strain14=delta14/h0
sigma15=P15/A_i
strain15=delta15/h0
sigma16=P16/A_i
strain16=delta16/h0
sigma17=P17/A_i
strain17=delta17/h0
sigma18=P18/A_i
strain18=delta18/h0
#part(a)
#modulus of elasticity
E=(sigma13-sigma1)/(strain13-strain1)/10**3 #G Pa
#part(b)
# yield stress at D (shown in fig 10.6)
Yield=P15/A_i*1000/10**6 #M N/m**2
#part (c)
#ultimate stress (maximum)
ultimate_sigma=P19/A_i*10**3/10**6 #M N/m**3
#part (d)
#percentage contraction
percent_l=(h0-hf)/h0*100 #%
#part(e)
#percentage increase in area
percent_A=(df**2-d0**2)/d0**2*100 #%
#part(f)
#apparent breaking stress
app_breaking_stress=P19*1000/A_i/10**6 #M N/m**2
#actual breaking stress
actual_breaking_stress=P19*1000/A_f/10**6 #M N/m**2
print """The modulus of elasticity is %0.3f G Pa
Yield stress is %0.3f M n/m**2
The ultimate (maximum) stress is %0.3f M n/m**2
Percentage contraction in length %0.3f
Percentage increase in area is %0.3f
Apparent breaking stress is %0.3f M n/mm**2
Actual breaking point is %0.3f M n/m**2"""%(E,Yield,ultimate_sigma,percent_l,percent_A,app_breaking_stress,actual_breaking_stress)
#given
#length of glass piece
l=1.1*10**3 #mm
#width of glass piece
b=225 #mm
#height or thicness of plate
h=10 #mm
#load
P=250 #N
#for a simply supported beam subjected to concentrated load in the middle of its span,
M=P*l/4 #N mm
#and force
F=P/2 #N
#part(a)
#flexure strength
sigma=6*M/b/h**2 #N/mm**2
#part (b)
#shear strength
tau=3*F/2/b/h #N/mm**2
#part (c)
P1=350 #N
M1=P1*l/4
#ineria
I=b*h**3/12 #mm**4
y=h/2 #mm
#the modulus of rupture is given by
sigmar=M1*y/I
print "The flexture strength, shear strength and modulus of rupture are :\n%0.3f N/mm**2, %0.3f N/mm**2 and %0.3f N/mm**2 resp"%(sigma, tau, sigmar)
from math import pi, sqrt
#given
#diameter of ball
D=0.5*10 #mm
#indentation diameter
d=32.5/10 #mm (diveided by 10 because it is 10 times magnified)
#from table- 10.3 of book , the load for steel specimen is
P=30*D**2 #kg f
#hardness
BHN=P/((pi)*D/2*(D-sqrt(D**2-d**2)))
print "The hardness is %0.3f" %(BHN)
from math import sin, cos, acos
#given
#dimension of steel specimen
l=75 #mm
b=10 #mm
t=10 #mm
#depth of V-notch is t/5
#in the absence of specimen, frictional and windage loss
L1=0.1 #kg f.m
#in the presence ofspecimen, which is placed on support breaks
L2=5.9 #kg f m
#rupture energy
U=L2-L1 #kg f m
#since the depth of V-notch is t/5
#so t/5=2
te=t-2 #mm
#volume of specimen
Ve=l*b*te*10**-9 #m**3
#modulus of rupture
Ur=U/Ve #kg f/m**2
#effective area of cross section
Ae=b*te*10**-6 #m**2
#notch impact strength
Is=U/Ae #kg/m
#given that
Ui=30 #kg f.m
alpha=160*(pi)/180 #radians
#swing diameter
D=1600 #mm
R=D/2*10**-3 #m
#weight of hammer
#as we know that
#Ut=W*R(1-cos(aplha))
#so
W=Ui/R/(1-cos(alpha)) #kg f.m
#capacity of izod impact testing machine
L3=30 #kg f.m
#so Uf will be
Uf=L3-L2 #kbg f.m
#we know that energy after rupture
#Uf=W*R(1-cos(beta))
bet=acos(1-Uf/W/R) #radins
#beta in degrees
Beta=bet*180/(pi) #degrees
#also we know that Uf=W*hf
#so hf will be
hf=Uf/W #m
print """rupture energy is %0.3f kg f.m
modulus of rupture %0.3f kg f/m**2
notch impact strength %0.3f kg/m
angle of hammer after striking %0.3f degrees
height risen by hammer after breaking %0.3f m"""%(U,Ur,Is,Beta,hf)
#given
#diameter of circular section of bean
d=60 #mm
#length of circular section of beam
l=500 #mm
#maximum and minimum load
Pmin= 20 #kN
Pmax= 50 #kN
#ultimate strength
sigmau=650 #MPa
#yoeld strength
sigmay=520 #MPa
#factor of safety
fos=1.8
#maximum bending moment
Mmax=Pmax*l/4 #kN mm
#minimum bending moment
Mmin=Pmin*l/4 #kN mm
#mean bending moment
Mm=(Mmax+Mmin)/2 #kN mm
#alerting (variable) bending moment
Ma=(Mmax-Mmin)/2 #kN mm
#section modulus of beam
Z=(pi)*d**3/32 #mm**3
#mean bending stress
sigmam=Mm/Z*1000 #MPa
#variable bending stress
sigmaa=Ma/Z*1000 #MPa
#endurance stress from
#(i) gerber's parabolic relation
sigmae1=sigmaa/(1/fos-(sigmam/sigmau)**2*fos) #MPa
#(ii) goodman's straight line relation
sigmae2=sigmaa/(1/fos-sigmam/sigmau) #MPa
#(iii) soderberg's straight line realtion
sigmae3=sigmaa/(1/fos-sigmam/sigmay) #MPa
print """Endurance strength of the material are :
Gerbers parabolic fomula %0.3f MPa
goodmans straight line formula %0.3f MPa
sodergerbs straight line relation %0.3f MPa """%(sigmae1,sigmae2,sigmae3)
#given
#yeild strength of polycrystalline material increases from sigmay1 to sigmay2
sigmay1=118 #MPa
sigmay2=207 #MPa
#decreasing grain diameter from d1 to d2
d1=0.253*10**-3 #m
d2=0.0224*10**-3 #m
#to find the yield strngth at
d=0.095*10**-3 #m
#as we know that according to hall and petch equation,
#sigmay=sigma0+C/sqrt(d)
#putting sigmay1,sigmay2,d1 and d2.. we get 2 equations
#sigma0+C/sqrt(d1)=sigmay1 -------(1)
#and sigma0+C/sqrt(d2)=sigmay2 -----(2)
#solving equation 1 and 2 we get
sigma0=80.3 #MPa
#and
C=0.1896 #MN/m**(3/2)
#so the yield stress for the grain size
d=0.095*10**-3 #m
sigma=sigma0+C/sqrt(d) #MPa
print "The yield stress for a grainof size of 0.095 mm is %0.3f MPa"%(sigma)
#given
#ASTM number
n=12
#as we know that
N=2**(n-1)
#1 square inch=645 mm**2
#so grain diameter for ASTM number 12 will be
d=1/sqrt((N/645)*10**4) #mm
print "The grain diameter of ASTM number 12 is %0.4f mm"%(d)
#given
#ASTM number of grain
n=5
#as we know that
N=2**(n-1) #grains/inche**2 at magnification 100*
# as lineal and areal magnifications are related as *100=10,000 areal
N1=N/0.01/0.01 #grains/inch**2 at 1*
#average area of one grain
A=2.54*2.54/N1 #cm**2
#now N1 grains/ inch**2 of surface is = sqrt(160,000)=400 grain/inch of length and this is equal to =(400)**3=6.4*10**7 grains/m**3 of volume
#surface area of eaxh cubic surface
S=(1/400)**2 #inch**2
#there are 6 surfaces in a cubic grain
#so total surface area of each grain
TS=6*S #inch**2
#each boundary is composed of two grain surfaces, therefore , total boundary in the volume is
TotS=1/2*TS*(400)**3 #inch**2 boundary per cubic of steel
#total suface area in cm**2
TotalS=TotS/(2.54) #cm**2 boundary per cubic cm of steel
print "total boundary in the volume is %0.3f cm**2 per cm**3 of steel"%(TotalS)
from __future__ import division
#given
#ASTM number
n=4
#as we know that
N=2**(n-1) #per inch**2 at a magnification of 100
#let r be the radius of grain
#so
#N*A=1/100 inch**2 where A=(pi)*r**2
#so
r=sqrt(1/100/N/(pi)) #inch
#radius of grain in mm
R=r*25.4 #mm
print "the radius of grain is %0.3f mm"%(R)