{
 "metadata": {
  "name": "",
  "signature": "sha256:844073ad5c928bfdaf4248256fc5562a2dc71b1c2156a1230e38f2c366a18bf7"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12 : Toothed Gearing"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.1 Page No : 393"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "P = 120.*1000 \t\t\t#W\n",
      "d = 250./1000\n",
      "r = d/2 \t\t\t#m\n",
      "N = 650. \t\t\t#rpm\n",
      "phi = 20. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the gear\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the torque transmitted\n",
      "T = P/omega \t\t\t#N-m\n",
      "#Calculating the math.tangential load on the pinion\n",
      "FT = T/r \t\t\t#N\n",
      "#Calculating the total load due to power transmitted\n",
      "F = FT/(math.cos(math.radians(phi))*1000) \t\t\t#kN\n",
      "\n",
      "#Results:\n",
      "print \" Total load due to power transmitted, F  =  %.2f kN.\"%(F)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Total load due to power transmitted, F  =  15.01 kN.\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.2 Page No : 397"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "T = 40.\n",
      "t = T\n",
      "phi = 20. \t\t\t#degrees\n",
      "m = 6.   \t\t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*m \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = 1.75*pc \t\t\t#Length of arc of contact mm\n",
      "#Calculating the length of path of contact\n",
      "Lpc = Lac*math.cos(phi) \t\t\t#Length of path of contact mm\n",
      "#Calculating the pitch circle radii of each wheel\n",
      "R = m*T/2 \t\t\t#mm\n",
      "r = R \t\t\t#mm\n",
      "#Calculating the radius of the addendum circle of each wheel\n",
      "RA = math.sqrt(R**2*(math.cos(phi))**2+(Lpc/2+R*math.sin(phi))**2) \t\t\t#mm\n",
      "#Calculating the addendum of the wheel\n",
      "Ad = RA-R \t\t\t#Addendum of the wheel mm\n",
      "\n",
      "#Results:\n",
      "print \" Addendum of the wheel  =  %.2f mm.\"%(Ad)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Addendum of the wheel  =  6.17 mm.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.3 Page No : 398"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "t = 30.\n",
      "T = 80.\n",
      "phi = 20. \t\t\t#degrees\n",
      "m = 12. \t\t\t#mm\n",
      "Addendum = 10. \t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Length of path of contact:\n",
      "#Calculating the pitch circle radius of pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of gear\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of pinion\n",
      "rA = r+Addendum \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of gear\n",
      "RA = R+Addendum \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "#Refer Fig. 12.11\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#Length of arc of contact mm\n",
      "#Contact ratio:\n",
      "#Calculating the circular pitch\n",
      "Pc = math.pi*m \t\t\t#mm\n",
      "#Calculating the contact ratio\n",
      "CR = Lac/Pc \t\t\t#Contact ratio\n",
      "\n",
      "#Results:\n",
      "print \" Length of path of contact, KL  =  %.1f mm.\"%(KL)\n",
      "print \" Length of arc of contact  =  %.2f mm.\"%(Lac)\n",
      "print \" Contact ratio  =  %.1f.\"%(CR)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Length of path of contact, KL  =  52.3 mm.\n",
        " Length of arc of contact  =  55.61 mm.\n",
        " Contact ratio  =  1.5.\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.4 Page No : 399"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "phi = 20. \t\t\t#degrees\n",
      "t = 20.\n",
      "G = 2.\n",
      "m = 5. \t\t\t#mm\n",
      "v = 1.2 \t\t\t#m/s\n",
      "addendum = 1*m \t\t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Angle turned through by pinion when one pair of teeth is in mesh:\n",
      "#Calculating the pitch circle radius of pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of wheel\n",
      "R = m*G*t/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of pinion\n",
      "rA = r+addendum \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of wheel\n",
      "RA = R+addendum \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the angle turned by the pinion\n",
      "angle = Lac*360/(2*math.pi*r) \t\t\t#Angle turned by the pinion degrees\n",
      "#Maximum velocity of sliding:\n",
      "#Calculating the angular speed of pinion\n",
      "omega1 = v*1000/r \t\t\t#rad/s\n",
      "#Calculating the angular speed of wheel\n",
      "omega2 = v*1000/R \t\t\t#rad/s\n",
      "#Calculating the maximum velocity of sliding\n",
      "vS = (omega1+omega2)*KP \t\t\t#mm/s\n",
      "\n",
      "#Results:\n",
      "print \" Angle turned through by pinion when one pair of teeth is in mesh  =  %.2f degrees.\"%(angle)\n",
      "print \" Maximum velocity of sliding, vS  =  %.1f mm/s.\"%(vS)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Angle turned through by pinion when one pair of teeth is in mesh  =  29.43 degrees.\n",
        " Maximum velocity of sliding, vS  =  455.3 mm/s.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.5 Page No : 400"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "T = 40.\n",
      "t = 20.\n",
      "N1 = 2000. \t\t\t#rpm\n",
      "phi = 20. \t\t\t#degrees\n",
      "addendum = 5.\n",
      "m = 5. \t\t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular velocity of the smaller gear\n",
      "omega1 = 2*math.pi*N1/60 \t\t\t#rad/s\n",
      "#Calculating the angular velocity of the larger gear\n",
      "omega2 = omega1*t/T \t\t\t#rad/s\n",
      "#Calculating the pitch circle radius of the smaller gear\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of the larger gear\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of aaddendum circle of smaller gear\n",
      "rA = r+addendum \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of larger gear\n",
      "RA = R+addendum \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the velocity of sliding at the point of engagement\n",
      "vSK = (omega1+omega2)*KP \t\t\t#mm/s\n",
      "#Calculating the velocity of sliding at the point of disengagement\n",
      "vSL = (omega1+omega2)*PL \t\t\t#mm/s\n",
      "#Angle through which the pinion turns:\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#Length of arc of contact mm\n",
      "#Calculating the circumference of pinion\n",
      "C = 2*math.pi*r \t\t\t#Circumference of pinion mm\n",
      "#Calculating the angle through which the pinion turns\n",
      "angle = Lac*360/C \t\t\t#Angle through which the pinion turns degrees\n",
      "\n",
      "#Results:\n",
      "print \" Velocity of sliding at the point of engagement, vSK  =  %.f mm/s.\"%(vSK)\n",
      "print \" Velocity of sliding at the point of disengagement, vsL  =  %.f mm/s.\"%(vSL)\n",
      "print \" Angle through which the pinion turns  =  %.2f degrees.\"%(angle)\n",
      "\n",
      "# answers differ due to rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Velocity of sliding at the point of engagement, vSK  =  3973 mm/s.\n",
        " Velocity of sliding at the point of disengagement, vsL  =  3610 mm/s.\n",
        " Angle through which the pinion turns  =  29.43 degrees.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.6 Page No : 401"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variables:\n",
      "phi = 20. \t\t\t#degrees\n",
      "m = 6.\n",
      "addendum = 1*m \t\t\t#mm\n",
      "t = 17.\n",
      "T = 49.\n",
      "\n",
      "#Solution:\n",
      "#Number of pairs of teeth in contact:\n",
      "#Calculating the pitch circle radius of pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of gear\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of pinion\n",
      "rA = r+addendum \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of gear\n",
      "RA = R+addendum \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "#Refer Fig. 12.11\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#Length of arc of contact mm\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*m \t\t\t#mm\n",
      "#Calculating the number of pairs of teeth in contact\n",
      "n = Lac/pc \t\t\t#Number of pairs of teeth in contact\n",
      "#Angle turned by the pinion and gear wheel when one pair of teeth is in contact:\n",
      "#Calculating the angle turned through by the pinion\n",
      "anglep = Lac*360/(2*math.pi*r) \t\t\t#Angle turned through by the pinion degrees\n",
      "#Calculating the angle turned through by the wheel\n",
      "angleg = Lac*360/(2*math.pi*R) \t\t\t#Angle turned through by the gear wheel degrees\n",
      "#Ratio of sliding to rolling motion:\n",
      "#At the instant when the tip of a tooth on the larger wheel is just making contact with its mating teeth\n",
      "r1 = ((1+t/T)*KP)/r \t\t\t#Ratio of sliding velocity to rolling velocity\n",
      "#At the instant when the tip of a tooth on a larger wheel is just leaving contact with its mating teeth\n",
      "r2 = ((1+t/T)*PL)/r \t\t\t#Ratio of sliding velocity to rolling velocity\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \" Number of pairs of teeth in contact  =  %.f.\"%(n)\n",
      "print \" Angle turned through by the pinion  =  %.1f degrees.\"%(anglep)\n",
      "print \" Angle turned through by the gear wheel  =  %.f degrees.\"%(angleg)\n",
      "print \" At the instant when the tip of a tooth on the larger wheel is just\\\n",
      " making contact with its mating teeth, ratio of sliding \\nvelocity to rolling velocity  =  %.2f.\"%(r1)\n",
      "print \" At the instant when the tip of a tooth on a larger wheel is just leaving contact\\\n",
      " with its mating teeth, ratio of sliding velocity to rolling velocity  =  %.3f.\"%(r2)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Number of pairs of teeth in contact  =  2.\n",
        " Angle turned through by the pinion  =  34.6 degrees.\n",
        " Angle turned through by the gear wheel  =  12 degrees.\n",
        " At the instant when the tip of a tooth on the larger wheel is just making contact with its mating teeth, ratio of sliding \n",
        "velocity to rolling velocity  =  0.41.\n",
        " 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  =  0.354.\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.7 Page No : 403"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "t = 18.\n",
      "T = 72.\n",
      "phi = 20. \t\t\t#degrees\n",
      "m = 4. \t\t\t    #mm\n",
      "addendump = 8.5 \t\t\t#Addendum on pinion mm\n",
      "addendumg = 3.5 \t\t\t#Addendum on gear  mm\n",
      "\n",
      "#SOlution:\n",
      "#Refer Fig. 12.12\n",
      "#Calculating the pitch circle radius of the pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of the gear\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of the pinion\n",
      "rA = r+addendump \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of the gear\n",
      "RA = R-addendumg \t\t\t#mm\n",
      "#Calculating the radius of the base circle of the pinion\n",
      "O1M = r*math.cos(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the radius of the base circle of the gear\n",
      "O2N = R*math.cos(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "KP = R*math.sin(math.radians(phi))-math.sqrt(RA**2-O2N**2) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-O1M**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of the path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "\n",
      "#Results:\n",
      "print \" Length of the path of contact, KL  =  %.2f mm.\"%(KL)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Length of the path of contact, KL  =  28.04 mm.\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.8 Page No : 406"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "t = 20.\n",
      "T = 40.\n",
      "m = 10. \t\t\t#mm\n",
      "phi = 20. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Addendum height for each gear wheel:\n",
      "#Calculating the pitch circle radius of the smaller gear wheel\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of the larger wheel\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle for the larger gear wheel\n",
      "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) \t\t\t#mm\n",
      "#Calculating the addendum height for larger gear wheel\n",
      "addendumg = RA-R \t\t\t#mm\n",
      "#Calculating the radius of addendum circle for the smaller gear wheel\n",
      "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) \t\t\t#mm\n",
      "#Calculating the addendum height for smaller gear wheel\n",
      "addendump = rA-r \t\t\t#mm\n",
      "#Calculating the length of the path of contact\n",
      "Lpc = (r+R)*math.sin(math.radians(phi))/2 \t\t\t#Length of the path of contact mm\n",
      "#Calculating the length of the arc of contact\n",
      "Lac = Lpc/math.cos(math.radians(phi)) \t\t\t#Length of the arc of contact mm\n",
      "#Contact ratio:\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*m \t\t\t#mm\n",
      "#Calculating the contact ratio\n",
      "CR = Lpc/pc \t\t\t#Contact ratio\n",
      "\n",
      "#Results:\n",
      "print \" Addendum height for larger gear wheel  =  %.1f mm.\"%(addendumg)\n",
      "print \" Addendum height for smaller gear wheel  =  %.1f mm.\"%(addendump)\n",
      "print \" Length of the path of contact  =  %.1f mm.\"%(Lpc)\n",
      "print \" Length of the arc of contact  =  %.1f mm.\"%(Lac)\n",
      "print \" Contact ratio  =  %d.\"%(CR+1)\n",
      "\n",
      "# book answer is wrong for 2nd  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Addendum height for larger gear wheel  =  6.5 mm.\n",
        " Addendum height for smaller gear wheel  =  16.2 mm.\n",
        " Length of the path of contact  =  51.3 mm.\n",
        " Length of the arc of contact  =  54.6 mm.\n",
        " Contact ratio  =  2.\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.9 Page No : 410"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "G = 3.\n",
      "phi = 20. \t\t\t#degrees\n",
      "Aw = 1. \t\t\t#module\n",
      "\n",
      "#Solution:\n",
      "#Calculating the minimum number of teeth for a gear ratio of 3:1\n",
      "t1 = (2*Aw)/(G*(math.sqrt(1+1/G*(1/G+2)*(math.sin(math.radians(phi)))**2)-1))\n",
      "#Calculating the minimum number of teeth for equal wheel\n",
      "t2 = (2*Aw)/(math.sqrt(1+3*(math.sin(math.radians(phi)))**2)-1)\n",
      "\n",
      "#Results:\n",
      "print \" Minimum number of teeth for a gear ratio of 3:1, t  =  %.f.\"%(t1+1)\n",
      "print \" Minimum number of teeth for equal wheel, t  =  %d.\"%(t2+1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Minimum number of teeth for a gear ratio of 3:1, t  =  16.\n",
        " Minimum number of teeth for equal wheel, t  =  13.\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.10 Page No : 410"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "import numpy\n",
      "\n",
      "# Variables:\n",
      "G = 4.\n",
      "phi = 14.5 \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Least number of teeth on each wheel:\n",
      "#Calculating the least number of teeth on the pinion\n",
      "t = 2*math.pi/(math.tan(math.radians(phi)))\n",
      "#Calculating the least number of teeth on the gear\n",
      "T = G*t\n",
      "\n",
      "#Results:\n",
      "print \" Least number of teeth on the pinion, t  =  %.1f.\"%(t)\n",
      "print \" Least number of teeth on the gear, T  =  %.f.\"%(round(T,-1))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Least number of teeth on the pinion, t  =  24.3.\n",
        " Least number of teeth on the gear, T  =  100.\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.11 Page No : 411"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "phi = 16. \t\t\t#degrees\n",
      "m = 6. \t\t\t    #mm\n",
      "t = 16.\n",
      "G = 1.75\n",
      "T = G*t\n",
      "N1 = 240. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the pinion\n",
      "omega1 = 2*math.pi*N1/60 \t\t\t#rad/s\n",
      "#Addenda on pinion and gear wheel:\n",
      "#Calculating the addendum on pinion\n",
      "addendump = m*t/2*(math.sqrt(1+T/t*(T/t+2)*(math.sin(math.radians(phi)))**2)-1) \t\t\t#Addendum on pinion mm\n",
      "#Calculating the addendum on wheel\n",
      "addendumg = m*T/2*(math.sqrt(1+t/T*(t/T+2)*(math.sin(math.radians(phi)))**2)-1) \t\t\t#Addendum on wheel mm\n",
      "#Length of path of contact:\n",
      "#Calculating the pitch circle radius of wheel\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the addendum circle radius of wheel\n",
      "RA = R+addendump \t\t\t#mm\n",
      "#Calculating the addendum circle radius of pinion\n",
      "rA = r+addendumg \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Maximum velocity of sliding of teeth on either side of pitch point:\n",
      "#Calculating the angular speed of gear wheel\n",
      "omega2 = omega1/G \t\t\t#rad/s\n",
      "#Calculating the maximum velocity of sliding of teeth on the left side of pitch point\n",
      "vmaxl = (omega1+omega2)*KP \t\t\t#Maximum velocity of sliding of teeth on the left side of pitch point mm/s\n",
      "#Calculating the maximum velocity of sliding of teeth on the right side of pitch point\n",
      "vmaxr = (omega1+omega2)*PL \t\t\t#Maximum velocity of sliding of teeth on the right side of pitch point mm/s\n",
      "\n",
      "#Results:\n",
      "print \" Addendum on pinion  =  %.2f mm.\"%(addendump)\n",
      "print \" Addendum on wheel  =  %.2f mm.\"%(addendumg)\n",
      "print \" Length of path of contact, KL  =  %.2f mm.\"%(KL)\n",
      "print \" Maximum velocity of sliding of teeth on the left side of pitch point  =  %d mm/s.\"%(vmaxl)\n",
      "print \" Maximum velocity of sliding of teeth on the right side of pitch point  =  %d mm/s.\"%(vmaxr)\n",
      "\n",
      "# rounding error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Addendum on pinion  =  10.76 mm.\n",
        " Addendum on wheel  =  4.56 mm.\n",
        " Length of path of contact, KL  =  38.39 mm.\n",
        " Maximum velocity of sliding of teeth on the left side of pitch point  =  1044 mm/s.\n",
        " Maximum velocity of sliding of teeth on the right side of pitch point  =  471 mm/s.\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.12 Page No : 412"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "phi = 20. \t\t\t#degrees\n",
      "t = 30.\n",
      "T = 50.\n",
      "m = 4.\n",
      "N1 = 1000. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of thr pinion\n",
      "omega1 = 2*math.pi*N1/60 \t\t\t#rad/s\n",
      "#Sliding velocities at engagement and at disengagement of a pair of teeth:\n",
      "#Calculating the addendum of the smaller gear\n",
      "addendump = m*t/2*(math.sqrt(1+T/t*(T/t+2)*(math.sin(math.radians(phi)))**2)-1) \t\t\t#Addendum of the smaller gear mm\n",
      "#Calculating the addendum of the larger gear\n",
      "addendumg = m*T/2*(math.sqrt(1+t/T*(t/T+2)*(math.sin(math.radians(phi)))**2)-1) \t\t\t#Addendum of the larger gear mm\n",
      "#Calculating the pitch circle radius of the smaller gear\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of the smaller gear\n",
      "rA = r+addendump \t\t\t#mm\n",
      "#Calculating the pitch circle radius of the larer gear\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of the larger gear\n",
      "RA = R+addendumg \t\t\t#mm\n",
      "#Calculating the path of approach\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the angular speed of the larger gear\n",
      "omega2 = omega1*t/T \t\t\t#rad/s\n",
      "#Calculating the sliding velocity at engagement of a pair of teeth\n",
      "v1 = (omega1+omega2)*KP \t\t\t#Sliding velocity at engagement of a pair of teeth mm/s\n",
      "#Calculating the sliding velocity at disengagement of a pair of teeth\n",
      "v2 = (omega1+omega2)*PL \t\t\t#Sliding velocity at disengagement of a pair of teeth mm/s\n",
      "#Contact ratio:\n",
      "#Calculating the length of the arc of contact\n",
      "Lac = (KP+PL)/math.cos(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*m \t\t\t#Circular pitch mm\n",
      "#Calculating the contact ratio\n",
      "CR = Lac/pc \t\t\t#Contact ratio\n",
      "\n",
      "#Results:\n",
      "print \" Sliding velocity at engagement of a pair of teeth  =  %.3f m/s.\"%(v1/1000)\n",
      "print \" Sliding velocity at disengagement of a pair of teeth  =  %.3f m/s.\"%(v2/1000)\n",
      "print \" Contact ratio  =  %d.\"%(CR+1)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Sliding velocity at engagement of a pair of teeth  =  3.438 m/s.\n",
        " Sliding velocity at disengagement of a pair of teeth  =  5.731 m/s.\n",
        " Contact ratio  =  5.\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.13 Page No : 414"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "G = 3.\n",
      "m = 6.\n",
      "AP = 1*m\n",
      "AW = AP \t\t\t#mm\n",
      "phi = 20. \t\t\t#degrees\n",
      "N1 = 90. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the pinion\n",
      "omega1 = 2*math.pi*N1/60 \t\t\t#rad/s\n",
      "#Calculating the number of teeth on the pinion to avoid interference on it\n",
      "t = 2*AP/(math.sqrt(1+G*(G+2)*(math.sin(math.radians(phi)))**2)-1)\n",
      "#Calculating the corresponding number of teeth on the wheel\n",
      "T = G*t\n",
      "#Length of path and arc of contact:\n",
      "#Calculating the pitch circle radius of pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of pinion\n",
      "rA = r+AP \t\t\t#mm\n",
      "#Calculating the pitch circle radius of wheel\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of wheel\n",
      "RA = R+AW \t\t\t#mm\n",
      "#Calculating the path of approach\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#Length of arc of contact mm\n",
      "#Number of pairs of teeth in contact:\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*m \t\t\t#mm\n",
      "#Calculating the number of pairs of teeth in contact\n",
      "n = Lac/pc \t\t\t#Number of pairs of teeth in contact\n",
      "#Maximum velocity of sliding:\n",
      "#Calculating the angular speed of wheel\n",
      "omega2 = omega1*t/T \t\t\t#rad/s\n",
      "#Calculating the maximum velocity of sliding\n",
      "vs = (omega1+omega2)*KP \t\t\t#mm/s\n",
      "\n",
      "#Results:\n",
      "print \" Number of teeth on the pinion to avoid interference, t  =  %d.\"%(t+1)\n",
      "print \" Corresponding number of teeth on the wheel, T  =  %.F.\"%(T+1)\n",
      "print \" Length of path of contact, KL  =  %.2f mm.\"%(KL)\n",
      "print \" Length of arc of contact  =  %.2f mm.\"%(Lac)\n",
      "print \" Number of pairs of teeth in contact  =  %d.\"%(n+1)\n",
      "print \" Maximum velocity of sliding, vs  =  %.f mm/s.\"%(vs)\n",
      "\n",
      "# ROUNDING ERROR"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Number of teeth on the pinion to avoid interference, t  =  19.\n",
        " Corresponding number of teeth on the wheel, T  =  56.\n",
        " Length of path of contact, KL  =  29.24 mm.\n",
        " Length of arc of contact  =  31.12 mm.\n",
        " Number of pairs of teeth in contact  =  2.\n",
        " Maximum velocity of sliding, vs  =  197 mm/s.\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.14 Page No : 416"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "T = 20.\n",
      "d = 125.          #mm\n",
      "r = d/2\n",
      "OP = r\n",
      "LH = 6.25 \t\t\t#mm\n",
      "#Calculating the least pressure angle to avoid interference\n",
      "phi = math.sin(math.sqrt(LH/r))*180/math.pi \t\t\t#degrees\n",
      "#Length of arc of contact:\n",
      "#Calculating the length of path of contact\n",
      "KL = math.sqrt((OP+LH)**2-(OP*math.cos(math.radians(phi)))**2) \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#Length of arc of contact mm\n",
      "#Minimum number of teeth:\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*d/T \t\t\t#mm\n",
      "#Calculating the number of pairs of teeth in contact\n",
      "n = Lac/pc \t\t\t#Number of pairs of teeth in contact\n",
      "#Calculating the minimum number of teeth in contact\n",
      "nmin = n \t\t\t#Mimimum number of teeth in contact\n",
      "\n",
      "#Results:\n",
      "print \" Least pressure angle to avoid interference, phi  =  %.3f degrees.\"%(phi)\n",
      "print \" Length of arc of contact  =  %.2f mm.\"%(Lac)\n",
      "print \" Minimum number of teeth in contact  =  %d or %d pair.\"%(nmin+1,(nmin+1)/2)\n",
      "\n",
      "# rounding error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Least pressure angle to avoid interference, phi  =  17.818 degrees.\n",
        " Length of arc of contact  =  36.17 mm.\n",
        " Minimum number of teeth in contact  =  2 or 1 pair.\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.15 Page No : 421"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import linalg\n",
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "\n",
      "# Variables:\n",
      "L = 175./1000\n",
      "d2 = 100./1000        #m\n",
      "r2 = d2/2 \t\t\t  #m\n",
      "theta = 70. \t\t\t#degrees\n",
      "G = 1.5\n",
      "T2 = 80.\n",
      "Tf = 75. \t\t\t#Torque on faster wheel N-m\n",
      "\n",
      "#Solution:\n",
      "#Spiral angles for each wheel:\n",
      "#Calculating the number of teeth on slower wheel\n",
      "T1 = T2*G\n",
      "#Calculating the pitch circle diameter of the slower wheel\n",
      "d1 = (L*2)-d2 \t\t\t#m\n",
      "#Calculating the spiral angles\n",
      "#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)\n",
      "#Also alpha1+alpha2  =  theta or alpha1+alpha2-theta  =  0                                           .....(ii)\n",
      "def f(x):\n",
      "    alpha1 = x[0]\n",
      "    alpha2 = x[1]\n",
      "    y = [0,0]\n",
      "    y[0] = T2*d1*math.cos(alpha1)-T1*d2*math.cos(alpha2)\n",
      "    y[1] = alpha1+alpha2-theta*math.pi/180\n",
      "    return y\n",
      "    \n",
      "z = fsolve(f,[1,1])\n",
      "alpha1 = z[0]*180/math.pi \t\t\t#Spiral angle for slower wheel degrees \n",
      "alpha2 = z[1]*180/math.pi \t\t\t#Spiral angle for faster wheel degrees\n",
      "#Axial thrust on each shaft:\n",
      "#Calculating the math.tangential force at faster wheel\n",
      "F2 = Tf/r2 \t\t\t#N\n",
      "#Calculating the normal reaction at the point of contact\n",
      "RN = F2/math.cos(math.radians(alpha2)) \t\t\t#N\n",
      "#Calculating the axial thrust on the shaft of slower wheel\n",
      "Fa1 = RN*math.sin(math.radians(alpha1)) \t\t\t#N\n",
      "#Calculating the axial thrust on the shaft of faster wheel\n",
      "Fa2 = RN*math.sin(math.radians(alpha2)) \t\t\t#N\n",
      "\n",
      "#Results:\n",
      "print \" Spiral angle for slower wheel, alpha1  =  %.2f degrees.\"%(alpha1)\n",
      "print \" Spiral angle for faster wheel, alpha2  =  %.2f degrees.\"%(alpha2)\n",
      "print \" Axial thrust on the shaft of slower wheel, Fa1 =  %d N.\"%(Fa1+1)\n",
      "print \" Axial thrust on the shaft of faster wheel, Fa2  =  %d N.\"%(Fa2+1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Spiral angle for slower wheel, alpha1  =  54.65 degrees.\n",
        " Spiral angle for faster wheel, alpha2  =  15.35 degrees.\n",
        " Axial thrust on the shaft of slower wheel, Fa1 =  1269 N.\n",
        " Axial thrust on the shaft of faster wheel, Fa2  =  412 N.\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.16 Page No : 422"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "L = 400./1000 \t\t\t#m\n",
      "G = 3.\n",
      "theta = 50.\n",
      "phi = 6. \t\t\t#degrees\n",
      "pN = 18. \t\t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Number of teeth on each wheel:\n",
      "#Calculating the spiral angles of the driving and driven wheels\n",
      "alpha1 = theta/2 \t\t\t#degrees\n",
      "alpha2 = alpha1 \t\t\t#degrees\n",
      "#Calculating the number of teeth on driver wheel\n",
      "T1 = L*1000*2*math.pi/(pN*(1/math.cos(math.radians(alpha1))+G/math.cos(math.radians(alpha2))))\n",
      "#Calculating the number of teeth on driven wheel\n",
      "T2 = G*T1\n",
      "#Calculating the exact centre distance\n",
      "#L1 = pN*T1/(2*math.pi)*(1/math.cos(math.radians(alpha1))+G/math.cos(math.radians(alpha2))) \t\t\t#mm\n",
      "L1 = pN*T1/(2*math.pi)*((1+G)/math.cos(math.radians(alpha1))) \t\t\t#mm\n",
      "#Calculating the efficiency of the drive\n",
      "eta = (math.cos(math.radians(alpha2+phi))*math.cos(math.radians(alpha1)))/(math.cos(math.radians(alpha1-phi))*math.cos(math.radians(alpha2)))*100 \t\t\t#%\n",
      "\n",
      "#Results:\n",
      "print \" Number of teeth on driver wheel, T1  =  %d.\"%(T1+1)\n",
      "print \" Number of teeth on driven wheel, T2  =  %.f.\"%(T2+1)\n",
      "print \" Exact centre distance, L1  =  %.1f mm.\"%(L1)\n",
      "print \" Efficiency of the drive, eta  =  %.1f %%.\"%(eta)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Number of teeth on driver wheel, T1  =  32.\n",
        " Number of teeth on driven wheel, T2  =  96.\n",
        " Exact centre distance, L1  =  400.0 mm.\n",
        " Efficiency of the drive, eta  =  90.7 %.\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.17 Page No : 423"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import linalg\n",
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "\n",
      "# Variables:\n",
      "pN = 12.5\n",
      "L = 134. \t\t\t#mm\n",
      "theta = 80.\n",
      "phi = 6. \t\t\t#degrees\n",
      "G = 1.25\n",
      "\n",
      "#Solution:\n",
      "#Spiral angle of each wheel:\n",
      "#Calculating the spiral angles of wheels 1 and 2\n",
      "#We have d2/d1  =  (T2*math.cos(alpha1))/(T1*math.cos(alpha2)) or math.cos(alpha1)-G*math.cos(alpha2)  =  0          .....(i)\n",
      "#Also alpha1+alpha2  =  theta or alpha1+alpha2-theta  =  0                                           .....(ii)\n",
      "def f(x):\n",
      "    alpha1 = x[0]\n",
      "    alpha2 = x[1]\n",
      "    y = [0,0]\n",
      "    y[0] = math.cos(alpha1)-G*math.cos(alpha2)\n",
      "    y[1] = alpha1+alpha2-theta*math.pi/180\n",
      "    return y\n",
      "\n",
      "z = fsolve(f,[1,1])\n",
      "alpha1 = z[0]*180/math.pi \t\t\t#Spiral angle for slower wheel degrees\n",
      "alpha2 = z[1]*180/math.pi \t\t\t#Spiral angle for faster wheel degrees\n",
      "#Number of teeth on each wheel:\n",
      "#Calculating the diameters of the wheels\n",
      "d1 = L\n",
      "d2  =  d1 \t\t\t#mm\n",
      "#Calculating the number of teeth on wheel 1\n",
      "T1 = d1*math.pi*math.cos(math.radians(alpha1))/pN\n",
      "#Calculating the number of teeth on wheel 2\n",
      "T2 = T1/G\n",
      "#Calculating the efficiency of the drive\n",
      "eta = (math.cos(math.radians(alpha2+phi))*math.cos(math.radians(alpha1)))/(math.cos(math.radians(alpha1-phi))*math.cos(math.radians(alpha2)))*100 \t\t\t#%\n",
      "#Calculating the maximum efficiency\n",
      "etamax = (math.cos(math.radians(theta+phi))+1)/(math.cos(math.radians(theta-phi))+1)*100 \t\t\t#%\n",
      "\n",
      "#Results:\n",
      "print \" Spiral angle for slower wheel, alpha1  =  %.2f degrees.\"%(alpha1)\n",
      "print \" Spiral angle for faster wheel, alpha2  =  %.2f degrees.\"%(alpha2)\n",
      "print \" Number of teeth on wheel 1, T1  =  %.1f.\"%(T1)\n",
      "print \" Number of teeth on wheel 2, T2  =  %.f.\"%(T2+1)\n",
      "print \" Efficiency of the drive, eta  =  %d %%.\"%(eta+1)\n",
      "print \" Maximum efficiency, etamax  =  %.1f %%.\"%(etamax)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Spiral angle for slower wheel, alpha1  =  32.46 degrees.\n",
        " Spiral angle for faster wheel, alpha2  =  47.54 degrees.\n",
        " Number of teeth on wheel 1, T1  =  28.4.\n",
        " Number of teeth on wheel 2, T2  =  24.\n",
        " Efficiency of the drive, eta  =  83 %.\n",
        " Maximum efficiency, etamax  =  83.9 %.\n"
       ]
      }
     ],
     "prompt_number": 57
    }
   ],
   "metadata": {}
  }
 ]
}