In [3]:

```
import math
# Variables:
P = 120.*1000 #W
d = 250./1000
r = d/2 #m
N = 650. #rpm
phi = 20. #degrees
#Solution:
#Calculating the angular speed of the gear
omega = 2*math.pi*N/60 #rad/s
#Calculating the torque transmitted
T = P/omega #N-m
#Calculating the math.tangential load on the pinion
FT = T/r #N
#Calculating the total load due to power transmitted
F = FT/(math.cos(math.radians(phi))*1000) #kN
#Results:
print " Total load due to power transmitted, F = %.2f kN."%(F)
# rounding off error
```

In [2]:

```
import math
# Variables:
T = 40.
t = T
phi = 20. #degrees
m = 6. #mm
#Solution:
#Calculating the circular pitch
pc = math.pi*m #mm
#Calculating the length of arc of contact
Lac = 1.75*pc #Length of arc of contact mm
#Calculating the length of path of contact
Lpc = Lac*math.cos(phi) #Length of path of contact mm
#Calculating the pitch circle radii of each wheel
R = m*T/2 #mm
r = R #mm
#Calculating the radius of the addendum circle of each wheel
RA = math.sqrt(R**2*(math.cos(phi))**2+(Lpc/2+R*math.sin(phi))**2) #mm
#Calculating the addendum of the wheel
Ad = RA-R #Addendum of the wheel mm
#Results:
print " Addendum of the wheel = %.2f mm."%(Ad)
```

In [10]:

```
import math
# Variables:
t = 30.
T = 80.
phi = 20. #degrees
m = 12. #mm
Addendum = 10. #mm
#Solution:
#Length of path of contact:
#Calculating the pitch circle radius of pinion
r = m*t/2 #mm
#Calculating the pitch circle radius of gear
R = m*T/2 #mm
#Calculating the radius of addendum circle of pinion
rA = r+Addendum #mm
#Calculating the radius of addendum circle of gear
RA = R+Addendum #mm
#Calculating the length of path of approach
#Refer Fig. 12.11
KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) #mm
#Calculating the length of path of recess
PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) #mm
#Calculating the length of path of contact
KL = KP+PL #mm
#Calculating the length of arc of contact
Lac = KL/math.cos(math.radians(phi)) #Length of arc of contact mm
#Contact ratio:
#Calculating the circular pitch
Pc = math.pi*m #mm
#Calculating the contact ratio
CR = Lac/Pc #Contact ratio
#Results:
print " Length of path of contact, KL = %.1f mm."%(KL)
print " Length of arc of contact = %.2f mm."%(Lac)
print " Contact ratio = %.1f."%(CR)
```

In [11]:

```
import math
# Variables:
phi = 20. #degrees
t = 20.
G = 2.
m = 5. #mm
v = 1.2 #m/s
addendum = 1*m #mm
#Solution:
#Angle turned through by pinion when one pair of teeth is in mesh:
#Calculating the pitch circle radius of pinion
r = m*t/2 #mm
#Calculating the pitch circle radius of wheel
R = m*G*t/2 #mm
#Calculating the radius of addendum circle of pinion
rA = r+addendum #mm
#Calculating the radius of addendum circle of wheel
RA = R+addendum #mm
#Calculating the length of path of approach
KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) #mm
#Calculating the length of path of recess
PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) #mm
#Calculating the length of path of contact
KL = KP+PL #mm
#Calculating the length of arc of contact
Lac = KL/math.cos(math.radians(phi)) #mm
#Calculating the angle turned by the pinion
angle = Lac*360/(2*math.pi*r) #Angle turned by the pinion degrees
#Maximum velocity of sliding:
#Calculating the angular speed of pinion
omega1 = v*1000/r #rad/s
#Calculating the angular speed of wheel
omega2 = v*1000/R #rad/s
#Calculating the maximum velocity of sliding
vS = (omega1+omega2)*KP #mm/s
#Results:
print " Angle turned through by pinion when one pair of teeth is in mesh = %.2f degrees."%(angle)
print " Maximum velocity of sliding, vS = %.1f mm/s."%(vS)
```

In [1]:

