{
 "metadata": {
  "name": "chapter 10.ipynb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10:Theory of Failures"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No.10.10.1,Page No.401"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of Variables\n",
      "\n",
      "P_e=300 #N/mm**2 #Elastic Limit in tension\n",
      "FOS=3  #Factor of safety\n",
      "mu=0.3 #Poissoin's ratio\n",
      "P=12*10**3 #N Pull \n",
      "Q=6*10**3 #N #Shear force\n",
      "\n",
      "#Calculations\n",
      "\n",
      "#Let d be the diameter of the shaft\n",
      "\n",
      "#Direct stress\n",
      "#P_x=P*(pi*4**-1*d**3)**-1\n",
      "#After substituting values and further simplifying we get\n",
      "#P_x=48*10**3\n",
      "\n",
      "#Now shear stress at the centre of bolt\n",
      "#q=4*3**-1*q_av\n",
      "#After substituting values and further simplifying we get\n",
      "#q=32*10**3*(pi*d**2)**-1\n",
      "\n",
      "#Principal stresses are\n",
      "#P1=P_x*2**-1+((P_x*2**-1)**2+q**2)**0.5\n",
      "#After substituting values and further simplifying we get\n",
      "#p1=20371.833*(d**2)**-1\n",
      "\n",
      "#P2=P_x*2**-1-((P_x*2**-1)**2+q**2)**0.5\n",
      "#After substituting values and further simplifying we get\n",
      "#P2=-5092.984*(d**2)**-1\n",
      "\n",
      "#q_max=((P_x*2**-1)**2+q**2)**0.5\n",
      "\n",
      "#From Max Principal stress theory\n",
      "#Permissible stress in Tension\n",
      "P1=100 #N/mm**2 \n",
      "d=(20371.833*P1**-1)**0.5\n",
      "\n",
      "#Max strain theory\n",
      "#e_max=P1*E**-1-mu*P2*E**-1\n",
      "#After substituting values and further simplifying we get\n",
      "#e_max=21899.728*(d**2*E)**-1\n",
      "\n",
      "#According to this theory,the design condition is\n",
      "#e_max=P_e*(E*FOS)**-1\n",
      "#After substituting values and further simplifying we get\n",
      "d2=(21899.728*3*300**-1)**0.5  #mm\n",
      "\n",
      "#Max shear stress theory\n",
      "#e_max=shear stress at elastic*(FOS)**-1\n",
      "#After substituting values and further simplifying we get\n",
      "d3=(12732.421*6*300**-1)**0.5 #mm\n",
      "\n",
      "#Result\n",
      "print\"Diameter of Bolt by:Max Principal stress theory\",round(d,2),\"mm\"\n",
      "print\"                   :Max strain theory\",round(d2,2),\"mm\"\n",
      "print\"                   :Max shear stress theory\",round(d3,2),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Diameter of Bolt by:Max Principal stress theory 14.27 mm\n",
        "                   :Max strain theory 14.8 mm\n",
        "                   :Max shear stress theory 15.96 mm\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No.10.10.2.Page No.402"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of Variables\n",
      "\n",
      "M=40*10**6 #N-mm #Bending moment\n",
      "T=10*10**6 #N-mm #TOrque\n",
      "mu=0.25 #Poissoin's ratio\n",
      "P_e=200 #N/mm**2 #Stress at Elastic Limit\n",
      "FOS=2\n",
      "\n",
      "#Calculations\n",
      "\n",
      "#Let d be the diameter of the shaft\n",
      "\n",
      "#Principal stresses are given by\n",
      "\n",
      "#P1=16*(pi*d**3)**-1*(M+(M**2+T**2)**0.5)\n",
      "#After substituting values and further simplifying we get\n",
      "#P1=4.13706*10**8*(d**3)**-1     ............................(1)\n",
      "\n",
      "#P2=16*(pi*d**3)**-1*(M-(M**2+T**2)**0.5)\n",
      "#After substituting values and further simplifying we get\n",
      "#P2=-6269718*(pi*d**3)**-1       ..............................(2)\n",
      "\n",
      "#q_max=(P1-P2)*2**-1\n",
      "#After substituting values and further simplifying we get\n",
      "#q_max=2.09988*10**8*(d**3)**-1\n",
      "\n",
      "#Max Principal stress theory\n",
      "#P1=P_e*(FOS)**-1\n",
      "#After substituting values and further simplifying we get\n",
      "d=(4.13706*10**8*2*200**-1)**0.33333 #mm \n",
      "\n",
      "#Max shear stress theory\n",
      "#q_max=shear stress at elastic limit*(FOS)**-1\n",
      "#After substituting values and further simplifying we get\n",
      "d2=(2.09988*10**8*4*200**-1)**0.33333\n",
      "\n",
      "#Max strain energy theory\n",
      "#P_3=0\n",
      "#P1**2+P2**2-2*mu*P1*P2=P_e**2*(FOS)**-1\n",
      "#After substituting values and further simplifying we get\n",
      "d3=(8.62444*10**12)**0.166666\n",
      "\n",
      "#Result\n",
      "print\"Diameter of shaft according to:MAx Principal stress theory\",round(d,2),\"mm\"\n",
      "print\"                              :Max shear stress theory\",round(d2,2),\"mm\"\n",
      "print\"                              :Max strain energy theory\",round(d3,2),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Diameter of shaft according to:MAx Principal stress theory 160.52 mm\n",
        "                              :Max shear stress theory 161.33 mm\n",
        "                              :Max strain energy theory 143.2 mm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No.10.10.3,Page No.403"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of Variables\n",
      "\n",
      "f_x=40 #N/mm**2 #Internal Fliud Pressure\n",
      "d1=200 #mm #Internal Diameter\n",
      "r1=d1*2**-1 #mm #Radius\n",
      "q=300 #N/mm**2 #Tensile stress\n",
      "\n",
      "#Calculations\n",
      "\n",
      "#From Lame's Equation we have,\n",
      "\n",
      "#Hoop Stress\n",
      "#f_x=b*(x**2)**-1+a    ..........................(1)\n",
      "\n",
      "#Radial Pressure\n",
      "#p_x=b*(x**2)**-1-a      .........................(2)\n",
      "\n",
      "#the boundary conditions are\n",
      "x=d1*2**-1 #mm \n",
      "#After sub values in equation 1 and further simplifying we get\n",
      "#40=b*100**-1-a           ..........................(3)\n",
      "\n",
      "#Max Principal stress theory\n",
      "#q*(FOS)**-1=b*100**2+a           ..................(4)\n",
      "#After sub values in above equation and further simplifying we get\n",
      "\n",
      "#From Equation 3 and 4 we get\n",
      "a=80*2**-1\n",
      "#Sub value of a in equation 3 we get\n",
      "b=(f_x+a)*100**2\n",
      "\n",
      "#At outer edge where x=r_0 pressure is zero\n",
      "r_0=(b*a**-1)**0.5 #mm\n",
      "\n",
      "#thickness\n",
      "t=r_0-r1 #mm\n",
      "\n",
      "#Max shear stress theory\n",
      "P1=b*(100**2)**-1+a #Max hoop stress\n",
      "P2=-40 #pressure at int radius (since P2 is compressive)\n",
      "\n",
      "#Max shear stress\n",
      "q_max=(P1-P2)*2**-1\n",
      "\n",
      "#According max shear theory the design condition is\n",
      "#q_max=P_e*2**-1*(FOS)**-1\n",
      "#After sub values in equation we get and further simplifying we get\n",
      "#80=b*(100**2)**-1+a\n",
      "#After sub values in equation 1 and 3 and further simplifying we get\n",
      "b2=120*100**2*2**-1\n",
      "\n",
      "#from equation(3)\n",
      "a2=120*2**-1-a\n",
      "\n",
      "#At outer radius r_0,radial pressure=0\n",
      "r_02=(b2*a2**-1)**0.5\n",
      "\n",
      "#thickness\n",
      "t2=r_02-r1\n",
      "\n",
      "#Result\n",
      "print\"Thickness of metal by:Max Principal stress theory\",round(t,2),\"mm\"\n",
      "print\"                     :Max shear stress thoery\",round(t2,2),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thickness of metal by:Max Principal stress theory 41.42 mm\n",
        "                     :Max shear stress thoery 73.21 mm\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}