from math import sqrt
d=70#
dmin=50#
dmax=80#
D=sqrt(dmin*dmax)#
D=63#
i=0.458*(D**(1/3))+(0.001*D)#
#standard tolerance for H8 is ST1
ST1=25*i#
ST1=ST1*10**-3#
#standard tolerance of shaft for grade g7 is ST2
ST2=16*i#
ST2=ST2*10**-3#
es=-(2.5*(D**0.333))#
es=es*10**-3#
ei=es-ST2#
#Lower limit for hole is LLH
#Upper limit for hole is ULH
#Upper limit for shaft is ULS
#Lower limit for shaft is LLS
LLH=d#
ULH=LLH+ST1#
ULS=LLH+es#
LLS=ULS-ST2#
#Maximum clearance is Cmax
#minimum clearance is Cmin
Cmax=ULH-LLS#
Cmin=LLH-ULS#
# printing data in scilab o/p window
print " LLH is %0.1f mm "%(LLH)#
print "\n ULH is %0.3f mm "%(ULH)#
print "\n ULS is %0.2f mm "%(ULS)#
print "\n LLS is %0.2f mm "%(LLS)#
print "\n Cmax is %0.3f mm "%(Cmax)#
print "\n Cmin is %0.3f mm "%(Cmin)#
d=25#
#Lower limit for hole is LLH
#Upper limit for hole is ULH
#Upper limit for shaft is ULS
#Lower limit for shaft is LLS
ULH=d+0.021#
LLH=d+0#
ULS=d+0.041#
LLS=d+0.028#
#Maximum interference is Cmax
#minimum interference is Cmin
Cmax=ULS-LLH#
Cmin=LLS-ULH#
# printing data in scilab o/p window
print "Cmax is %0.3f mm "%(Cmax)#
print "\nCmin is %0.3f mm "%(Cmin)#
d=50#
Es=0.039#
Ei=0#
es=-9*10**-3#
ei=-34*10**-3#
#Shaft dia is D
D=d+es#
#Lower limit for hole is LLH
#Upper limit for hole is ULH
#Upper limit for shaft is ULS
#Lower limit for shaft is LLS
ULH=d+Es#
LLH=d+Ei#
ULS=d+es#
LLS=d+ei#
#Maximum interference is Cmax
#minimum interference is Cmin
Cmax=ULH-LLS#
Cmin=LLH-ULS#
# printing data in scilab o/p window
print " ULH is %0.3f mm "%(ULH)#
print "\n LLH is %0.3f mm "%(LLH)#
print "\n ULS is %0.3f mm "%(ULS)#
print "\n LLS is %0.3f mm "%(LLS)#
print "\n Cmax is %0.3f mm "%(Cmax)#
print "\n Cmin is %0.3f mm "%(Cmin)#
print ' Therefore, H8g7 is easy running fit'
d=30#
Es=0.025#
Ei=0#
es=11*10**-3#
ei=-5*10**-3#
#Shaft dia is D
D=d+es#
#Lower limit for hole is LLH
#Upper limit for hole is ULH
#Upper limit for shaft is ULS
#Lower limit for shaft is LLS
ULH=d+Es#
LLH=d+Ei#
ULS=d+es#
LLS=d+ei#
#Maximum interference is Cmax
#minimum interference is Cmin
Cmax=ULH-LLS#
Cmin=ULS-LLH##
# printing data in scilab o/p window
print " ULH is %0.3f mm "%(ULH)#
print "\n LLH is %0.3f mm "%(LLH)#
print "\n ULS is %0.3f mm "%(ULS)#
print "\n LLS is %0.3f mm "%(LLS)#
print "\n Cmax is %0.3f mm "%(Cmax)#
print "\n Cmin is %0.3f mm "%(Cmin)#