```
import math
# Variables:
T = 40.
t = 20.
N1 = 2000. #rpm
phi = 20. #degrees
addendum = 5.
m = 5. #mm
#Solution:
#Calculating the angular velocity of the smaller gear
omega1 = 2*math.pi*N1/60 #rad/s
#Calculating the angular velocity of the larger gear
omega2 = omega1*t/T #rad/s
#Calculating the pitch circle radius of the smaller gear
r = m*t/2 #mm
#Calculating the pitch circle radius of the larger gear
R = m*T/2 #mm
#Calculating the radius of aaddendum circle of smaller gear
rA = r+addendum #mm
#Calculating the radius of addendum circle of larger gear
RA = R+addendum #mm
#Calculating the length of path of approach
KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) #mm
#Calculating the length of path of recess
PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) #mm
#Calculating the velocity of sliding at the point of engagement
vSK = (omega1+omega2)*KP #mm/s
#Calculating the velocity of sliding at the point of disengagement
vSL = (omega1+omega2)*PL #mm/s
#Angle through which the pinion turns:
#Calculating the length of path of contact
KL = KP+PL #mm
#Calculating the length of arc of contact
Lac = KL/math.cos(math.radians(phi)) #Length of arc of contact mm
#Calculating the circumference of pinion
C = 2*math.pi*r #Circumference of pinion mm
#Calculating the angle through which the pinion turns
angle = Lac*360/C #Angle through which the pinion turns degrees
#Results:
print " Velocity of sliding at the point of engagement, vSK = %.f mm/s."%(vSK)
print " Velocity of sliding at the point of disengagement, vsL = %.f mm/s."%(vSL)
print " Angle through which the pinion turns = %.2f degrees."%(angle)
# answers differ due to rounding off error
```

In [3]:

```
import math
# Variables:
phi = 20. #degrees
m = 6.
addendum = 1*m #mm
t = 17.
T = 49.
#Solution:
#Number of pairs of teeth in contact:
#Calculating the pitch circle radius of pinion
r = m*t/2 #mm
#Calculating the pitch circle radius of gear
R = m*T/2 #mm
#Calculating the radius of addendum circle of pinion
rA = r+addendum #mm
#Calculating the radius of addendum circle of gear
RA = R+addendum #mm
#Calculating the length of path of approach
#Refer Fig. 12.11
KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) #mm
#Calculating the length of path of recess
PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) #mm
#Calculating the length of path of contact
KL = KP+PL #mm
#Calculating the length of arc of contact
Lac = KL/math.cos(math.radians(phi)) #Length of arc of contact mm
#Calculating the circular pitch
pc = math.pi*m #mm
#Calculating the number of pairs of teeth in contact
n = Lac/pc #Number of pairs of teeth in contact
#Angle turned by the pinion and gear wheel when one pair of teeth is in contact:
#Calculating the angle turned through by the pinion
anglep = Lac*360/(2*math.pi*r) #Angle turned through by the pinion degrees
#Calculating the angle turned through by the wheel
angleg = Lac*360/(2*math.pi*R) #Angle turned through by the gear wheel degrees
#Ratio of sliding to rolling motion:
#At the instant when the tip of a tooth on the larger wheel is just making contact with its mating teeth
r1 = ((1+t/T)*KP)/r #Ratio of sliding velocity to rolling velocity
#At the instant when the tip of a tooth on a larger wheel is just leaving contact with its mating teeth
r2 = ((1+t/T)*PL)/r #Ratio of sliding velocity to rolling velocity
#Results:
print " Number of pairs of teeth in contact = %.f."%(n)
print " Angle turned through by the pinion = %.1f degrees."%(anglep)
print " Angle turned through by the gear wheel = %.f degrees."%(angleg)
print " At the instant when the tip of a tooth on the larger wheel is just\
making contact with its mating teeth, ratio of sliding \nvelocity to rolling velocity = %.2f."%(r1)
print " At the instant when the tip of a tooth on a larger wheel is just leaving contact\
with its mating teeth, ratio of sliding velocity to rolling velocity = %.3f."%(r2)
```

In [16]:

