{
 "metadata": {
  "name": "",
  "signature": "sha256:9aca5229d39ed9fee3ce40f1f1dab6ba8b884ebc52bfe9bb1467df97ee1f15bb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4:Torsion"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2 page number 183"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "dia = 10   #diameter of shaft(A-C)\n",
      "c = dia/2  #mm - Radius\n",
      "T = 30     #N/mm -Torque in the shaft \n",
      "#Caliculations\n",
      "\n",
      "J = 3.14*(dia**4)/32      #mm4\n",
      "shear_T = T*c*pow(10,3)/J # The torsion shear in the shaft AC\n",
      "import numpy as np \n",
      "print \"The maximum shear due to torsion is \",round(shear_T,2),\"Mpa\"\n",
      "arr_T = np.zeros((3,3))\n",
      "arr_T[0][1]=round(shear_T,1) #arranging the elements in array\n",
      "arr_T[1][0]=round(shear_T,1)\n",
      "print \"stress tensor matrix\",ceil(arr_T),\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum shear due to torsion is  152.87 Mpa\n",
        "stress tensor matrix [[   0.  153.    0.]\n",
        " [ 153.    0.    0.]\n",
        " [   0.    0.    0.]]\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3 page number 184"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "dia_out = 20      #mm- outer diameter of shaft\n",
      "dia_in  = 16      #mm- inner diameter of shaft \n",
      "c_out = dia_out/2 #mm - outer Radius of shaft  \n",
      "c_in  = dia_in/2  #mm - inner radius of shaft \n",
      "T = 40            #N/mm -Torque in the shaft \n",
      "#caliculations\n",
      "\n",
      "J = 3.14*((dia_out**4)- (dia_in**4))/32 #mm4\n",
      "shear_T_max = T*c_out*pow(10,3)/J       # The maximum torsion shear in the shaft\n",
      "shear_T_min = T*c_in*pow(10,3)/J        # The maximum torsion shear in the shaft\n",
      "print \"The maximum shear due to torsion is \",round(shear_T_max,2),\"Mpa\"\n",
      "print \"The minimum shear due to torsion is \",round(shear_T_min,2),\"Mpa\"\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum shear due to torsion is  43.15 Mpa\n",
        "The minimum shear due to torsion is  34.52 Mpa\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4 page number 187"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "hp = 10         # horse power of motor \n",
      "f = 30          # given \n",
      "shear_T = 55    #Mpa - The maximum shearing in the shaft \n",
      "#caliculations\n",
      "\n",
      "T = 119*hp/f            # N.m The torsion in the shaft \n",
      "#j/c=T/shear_T=K\n",
      "k = T*pow(10,3)/shear_T #mm3\n",
      "#c3=2K/3.14\n",
      "c = pow((2*k/3),0.33)   #mm - The radius of the shaft \n",
      "diamter = 2*c           #mm - The diameter of the shaft\n",
      "print \"The Diameter of the shaft used is\",round(diamter,2),\"mm\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Diameter of the shaft used is 15.26 mm\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5 page number 188"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "hp = 200          #Horse power\n",
      "stress_sh = 10000 #psi- shear stress\n",
      "rpm_1 = 20.0      # The rpm at which this shaft1 operates \n",
      "rpm_2 = 20000.0   # The rpm at which this shaft2 operates\n",
      "T_1= hp*63000.0/rpm_1 #in-lb Torsion due to rpm1\n",
      "T_2= hp*63000/rpm_2   #in-lb Torsion due to rpm1\n",
      "#caliculations \n",
      "\n",
      "#j/c=T/shear_T=K\n",
      "k_1= T_1/stress_sh       #mm3\n",
      "#c3=2K/3.14\n",
      "c_1= pow((2*k_1/3),0.33) #mm - The radius of the shaft \n",
      "diamter_1 = 2*c_1        #mm - The diameter of the shaft\n",
      "print \"The Diameter of the shaft1 is\",round(diamter_1,2),\"mm\"\n",
      "\n",
      "#j/c=T/shear_T=K\n",
      "k_2= T_2/stress_sh       #mm3\n",
      "#c3=2K/3.14\n",
      "c_2= pow((2*k_2/3),0.33) #mm - The radius of the shaft \n",
      "diamter_2 = 2*c_2        #mm - The diameter of the shaft\n",
      "print \"The Diameter of the shaft2 is\",diamter_2,\"mm\"\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Diameter of the shaft1 is 6.87 mm\n",
        "The Diameter of the shaft2 is 0.702590481015 mm\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7 page number 193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "T_ab = 0    #N.m - torsion in AB \n",
      "T_bc = 150  #N.m - torsion in BC\n",
      "T_cd = 150  #N.m - torsion in CD\n",
      "T_de = 1150 #N.m - torsion in DE\n",
      "l_ab = 250 #mm - length of AB\n",
      "l_bc = 200 #mm - length of BC\n",
      "l_cd = 300 #mm - length of cd \n",
      "l_de = 500.0 #mm - length of de\n",
      "d_1 = 25 #mm - outer diameter \n",
      "d_2 = 50 #mm - inner diameter\n",
      "G = 80 #Gpa -shear modulus\n",
      "#Caliculations \n",
      "\n",
      "J_ab = 3.14*(d_1**4)/32           #mm4\n",
      "J_bc = 3.14*(d_1**4)/32           #mm4\n",
      "J_cd = 3.14*(d_2**4 - d_1**4)/32  #mm4\n",
      "J_de = 3.14*(d_2**4 - d_1**4)/32  #mm4\n",
      "rad =  T_ab*l_ab/(J_ab*G)+ T_bc*l_bc/(J_bc*G)+ T_cd*l_cd/(J_cd*G)+ T_de*l_de/(J_de*G) # adding the maximum radians roteted in each module\n",
      "print \"The maximum angle rotated is \",rad,\"radians \" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum angle rotated is  0.0232628450106 radians \n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9 Pagenumber 196"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given \n",
      "#its a statistally indeterminant \n",
      "#we will take of one of the support \n",
      "#Given \n",
      "T_ab = 0    #N.m - torsion in AB \n",
      "T_bc = 150  #N.m - torsion in BC\n",
      "T_cd = 150  #N.m - torsion in CD\n",
      "T_de = 1150 #N.m - torsion in DE\n",
      "l_ab = 250  #mm - length of AB\n",
      "l_bc = 200  #mm - length of BC\n",
      "l_cd = 300  #mm - length of cd \n",
      "l_de = 500.0#mm - length of de\n",
      "d_1 = 25 #mm - outer diameter \n",
      "d_2 = 50 #mm - inner diameter\n",
      "#Caliculations \n",
      "\n",
      "J_ab = 3.14*(d_1**4)/32          #mm4\n",
      "J_bc = 3.14*(d_1**4)/32          #mm4\n",
      "J_cd = 3.14*(d_2**4 - d_1**4)/32 #mm4\n",
      "J_de = 3.14*(d_2**4 - d_1**4)/32 #mm4\n",
      "G = 80 #Gpa -shear modulus\n",
      "rad =  T_ab*l_ab/(J_ab*G)+ T_bc*l_bc/(J_bc*G)+ T_cd*l_cd/(J_cd*G)+ T_de*l_de/(J_de*G) \n",
      "#now lets consider T_A then the torsion is only T_A\n",
      "# T_A*(l_ab/(J_ab*G)+ l_bc/(J_bc*G)+ l_cd/(J_cd*G)+ l_de/(J_de*G)) +rad = 0\n",
      "# since there will be no displacement \n",
      "T_A =-rad/(l_ab/(J_ab*G)+ l_bc/(J_bc*G)+ l_cd/(J_cd*G)+ l_de/(J_de*G)) #Torsion at A\n",
      "T_B = 1150 - T_A                                                        #n-m F_X = 0 torsion at B\n",
      "print \"The Torsion at rigid end A is\",round(T_A,2),\"N-m\"\n",
      "print \"The Torsion at rigid end B is\",round(T_B,2),\"N-m\"\n",
      "\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Torsion at rigid end A is -141.72 N-m\n",
        "The Torsion at rigid end B is 1291.72 N-m\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12 Pagenumber 202"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "dai_bc =  240   #mm- daimeter of '8'bolt circle \n",
      "dia =  dai_bc/8 #Diameter of each bolt\n",
      "A =  0.25*(dia**2)*3.14 # Area of a bolt\n",
      "S_allow  = 40           #Mpa - The maximum allowable allowable shear stress \n",
      "P_max =  (S_allow)*A    #N - The maximum allowable force \n",
      "D = 120.0               #mm - the distance from central axis \n",
      "T_allow =P_max*D*8      #N-m The allowable torsion on the 8 bolt combination \n",
      "print \"The allowable torsion on the 8 bolt combination\",T_allow ,\"N-m\"\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The allowable torsion on the 8 bolt combination 27129600.0 N-m\n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.15 page number 211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "#AISC MANUALS\n",
      "#approximated by three narrow tubes \n",
      "#J = Bbt^3\n",
      "B = 0.33 # constant mentiones in AISC\n",
      "#three rods \n",
      "\n",
      "#rod_1\n",
      "t_1 = 0.605 #inch - Thickness \n",
      "b =  12.0 #inches - width \n",
      "J_1 = B*b*(t_1**3) #in4 - Torsion constant \n",
      "\n",
      "#rod_2\n",
      "t_2 = 0.605 #inch - Thickness \n",
      "b =  12 #inches - width \n",
      "J_2 = B*b*(t_2**3) #in4 - Torsion constant \n",
      "\n",
      "#rod_3\n",
      "t_3 = 0.390 #inch - Thickness \n",
      "b =  10.91 #inches - width \n",
      "J_3 = B*b*(t_3**3) #in4 - Torsion constant \n",
      "\n",
      "#Equivalent\n",
      "J_eq = J_1+J_2+J_3  #in4 - Torsion constant \n",
      "print \"the Equivalent Torsion constant is \",round(J_eq,2), \"in4\"\n",
      "\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the Equivalent Torsion constant is  1.97 in4\n"
       ]
      }
     ],
     "prompt_number": 57
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.16 page number 214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "dia_out = 10       #mm- outer diameter of shaft\n",
      "dia_in  = 8     #mm- inner diameter of shaft \n",
      "c_out = dia_out/2 #mm - outer Radius of shaft  \n",
      "c_in  = dia_in/2  #mm - inner radius of shaft \n",
      "T = 40            #N/mm -Torque in the shaft \n",
      "#caliculations\n",
      "\n",
      "J = 3.14*((dia_out**4)- (dia_in**4))/32 #mm4\n",
      "shear_T_max = T*c_out*pow(10,3)/J       # The maximum torsion shear in the shaft\n",
      "shear_T_min = T*c_in*pow(10,3)/J        # The maximum torsion shear in the shaft\n",
      "print \"The maximum shear due to torsion is \",round(shear_T_max,2),\"Mpa\"\n",
      "print \"The minimum shear due to torsion is \",round(shear_T_min,2),\"Mpa\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum shear due to torsion is  345.23 Mpa\n",
        "The minimum shear due to torsion is  276.18 Mpa\n"
       ]
      }
     ],
     "prompt_number": 58
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}