{
 "metadata": {
  "name": "",
  "signature": "sha256:fa8306a7ccf6683f3bb43ba03db574b371457c13bfcbb27905e40f6b1eacde3b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10 : Torsion"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.1 Page No : 229"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \t\t\t\n",
      "\n",
      "# Variables\n",
      "L = 50. \t\t\t#ft\n",
      "Do = 2 \t\t\t#in\n",
      "Di = 1.5 \t\t\t#in\n",
      "Mt = 10000. \t\t\t#lb in\n",
      "G = 12.*10**6\n",
      "\t\t\t\n",
      "# Calculations\n",
      "Tmax = 16*Mt*Do/(math.pi*(Do**4-Di**4))\n",
      "angle = (Mt*L*12*32)*57.3/(G*math.pi*(Do**4-Di**4))\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'Maximum shearing strees = %.f psi'%(round(Tmax,-1))\n",
      "print  'twist angle = %.1f degrees'%(angle)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum shearing strees = 9310 psi\n",
        "twist angle = 26.7 degrees\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.2 Page No : 229"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables\n",
      "d = 4. \t\t\t#ft\n",
      "T = 5000. \t\t\t#psi\n",
      "angle = 0.1 \t\t\t#degrees\n",
      "\t\t\t\n",
      "# Calculations\n",
      "T1 = (math.pi*d**3)*T/16\n",
      "T2 =angle*math.pi*G*math.pi*d**4/(180*12*32)\n",
      "\t\t\t\n",
      "# Results\n",
      "if (T1<T2): \n",
      "    print  'Safe torque = %.2f lb in'%(T1)\n",
      "else:\n",
      "    print  'Safe torque = %.2f lb'%(T2)\n",
      "\n",
      "# note : anwer is wrong in book. plz check."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Safe torque = 43864.91 lb\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.3 Page No : 229"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import linalg\n",
      "\t\t\t\n",
      "# Variables\n",
      "Ds = 1.  \t\t\t#in\n",
      "Db = 1.5 \t\t\t#in\n",
      "Ls = 4. \t\t\t#in\n",
      "Lb = 6. \t\t\t#in\n",
      "Gs = 12.*10**6 \t\t\t#psi\n",
      "Gb = 6.4*10**6 \t\t\t#psi\n",
      "T = 10000.   \t\t\t#lb in\n",
      "\t\t\t\n",
      "# Calculations\n",
      "A = [[1,1],[(Ls*12/(Gs*Ds**4)),(-Lb*12/(Gb*Db**4))]]\n",
      "b = [T,0]\n",
      "c = linalg.solve(A,b)\n",
      "Tab = c[0]\n",
      "Tbc = c[1]\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'Torque in section AB = %.f lb in'%(Tab)\n",
      "print  'Torque in section AB  = %.f lb in'%(Tbc)\n",
      "\n",
      "# note : Answers are slightly different because of inbuilt solve function of python."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Torque in section AB = 3571 lb in\n",
        "Torque in section AB  = 6429 lb in\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.4 Page No : 230"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables\n",
      "T = 10000. \t\t\t#lb in\n",
      "G = 12.*10**6\n",
      "Dab = 1.5 \t\t\t#in\n",
      "Lab = 4. \t\t\t#in\n",
      "Dcd = 1. \t\t\t#in\n",
      "Lcd = 3. \t\t\t#in\n",
      "\t\t\t\n",
      "# Calculations\n",
      "F = T/2\n",
      "Tab = F*Lab\n",
      "angle = ((T*32*12*Lcd/(G*math.pi*Dcd**4))+2*(Tab*32*12*Lab/(G*math.pi*Dab**4)))*(180/math.pi)\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'angle of twist = %.0f degrees'%(angle)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "angle of twist = 36 degrees\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.5 Page No : 231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables\n",
      "Tallowable = 5000. \t\t\t#psi\n",
      "power = 250. \t    \t\t#hp\n",
      "n = 1800.        \t\t\t#rpm\n",
      "\t\t\t\n",
      "# Calculations\n",
      "T = 63000*power/n\n",
      "d = (16*T/(math.pi*Tallowable))**(1/3.)\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'Torque = %.2f lb in'%(T)\n",
      "print  'diameter =%.2f in'%(d)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Torque = 8750.00 lb in\n",
        "diameter =2.07 in\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.6 Page No : 232"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables\n",
      "ds = 2. \t\t\t#in\n",
      "n = 315. \t\t\t#rpm\n",
      "Gs = 12.*10**6\n",
      "Lab = 5. \t\t\t#in\n",
      "Lbc = 15. \t\t\t#in\n",
      "Pa = 10. \t\t\t#hp\n",
      "Pc = 40. \t\t\t#hp\n",
      "Pb = 50. \t\t\t#hp\n",
      "\t\t\t\n",
      "# Calculations\n",
      "Tab = 63000*Pa/n\n",
      "Tbc = 63000*Pc/n\n",
      "angle = ((32*Tbc*Lbc*12/(math.pi*ds**4*G))-(32*Tab*Lab*12/(math.pi*ds**4*G)))*(180/math.pi)\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'angle of twist of gear C releative to a = %.2f degrees'%(angle)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "angle of twist of gear C releative to a = 4.01 degrees\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.7 Page No : 234"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables\n",
      "k1 = 6.*10**6 \t\t\t#lb in/rad\n",
      "k2 = 3.*10**6 \t\t\t#lb in/rad\n",
      "k3 = 2.*10**6 \t\t\t#lb in/rad\n",
      "T = 10000. \t\t\t#lb in\n",
      "\t\t\t\n",
      "# Calculations\n",
      "ke = 1/((1/k1)+(1/k2)+(1/k3))\n",
      "angle = T*180/(ke*math.pi)\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'equivalent spring constant = %.2e lb in/rad'%(ke)\n",
      "print  'angle of twist d/a = %.2f degrees'%(angle)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "equivalent spring constant = 1.00e+06 lb in/rad\n",
        "angle of twist d/a = 0.57 degrees\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.8 Page No : 234"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables\n",
      "k1 = 2.*10**6 \t\t\t#lb in/rad\n",
      "k2 = 3.*10**6 \t\t\t#lb in/rad\n",
      "T = 20000.   \t\t\t#lb in\n",
      "\t\t\t\n",
      "# Calculations\n",
      "ke = k1+k2\n",
      "angle = T*180/(ke*math.pi)\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'equivalent spring consmath.tant = %.2e lb in/rad'%(ke)\n",
      "print  'angle of twist at B = %.3f degrees'%(angle)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "equivalent spring consmath.tant = 5.00e+06 lb in/rad\n",
        "angle of twist at B = 0.229 degrees\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.9 Page no : 238"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variables\n",
      "n = 10        # coils\n",
      "P = 1200.     # axial load lb\n",
      "R = 2.      \n",
      "K = 1.33      # factor\n",
      "d = 1.\n",
      "\n",
      "# Calculations\n",
      "Tmax = round(K*(16*P*R)/(math.pi*d**3),-2)\n",
      "delta = 64*P*R**3*n/(12*10**6*d**4)\n",
      "\n",
      "# Results\n",
      "print \"Stress = %d psi\"%Tmax\n",
      "print \"The deflection = %.3f in\"%delta\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stress = 16300 psi\n",
        "The deflection = 0.512 in\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.10 Page No : 239"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "di = 0.2 \t\t\t#in\n",
      "dm = 2. \t\t\t#in\n",
      "n = 10.\n",
      "F = 10. \t\t\t#lb\n",
      "G = 12.*10**6\n",
      "\t\t\t\n",
      "# Calculations\n",
      "k = G*di**4/(64*dm**3*n)\n",
      "ke = 1/((1/(k+k))+(1/k)+(1/k))\n",
      "delta = F/ke\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'elongation = %.2f in'%(delta)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "elongation = 6.67 in\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.11 Page No : 241"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables\n",
      "d = 0.5 \t\t\t#in\n",
      "n = 315. \t\t\t#rpm\n",
      "t1 = 5000. \t\t\t#psi\n",
      "r1 = 8. \t\t\t#in\n",
      "r2 = 4. \t\t\t#in \n",
      "n1 = 6.\n",
      "n2 = 4.\n",
      "\t\t\t\n",
      "# Calculations\n",
      "t2 = r2*t1/r1\n",
      "T = r1*n1*(math.pi/4)*d**2*t1+r2*n2*(math.pi/4)*d**2*t2\n",
      "hp = T*n/63000\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'Premissible horsepower = %.f hp'%(hp)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Premissible horsepower = 275 hp\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}