```
import math
# Variables:
t = 18.
T = 72.
phi = 20. #degrees
m = 4. #mm
addendump = 8.5 #Addendum on pinion mm
addendumg = 3.5 #Addendum on gear mm
#SOlution:
#Refer Fig. 12.12
#Calculating the pitch circle radius of the pinion
r = m*t/2 #mm
#Calculating the pitch circle radius of the gear
R = m*T/2 #mm
#Calculating the radius of addendum circle of the pinion
rA = r+addendump #mm
#Calculating the radius of addendum circle of the gear
RA = R-addendumg #mm
#Calculating the radius of the base circle of the pinion
O1M = r*math.cos(math.radians(phi)) #mm
#Calculating the radius of the base circle of the gear
O2N = R*math.cos(math.radians(phi)) #mm
#Calculating the length of path of approach
KP = R*math.sin(math.radians(phi))-math.sqrt(RA**2-O2N**2) #mm
#Calculating the length of path of recess
PL = math.sqrt(rA**2-O1M**2)-r*math.sin(math.radians(phi)) #mm
#Calculating the length of the path of contact
KL = KP+PL #mm
#Results:
print " Length of the path of contact, KL = %.2f mm."%(KL)
```

In [18]:

```
import math
# Variables:
t = 20.
T = 40.
m = 10. #mm
phi = 20. #degrees
#Solution:
#Addendum height for each gear wheel:
#Calculating the pitch circle radius of the smaller gear wheel
r = m*t/2 #mm
#Calculating the pitch circle radius of the larger wheel
R = m*T/2 #mm
#Calculating the radius of addendum circle for the larger gear wheel
RA = math.sqrt((r*math.sin(math.radians(phi))/2+R*math.sin(math.radians(phi)))**2+R**2*(math.cos(math.radians(phi)))**2) #mm
#Calculating the addendum height for larger gear wheel
addendumg = RA-R #mm
#Calculating the radius of addendum circle for the smaller gear wheel
rA = math.sqrt((R*math.sin(math.radians(phi))/2+r*math.sin(math.radians(phi)))**2+r**2*(math.cos(math.radians(phi)))**2) #mm
#Calculating the addendum height for smaller gear wheel
addendump = rA-r #mm
#Calculating the length of the path of contact
Lpc = (r+R)*math.sin(math.radians(phi))/2 #Length of the path of contact mm
#Calculating the length of the arc of contact
Lac = Lpc/math.cos(math.radians(phi)) #Length of the arc of contact mm
#Contact ratio:
#Calculating the circular pitch
pc = math.pi*m #mm
#Calculating the contact ratio
CR = Lpc/pc #Contact ratio
#Results:
print " Addendum height for larger gear wheel = %.1f mm."%(addendumg)
print " Addendum height for smaller gear wheel = %.1f mm."%(addendump)
print " Length of the path of contact = %.1f mm."%(Lpc)
print " Length of the arc of contact = %.1f mm."%(Lac)
print " Contact ratio = %d."%(CR+1)
# book answer is wrong for 2nd
```

In [20]:

```
import math
# Variables:
G = 3.
phi = 20. #degrees
Aw = 1. #module
#Solution:
#Calculating the minimum number of teeth for a gear ratio of 3:1
t1 = (2*Aw)/(G*(math.sqrt(1+1/G*(1/G+2)*(math.sin(math.radians(phi)))**2)-1))
#Calculating the minimum number of teeth for equal wheel
t2 = (2*Aw)/(math.sqrt(1+3*(math.sin(math.radians(phi)))**2)-1)
#Results:
print " Minimum number of teeth for a gear ratio of 3:1, t = %.f."%(t1+1)
print " Minimum number of teeth for equal wheel, t = %d."%(t2+1)
```

In [26]:

```
import math
import numpy
# Variables:
G = 4.
phi = 14.5 #degrees
#Solution:
#Least number of teeth on each wheel:
#Calculating the least number of teeth on the pinion
t = 2*math.pi/(math.tan(math.radians(phi)))
#Calculating the least number of teeth on the gear
T = G*t
#Results:
print " Least number of teeth on the pinion, t = %.1f."%(t)
print " Least number of teeth on the gear, T = %.f."%(round(T,-1))
```

In [28]:

