In [3]:

```
from __future__ import division
import numpy as np
from math import pi
%matplotlib inline
from matplotlib.pyplot import plot, show, title, text, xlabel, ylabel
d1 = 10 # min. dia of cutter in mm
d2 = 60 # max. dia of cutter in mm
v = 30e3 # operating speed in mm/min
z= 6 # required speeds
nmin = v / (pi * d2) # n_min in rpm
nmax = v / (pi * d1) # n_max in rpm
phi = (nmax / nmin)**(1/(z-1))
spindle_speeds = [1]*6 # initializing
print "Spindle Speeds are :"
for i in range(0,6):
spindle_speeds[i] = (phi**i)*nmin
print '%d\t'%spindle_speeds[i],
cutter_dia = [1]*6 # initializing
for i in range(0,6):
cutter_dia[i] = (v/pi)/spindle_speeds[i]
y = [0,v/1e3]
plot([0,cutter_dia[0]], y, [0,cutter_dia[1]], y, [0,cutter_dia[2]], y, [0,cutter_dia[3]], y, [0,cutter_dia[4]], y, [0,cutter_dia[5]], y)
title("cutting velocity Vs Cutter diameter")
xlabel('Cutter Diameter(mm)')
ylabel('Cutting velocity(m/min)')
text(5,28,'%d'%spindle_speeds[5])
text(9,25,'%d'%spindle_speeds[4])
text(12,22,'%d'%spindle_speeds[3])
text(15,18,'%d'%spindle_speeds[2])
text(18,15,'%d'%spindle_speeds[1])
text(20,11,'%d'%spindle_speeds[0])
show()
# from graph
vmax1 = 36 # m/min
vmin1 = 24.5 # m/min
r1 = vmax1 - vmin1 # Range of cutting speed for 12 mm diameter in m/min
vmax2 = 36.5 # m/min.
vmin2 = 26 # m/min.
r2 = vmax2 - vmin2 # Range of cutting speed for 36 mm diameter in m/min
print " Range of cutting speed for 12 mm diameter = %0.1f m/min.\n Range of cutting speed for 36 mm diameter = %0.1f m/min."%(r1 , r2)
```

In [4]:

```
from math import floor, ceil
from sympy import solve, symbols
m = 2.5 # module in mm
phi = 1.2 # common ratio
n = 150 # speed in rev/min. of driving shaft
n1 = 70 # speed in rev/min. of driven shaft
n2 = (phi)**1*n1 # speed in rev/min. of driven shaft
n3 = (phi)**2*n1 # speed in rev/min. of driven shaft
n4 = (phi)**3*n1 # speed in rev/min. of driven shaft
T1=symbols('T1')
t1=n1/n*T1
expr = t1+T1-80
T1=solve(expr,T1)[0]
t1=n1/n*T1
T2=symbols('T2')
t2=n2/n*T2
expr = t2+T2-80
T2=solve(expr, T2)[0]
t2=n2/n*T2
T3=symbols('T3')
t3=n3/n*T3
expr=t3+T3-80
T3=solve(expr, T3)[0]
t3=n3/n*T3
T4=symbols('T4')
t4=n4/n*T4
expr=t4+T4-80
T4=solve(expr, T4)[0]
t4=n4/n*T4
t1 = floor(t1) # number of teeth on driving shaft
T1 = ceil(T1) # number of teeth on driven shaft
t2 = ceil(t2) # number of teeth on driving shaft
T2 = floor(T2) # number of teeth on driven shaft
t3 = floor(t3) # number of teeth on driving shaft
T3 = ceil(T3) # number of teeth on driven shaft
t4 = ceil(t4) # number of teeth on driving shaft
T4 = floor(T4) # number of teeth on driven shaft
# running speeds
n1 = n*t1/T1
n2 = n*t2/T2
n3 = n*t3/T3
n4 = n*t4/T4
print "Number of teeth on driver and driven are :- \n t1 = %d ,T1 = %d\n t2 = %d ,T2 = %d \n t3 = %d ,T3 = %d \n t4 = %d ,T4 = %d "%(t1,T1,t2,T2,t3,T3,t4,T4)
print "The actual running speed of driven shaft will be : \n n1 = %0.2f rev/min\n n2 = %0.2f rev/min \n n3 = %0.2f rev/min \n n4 = %0.2f rev/min"%(n1,n2,n3,n4)
# Answer of n3 is given wrong in book
# Answer vary due to round off error
```