```
import math
# Variables:
phi = 16. #degrees
m = 6. #mm
t = 16.
G = 1.75
T = G*t
N1 = 240. #rpm
#Solution:
#Calculating the angular speed of the pinion
omega1 = 2*math.pi*N1/60 #rad/s
#Addenda on pinion and gear wheel:
#Calculating the addendum on pinion
addendump = m*t/2*(math.sqrt(1+T/t*(T/t+2)*(math.sin(math.radians(phi)))**2)-1) #Addendum on pinion mm
#Calculating the addendum on wheel
addendumg = m*T/2*(math.sqrt(1+t/T*(t/T+2)*(math.sin(math.radians(phi)))**2)-1) #Addendum on wheel mm
#Length of path of contact:
#Calculating the pitch circle radius of wheel
R = m*T/2 #mm
#Calculating the pitch circle radius of pinion
r = m*t/2 #mm
#Calculating the addendum circle radius of wheel
RA = R+addendump #mm
#Calculating the addendum circle radius of pinion
rA = r+addendumg #mm
#Calculating the length of path of approach
KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) #mm
#Calculating the length of path of recess
PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) #mm
#Calculating the length of path of contact
KL = KP+PL #mm
#Maximum velocity of sliding of teeth on either side of pitch point:
#Calculating the angular speed of gear wheel
omega2 = omega1/G #rad/s
#Calculating the maximum velocity of sliding of teeth on the left side of pitch point
vmaxl = (omega1+omega2)*KP #Maximum velocity of sliding of teeth on the left side of pitch point mm/s
#Calculating the maximum velocity of sliding of teeth on the right side of pitch point
vmaxr = (omega1+omega2)*PL #Maximum velocity of sliding of teeth on the right side of pitch point mm/s
#Results:
print " Addendum on pinion = %.2f mm."%(addendump)
print " Addendum on wheel = %.2f mm."%(addendumg)
print " Length of path of contact, KL = %.2f mm."%(KL)
print " Maximum velocity of sliding of teeth on the left side of pitch point = %d mm/s."%(vmaxl)
print " Maximum velocity of sliding of teeth on the right side of pitch point = %d mm/s."%(vmaxr)
# rounding error
```

In [30]:

```
import math
# Variables:
phi = 20. #degrees
t = 30.
T = 50.
m = 4.
N1 = 1000. #rpm
#Solution:
#Calculating the angular speed of thr pinion
omega1 = 2*math.pi*N1/60 #rad/s
#Sliding velocities at engagement and at disengagement of a pair of teeth:
#Calculating the addendum of the smaller gear
addendump = m*t/2*(math.sqrt(1+T/t*(T/t+2)*(math.sin(math.radians(phi)))**2)-1) #Addendum of the smaller gear mm
#Calculating the addendum of the larger gear
addendumg = m*T/2*(math.sqrt(1+t/T*(t/T+2)*(math.sin(math.radians(phi)))**2)-1) #Addendum of the larger gear mm
#Calculating the pitch circle radius of the smaller gear
r = m*t/2 #mm
#Calculating the radius of addendum circle of the smaller gear
rA = r+addendump #mm
#Calculating the pitch circle radius of the larer gear
R = m*T/2 #mm
#Calculating the radius of addendum circle of the larger gear
RA = R+addendumg #mm
#Calculating the path of approach
KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) #mm
#Calculating the path of recess
PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) #mm
#Calculating the angular speed of the larger gear
omega2 = omega1*t/T #rad/s
#Calculating the sliding velocity at engagement of a pair of teeth
v1 = (omega1+omega2)*KP #Sliding velocity at engagement of a pair of teeth mm/s
#Calculating the sliding velocity at disengagement of a pair of teeth
v2 = (omega1+omega2)*PL #Sliding velocity at disengagement of a pair of teeth mm/s
#Contact ratio:
#Calculating the length of the arc of contact
Lac = (KP+PL)/math.cos(math.radians(phi)) #mm
#Calculating the circular pitch
pc = math.pi*m #Circular pitch mm
#Calculating the contact ratio
CR = Lac/pc #Contact ratio
#Results:
print " Sliding velocity at engagement of a pair of teeth = %.3f m/s."%(v1/1000)
print " Sliding velocity at disengagement of a pair of teeth = %.3f m/s."%(v2/1000)
print " Contact ratio = %d."%(CR+1)
# rounding off error
```

In [34]:

```
import math
# Variables:
G = 3.
m = 6.
AP = 1*m
AW = AP #mm
phi = 20. #degrees
N1 = 90. #rpm
#Solution:
#Calculating the angular speed of the pinion
omega1 = 2*math.pi*N1/60 #rad/s
#Calculating the number of teeth on the pinion to avoid interference on it
t = 2*AP/(math.sqrt(1+G*(G+2)*(math.sin(math.radians(phi)))**2)-1)
#Calculating the corresponding number of teeth on the wheel
T = G*t
#Length of path and arc of contact:
#Calculating the pitch circle radius of pinion
r = m*t/2 #mm
#Calculating the radius of addendum circle of pinion
rA = r+AP #mm
#Calculating the pitch circle radius of wheel
R = m*T/2 #mm
#Calculating the radius of addendum circle of wheel
RA = R+AW #mm
#Calculating the path of approach
KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) #mm
#Calculating the path of recess
PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) #mm
#Calculating the length of path of contact
KL = KP+PL #mm
#Calculating the length of arc of contact
Lac = KL/math.cos(math.radians(phi)) #Length of arc of contact mm
#Number of pairs of teeth in contact:
#Calculating the circular pitch
pc = math.pi*m #mm
#Calculating the number of pairs of teeth in contact
n = Lac/pc #Number of pairs of teeth in contact
#Maximum velocity of sliding:
#Calculating the angular speed of wheel
omega2 = omega1*t/T #rad/s
#Calculating the maximum velocity of sliding
vs = (omega1+omega2)*KP #mm/s
#Results:
print " Number of teeth on the pinion to avoid interference, t = %d."%(t+1)
print " Corresponding number of teeth on the wheel, T = %.F."%(T+1)
print " Length of path of contact, KL = %.2f mm."%(KL)
print " Length of arc of contact = %.2f mm."%(Lac)
print " Number of pairs of teeth in contact = %d."%(n+1)
print " Maximum velocity of sliding, vs = %.f mm/s."%(vs)
# ROUNDING ERROR
```

In [41]:

```
import math
# Variables:
T = 20.
d = 125. #mm
r = d/2
OP = r
LH = 6.25 #mm
#Calculating the least pressure angle to avoid interference
phi = math.sin(math.sqrt(LH/r))*180/math.pi #degrees
#Length of arc of contact:
#Calculating the length of path of contact
KL = math.sqrt((OP+LH)**2-(OP*math.cos(math.radians(phi)))**2) #mm
#Calculating the length of arc of contact
Lac = KL/math.cos(math.radians(phi)) #Length of arc of contact mm
#Minimum number of teeth:
#Calculating the circular pitch
pc = math.pi*d/T #mm
#Calculating the number of pairs of teeth in contact
n = Lac/pc #Number of pairs of teeth in contact
#Calculating the minimum number of teeth in contact
nmin = n #Mimimum number of teeth in contact
#Results:
print " Least pressure angle to avoid interference, phi = %.3f degrees."%(phi)
print " Length of arc of contact = %.2f mm."%(Lac)
print " Minimum number of teeth in contact = %d or %d pair."%(nmin+1,(nmin+1)/2)
# rounding error
```

In [45]:

```
from numpy import linalg
from scipy.optimize import fsolve
import math
# Variables:
L = 175./1000
d2 = 100./1000 #m
r2 = d2/2 #m
theta = 70. #degrees
G = 1.5
T2 = 80.
Tf = 75. #Torque on faster wheel N-m
#Solution:
#Spiral angles for each wheel:
#Calculating the number of teeth on slower wheel
T1 = T2*G
#Calculating the pitch circle diameter of the slower wheel
d1 = (L*2)-d2 #m
#Calculating the spiral angles
#We have d2/d1 = (T2*math.cos(alpha1))/(T1*math.cos(alpha2)) or T2*d1*math.cos(alpha1)-T1*d2*math.cos(alpha2) = 0 .....(i)
#Also alpha1+alpha2 = theta or alpha1+alpha2-theta = 0 .....(ii)
def f(x):
alpha1 = x[0]
alpha2 = x[1]
y = [0,0]
y[0] = T2*d1*math.cos(alpha1)-T1*d2*math.cos(alpha2)
y[1] = alpha1+alpha2-theta*math.pi/180
return y
z = fsolve(f,[1,1])
alpha1 = z[0]*180/math.pi #Spiral angle for slower wheel degrees
alpha2 = z[1]*180/math.pi #Spiral angle for faster wheel degrees
#Axial thrust on each shaft:
#Calculating the math.tangential force at faster wheel
F2 = Tf/r2 #N
#Calculating the normal reaction at the point of contact
RN = F2/math.cos(math.radians(alpha2)) #N
#Calculating the axial thrust on the shaft of slower wheel
Fa1 = RN*math.sin(math.radians(alpha1)) #N
#Calculating the axial thrust on the shaft of faster wheel
Fa2 = RN*math.sin(math.radians(alpha2)) #N
#Results:
print " Spiral angle for slower wheel, alpha1 = %.2f degrees."%(alpha1)
print " Spiral angle for faster wheel, alpha2 = %.2f degrees."%(alpha2)
print " Axial thrust on the shaft of slower wheel, Fa1 = %d N."%(Fa1+1)
print " Axial thrust on the shaft of faster wheel, Fa2 = %d N."%(Fa2+1)
```