In [5]:

```
from sympy import symbols, solve
z = 6 # number of steps
n1 = 180 # rev/min
n2 = 100 # rev/min
Rn = n1/n2
phi = (Rn)**(1/(z-1)) # common ratio
n3 = phi*n2 # rev/min
n4 = (phi)**2*n2 # rev/min
n5 = (phi)**3*n2 # rev/min
n6 = (phi)**4*n2 # rev/min
n7 = 225 # speed of input shaft in rev/min
Ta=symbols('Ta')
tb=n7/n5*Ta
Ta=solve(tb+Ta-52, Ta)[0]
tb=n7/n5*Ta
tb = ceil(tb)
Tc=symbols('Tc')
td=n7/n6*Tc
Tc=solve(td+Tc-52, Tc)[0]
td=n7/n6*Tc
Tc = ceil(Tc)
Te=symbols('Te')
tf=n7/n1*Te
Te=solve(tf+Te-52, Te)[0]
tf=n7/n1*Te
tf = ceil(tf)
Th=symbols('Th')
tj=n2/n5*Th
Th=solve(tj+Th-46, Th)[0]
Th = ceil(Th)
tj=n2/n5*Th
tj = floor(tj)
Ti=symbols('Ti')
tg=n5/n5*Ti
Ti=solve(tg+Ti-46, Ti)[0]
tg=n5/n5*Ti
print " Ta = %d Tb = %d \n Tc = %d Td = %d \n Te = %d tf = %d \n Th = %d Tj = %d \n Ti = %d Tg = %d"%(Ta,tb,Tc,td,Te,tf,tj,Th,Ti,tg)
# 'Answers vary due to round off error'
```

In [6]:

```
from math import sqrt, pi
v = 21 # cutting speed in rev/min.
z = 6
dmin = 5 # daimeter in mm
dmax = 20 # daimeter in mm
nmax = 1000*v/(pi*dmin) # spindle speed in rev/min.
nmin = 1000*v/(pi*dmax) # spindle speed in rev/min.
phi = (nmax/nmin)**(1/(z-1)) # common ratio
n1 = nmin # rev/min.
n2 = phi*n1 # rev/min.
n3 = (phi)**2*n1 # rev/min.
n4 = (phi)**3*n1 # rev/min.
n5 = (phi)**4*n1 # rev/min.
n6 = (phi)**5*n1 # rev/min.
print " Common ratio = %0.2f \n Spindle speeds are : %0.2f , %0.1f , %0.2f , %0.2f ,%0.2f and %0.1f rev/min."%(phi,n1,n2,n3,n4,n5,n6)
# 'Answers vary due to round off error'
```

In [7]:

```
# from fig. 22.18A
# Three gear ratios between input and intermediate shaft
nmax = 1400 # maximum speed in rev/min.
i1 = 1/1
i2 = 1/1.26
i3 = 1/(1.26)**2
# The two ratios between intermediate and output shaft
i4 = 1/1
i5 = 1/(1.26)**3
# number of teeth for input and intermediate shaft
t1 = 27/27
t2 = 24/30
t3 = 21/33
# number of teeth for output and intermediate shaft
t4 = 34/34
t5 = 20/48
# output speeds in rev./min
n1 = t3*t5*nmax
n2 = t2*t5*nmax
n3 = t1*t5*nmax
n4 = t3*t4*nmax
n5 = t2*t4*nmax
n6 = t1*t4*nmax
print " Three gear ratios between input and intermediate shaft i1 = %d i2 = %0.2f i3 = %0.3f \n The two ratios between intermediate and output shaft i4 = %d i5 = %0.3f \n number of teeth for each pair between input and intermediate shaft t1 = 27/27 ,t2 = 24/30 , t3 = 21/33 \n number of teeth for each pair between output and intermediate shaft = t4 = 34/34 ,t5 = 20/48 \n Output speeds \n n1 = %d rev/min , n2 = %d rev/min , n3 = %d rev/min \n n4 = %d rev/min, n5 = %d rev/min , n6 = %d rev/min"%(i1 , i2 , i3 , i4 , i5 , n1 , n2, n3,n4,n5,n6)
# Answer vary due to round off error
```