In [51]:

```
import math
# Variables:
L = 400./1000 #m
G = 3.
theta = 50.
phi = 6. #degrees
pN = 18. #mm
#Solution:
#Number of teeth on each wheel:
#Calculating the spiral angles of the driving and driven wheels
alpha1 = theta/2 #degrees
alpha2 = alpha1 #degrees
#Calculating the number of teeth on driver wheel
T1 = L*1000*2*math.pi/(pN*(1/math.cos(math.radians(alpha1))+G/math.cos(math.radians(alpha2))))
#Calculating the number of teeth on driven wheel
T2 = G*T1
#Calculating the exact centre distance
#L1 = pN*T1/(2*math.pi)*(1/math.cos(math.radians(alpha1))+G/math.cos(math.radians(alpha2))) #mm
L1 = pN*T1/(2*math.pi)*((1+G)/math.cos(math.radians(alpha1))) #mm
#Calculating the efficiency of the drive
eta = (math.cos(math.radians(alpha2+phi))*math.cos(math.radians(alpha1)))/(math.cos(math.radians(alpha1-phi))*math.cos(math.radians(alpha2)))*100 #%
#Results:
print " Number of teeth on driver wheel, T1 = %d."%(T1+1)
print " Number of teeth on driven wheel, T2 = %.f."%(T2+1)
print " Exact centre distance, L1 = %.1f mm."%(L1)
print " Efficiency of the drive, eta = %.1f %%."%(eta)
# rounding off error
```

In [57]:

```
from numpy import linalg
from scipy.optimize import fsolve
import math
# Variables:
pN = 12.5
L = 134. #mm
theta = 80.
phi = 6. #degrees
G = 1.25
#Solution:
#Spiral angle of each wheel:
#Calculating the spiral angles of wheels 1 and 2
#We have d2/d1 = (T2*math.cos(alpha1))/(T1*math.cos(alpha2)) or math.cos(alpha1)-G*math.cos(alpha2) = 0 .....(i)
#Also alpha1+alpha2 = theta or alpha1+alpha2-theta = 0 .....(ii)
def f(x):
alpha1 = x[0]
alpha2 = x[1]
y = [0,0]
y[0] = math.cos(alpha1)-G*math.cos(alpha2)
y[1] = alpha1+alpha2-theta*math.pi/180
return y
z = fsolve(f,[1,1])
alpha1 = z[0]*180/math.pi #Spiral angle for slower wheel degrees
alpha2 = z[1]*180/math.pi #Spiral angle for faster wheel degrees
#Number of teeth on each wheel:
#Calculating the diameters of the wheels
d1 = L
d2 = d1 #mm
#Calculating the number of teeth on wheel 1
T1 = d1*math.pi*math.cos(math.radians(alpha1))/pN
#Calculating the number of teeth on wheel 2
T2 = T1/G
#Calculating the efficiency of the drive
eta = (math.cos(math.radians(alpha2+phi))*math.cos(math.radians(alpha1)))/(math.cos(math.radians(alpha1-phi))*math.cos(math.radians(alpha2)))*100 #%
#Calculating the maximum efficiency
etamax = (math.cos(math.radians(theta+phi))+1)/(math.cos(math.radians(theta-phi))+1)*100 #%
#Results:
print " Spiral angle for slower wheel, alpha1 = %.2f degrees."%(alpha1)
print " Spiral angle for faster wheel, alpha2 = %.2f degrees."%(alpha2)
print " Number of teeth on wheel 1, T1 = %.1f."%(T1)
print " Number of teeth on wheel 2, T2 = %.f."%(T2+1)
print " Efficiency of the drive, eta = %d %%."%(eta+1)
print " Maximum efficiency, etamax = %.1f %%."%(etamax)
```