{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10:Strain Transformation"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.1 Page No 491"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "ep_x = 500       #Normal Strain\n",
      "ep_y = -300      #Normal Strain\n",
      "gamma_xy = 200   #Shear Strain\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "theta = 30*(math.pi/180)\n",
      "theta = theta*-1\n",
      "ep_x_new = ((ep_x+ep_y)/2) + ((ep_x - ep_y)/2)*math.cos(2*theta) + (gamma_xy/2)*math.sin(2*theta)\n",
      "gamma_xy_new = -((ep_x - ep_y)/2)*math.sin(2*theta) + (gamma_xy/2)*math.cos(2*theta)\n",
      "gamma_xy_new = 2*gamma_xy_new\n",
      "phi = 60*(math.pi/180)\n",
      "ep_y_new = (ep_x+ep_y)/2 + ((ep_x - ep_y)/2)*math.cos(2*phi) + (gamma_xy/2)*math.sin(2*phi)\n",
      "\n",
      "#Display\n",
      "print'The equivalent strain acting on the element  oriented at 30 degrees clockwise = ',round(ep_y_new,1),\"*10**-6\"\n",
      "print'The equivalent shear strain acting on the element        = ',round(gamma_xy_new,0),\"10**-6\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The equivalent strain acting on the element in the y plain oriented at 30 degrees clockwise =  -13.4 *10**-6\n",
        "The equivalent shear strain acting on the element        =  793.0 10**-6\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.2 Page No 492"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "ep_x = -350.0    #(*10**-6) Normal Strain\n",
      "ep_y = 200.0      #*(10**-6) Normal Strain\n",
      "gamma_xy = 80.0   #*(10**-6) Shear Strain\n",
      "\n",
      "#Calculation\n",
      "#Orientation of the element\n",
      "import math\n",
      "tan_thetap = (gamma_xy)/(ep_x - ep_y)\n",
      "thetap1 =math.atan(tan_thetap)*180/3.14+180\n",
      "thetap=thetap1/2.0\n",
      "\n",
      "#Principal Strains\n",
      "k = (ep_x + ep_y)/2\n",
      "l = (ep_x - ep_y)/2\n",
      "tou = gamma_xy/2\n",
      "R = math.sqrt( (l)**2 + tou**2)\n",
      "ep1 = R + k\n",
      "ep2 = k -R \n",
      "ep_x1 = k + l*math.cos(2*-4.14*3.14/180.0)+ tou*math.sin(2*-4.14*3.14/180.0)\n",
      "\n",
      "#Display\n",
      "print'The orientation of the element in the positive counterclockwise direction =  ',round(thetap,1),\"degree\"\n",
      "print'The principal strains are      ',round(ep1,0),\"*10**-6   and  \",round(ep2,0),\"*10**-6\"\n",
      "print'The principal strain in the new x direction is ',round(ep_x1,0),\"*10**-6\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The orientation of the element in the positive counterclockwise direction =   85.9 degree\n",
        "The principal strains are       203.0 *10**-6   and   -353.0 *10**-6\n",
        "The principal strain in the new x direction is  -353.0 *10**-6\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.3 Page No 493"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "ep_x = -350     #(*10**-6) Normal Strain\n",
      "ep_y = 200.0      #*(10**-6) Normal Strain\n",
      "gamma_xy = 80.0   #*(10**-6) Shear Strain\n",
      "\n",
      "#Orientation of the element\n",
      "import math\n",
      "tan_thetap = -(ep_x - ep_y)/(gamma_xy)\n",
      "thetap1 = math.atan(tan_thetap)*180/3.14+180\n",
      "thetap=thetap1/2.0\n",
      "\n",
      "#Maximum in-plane shear strain\n",
      "l = (ep_x - ep_y)/2\n",
      "tou = gamma_xy/2\n",
      "R = sqrt( l**2 + tou**2)\n",
      "max_inplane_strain = 2*R\n",
      "gamma_xy_1 = (-l*math.sin(2*thetap1)+ tou*math.cos(2*thetap1))*2\n",
      "strain_avg = (ep_x + ep_y)/2\n",
      "thetap1 = thetap1*(180/math.pi)\n",
      "thetap2 = (90 + thetap1)\n",
      "\n",
      "#Display\n",
      "print'The orientation of the element            =',round(thetap,0,),\"degre\"\n",
      "print'The maximum in-plane shear strain         = ',round(max_inplane_strain,0),\"*10**-6\"\n",
      "print'The average strain                        =',strain_avg,\"*10**-6\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The orientation of the element            = 131.0 degre\n",
        "The maximum in-plane shear strain         =  556.0 *10**-6\n",
        "The average strain                        = -75.0 *10**-6\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.4 Page No 496"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "ep_x = 250.0        #(*10**-6) Normal Strain\n",
      "ep_y = -150.0       #*(10**-6) Normal Strain\n",
      "gamma_xy = 120.0     #*(10**-6) Shear Strain\n",
      "\n",
      "#Calculation\n",
      "#Construction of the circle\n",
      "import math\n",
      "strain_avg = (ep_x + ep_y)/2\n",
      "tou = gamma_xy/2\n",
      "R = sqrt((ep_x - strain_avg)**2 + (tou**2))\n",
      "#Principal Strains\n",
      "ep1 = (strain_avg + R)\n",
      "ep2 = (strain_avg - R)\n",
      "tan_thetap = (tou)/(ep_x - strain_avg)\n",
      "thetap1 = (math.atan(tan_thetap))/2.0\n",
      "thetap1 = thetap1*(180/math.pi)\n",
      "\n",
      "#Display\n",
      "print'The principal strains are    =  ',round(ep1,0),\"*10**-6    and   \",round(ep2,0),\"*10**-6\"\n",
      "print'The orientation of the element  = ',round(thetap1,2),\"degree\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The principal strains are    =   259.0 *10**-6    and    -159.0 *10**-6\n",
        "The orientation of the element  =  8.35 degree\n"
       ]
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.5 Page No 497"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "ep_x = 250     #(*10**-6) Normal Strain\n",
      "ep_y = -150    #*(10**-6) Normal Strain\n",
      "gamma_xy = 120 #*(10**-6) Shear Strain\n",
      "\n",
      "#calculation\n",
      "#Orientation of the element\n",
      "thetas = 90 - 2*8.35\n",
      "thetas1 = thetas/2\n",
      "#Maximum in-plane shear strain\n",
      "l = (ep_x - ep_y)/2\n",
      "tou = gamma_xy/2\n",
      "R = sqrt( l**2 + tou**2)\n",
      "max_inplane_strain = 2*R\n",
      "strain_avg = (ep_x + ep_y)/2\n",
      "\n",
      "#Display\n",
      "print'The orientation of the element    ',thetas1,\"degree\"\n",
      "print'The maximum in-plane shear strain',round(max_inplane_strain,0),\"*10**-6\"\n",
      "print'The average strain    = ',strain_avg,\"*10**-6\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The orientation of the element     36.65 degree\n",
        "The maximum in-plane shear strain 418.0 *10**-6\n",
        "The average strain    =  50 *10**-6\n"
       ]
      }
     ],
     "prompt_number": 56
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.6 Page No 498"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "ep_x = -300       #(*10**-6) Normal Strain\n",
      "ep_y = -100       #*(10**-6) Normal Strain\n",
      "gamma_xy = 100     #*(10**-6) Shear Strain\n",
      "theta = 20 #degrees\n",
      "\n",
      "#Calculation\n",
      "#Construction of the circle\n",
      "import math\n",
      "strain_avg = (ep_x+ ep_y)/2.0\n",
      "tou = gamma_xy/2.0\n",
      "R = sqrt((-ep_x + strain_avg)**2 + tou**2)\n",
      "#Strains on Inclined Element\n",
      "theta1 = 2*theta\n",
      "phi = math.atan((tou)/(-ep_x +strain_avg))\n",
      "phi = phi*(180/math.pi)\n",
      "psi = theta1 - phi\n",
      "psi = psi*(math.pi/180)\n",
      "ep_x1 = -(-strain_avg+ R*math.cos(psi))\n",
      "gamma_xy1 = -(R*math.sin(psi))*2\n",
      "ep_y1 = -(-strain_avg - R*math.cos(psi))\n",
      "\n",
      "#Display\n",
      "print'The normal strain in the new x direction       = ',round(ep_x1,0),\"10**-6\"\n",
      "print'The normal strain in the new y direction       =  ',round(ep_y1,1),\"10**-6\"\n",
      "print'The shear strain in the new xy direction       =  ',round(gamma_xy1,0),\"10**-6\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The normal strain in the new x direction       =  -309.0 10**-6\n",
        "The normal strain in the new y direction       =   -91.3 10**-6\n",
        "The shear strain in the new xy direction       =   -52.0 10**-6\n"
       ]
      }
     ],
     "prompt_number": 62
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.7 Page No 503"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "ep_x = -400         #(*10**-6) Normal Strain\n",
      "ep_y = 200          #*(10**-6) Normal Strain\n",
      "gamma_xy = 150      #*(10**-6) Shear Strain\n",
      "\n",
      "#calculation\n",
      "#Maximum in-plane Shear Strain\n",
      "strain_avg = (ep_x+ ep_y)/2\n",
      "tou = gamma_xy/2\n",
      "R = sqrt((-ep_x + strain_avg)**2 + tou**2) \n",
      "strain_max = strain_avg + R\n",
      "strain_min = strain_avg - R\n",
      "max_shear_strain = strain_max - strain_min\n",
      "#Absolute Maximum Shear Strain\n",
      "abs_max_shear = max_shear_strain\n",
      "\n",
      "#Display\n",
      "print'The maximum in-plane shear strain= ',round(max_shear_strain,0),\"10**-6\"\n",
      "print'The absolute maximum shear strain  ',round(abs_max_shear,0),\"10**-6\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum in-plane shear strain=  618.0 10**-6\n",
        "The absolute maximum shear strain   618.0 10**-6\n"
       ]
      }
     ],
     "prompt_number": 66
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.8 Page No 505"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "import math\n",
      "ep_a = 60.0    #(*10**-6) Normal Strain\n",
      "ep_b = 135.0   #*(10**-6) Normal Strain\n",
      "ep_c = 264.0   #*(10**-6) Normal Strain\n",
      "theta_a = 0\n",
      "theta_b = 60*(math.pi/180)\n",
      "theta_c = 120*(math.pi/180)\n",
      "\n",
      "#Calculation\n",
      "a1 = (math.cos(theta_a))**2\n",
      "b1 = (math.sin(theta_a))**2\n",
      "c1 = math.cos(theta_a)*math.sin(theta_a)\n",
      "a2 = (math.cos(theta_b))**2\n",
      "b2 = (math.sin(theta_b))**2\n",
      "c2 = math.cos(theta_b)*math.sin(theta_b)\n",
      "a3 = (math.cos(theta_c))**2\n",
      "b3 = (math.sin(theta_c))**2\n",
      "c3 = math.cos(theta_c)*math.sin(theta_c)\n",
      "\n",
      "ep_x = 60       #*10**-6\n",
      "ep_y = 246      #*10**-6\n",
      "gamma_xy = -149 #*10**-6\n",
      "strain_avg = (ep_x + ep_y )/2.0\n",
      "tou = gamma_xy/2.0\n",
      "R = sqrt((-ep_x + strain_avg)**2 + tou**2) \n",
      "ep1 = strain_avg + R\n",
      "ep2 = strain_avg - R\n",
      "tan_thetap =math.atan(-tou/(-ep_x + strain_avg))\n",
      "thetap = tan_thetap/2.0\n",
      "thetap2 = thetap*(180/math.pi)\n",
      "\n",
      "#Display\n",
      "print'The maximum in-plane principal strains are',round(ep1,0),\"*10**-6   and   \",round(ep2,1),\"*10**-6\"\n",
      "print'The angle of orientation  ',round(thetap2,1),\"degree\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum in-plane principal strains are 272.0 *10**-6   and    33.8 *10**-6\n",
        "The angle of orientation   19.3 degree\n"
       ]
      }
     ],
     "prompt_number": 76
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.9 Page No 512"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Given\n",
      "E_st = 200*10**9    #GPa\n",
      "nu_st = 0.3         #Poisson's ratio\n",
      "ep1 = 272 *10**-6\n",
      "ep2 = 33.8 *10**-6\n",
      "\n",
      "#Solving for the equations\n",
      "#6.78*10**-6=sigma2-0.3sigma1\n",
      "#54.4*10**-6=sigma1-0.3sigma2\n",
      "sigma2= 25.4\n",
      "\n",
      "#Display\n",
      "print'The principal stresses at point A are   ',sigma1,\"MPa and \" ,sigma2,\"Mpa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The principal stresses at point A are    62 MPa and  25.4 Mpa\n"
       ]
      }
     ],
     "prompt_number": 79
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.10 Page No 514"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "a = 300.0     #mm\n",
      "b = 50.0     #mm\n",
      "t = 20.0     #mm\n",
      "E_cu = 120*10**3 #MPa\n",
      "nu_cu = 0.34     # Poisson's ratio\n",
      "#By inspection\n",
      "sigma_x = 800    #MPa\n",
      "sigma_y = -500.0   #MPa\n",
      "tou_xy = 0\n",
      "sigma_z = 0\n",
      "\n",
      "#calculation\n",
      "#By Hooke's Law\n",
      "ep_x = (sigma_x/E_cu) - (nu_cu/E_cu)*(sigma_y + sigma_z)\n",
      "ep_y = (sigma_y/E_cu) - (nu_cu/E_cu)*(sigma_x + sigma_z)\n",
      "ep_z = (sigma_z/E_cu) - (nu_cu/E_cu)*(sigma_y + sigma_x)\n",
      "#New lengths\n",
      "a_dash = a + ep_x*a\n",
      "b_dash = b + ep_y*b\n",
      "t_dash = t + ep_z*t\n",
      "\n",
      "#Display\n",
      "print'The new length     = ',round(a_dash,1),\"mm\"\n",
      "print 'The new nas base is',round(b_dash,1),\"mm\"\n",
      "print'The new thickness  = ',round(t_dash,2),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The new length     =  300.4 mm\n",
        "The new nas base is 49.7 mm\n",
        "The new thickness  =  19.98 mm\n"
       ]
      }
     ],
     "prompt_number": 88
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.11 Page No 515"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "p = 20     #psi, pressure\n",
      "E = 600    #psi, pressure\n",
      "nu = 0.45\n",
      "#the given dimension are:\n",
      "a = 4     #in\n",
      "b = 2     #  in\n",
      "c = 3     #in\n",
      "\n",
      "#Calculation\n",
      "#Dilatation\n",
      "sigma_x = -p\n",
      "sigma_y = -p\n",
      "sigma_z = -p\n",
      "e = ((1-2*nu)/E)*(sigma_x + sigma_y + sigma_z)\n",
      "#Change in Length\n",
      "ep = (sigma_x - nu*(sigma_y + sigma_z))/E\n",
      "del_a = ep*a\n",
      "del_b = ep*b\n",
      "del_c = ep*c\n",
      "\n",
      "#Display\n",
      "print'The change in length a      = ',round(del_a,4),\"inch\"\n",
      "print'The change in length b      = ',round(del_b,4),\"inch\"\n",
      "print'The change in length c      = ',round(del_c,4),\"inch\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in length a      =  -0.0133 inch\n",
        "The change in length b      =  -0.0067 inch\n",
        "The change in length c      =  -0.01 inch\n"
       ]
      }
     ],
     "prompt_number": 92
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.12 Page No 526"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Given\n",
      "T = 400      #lbft, tourqe\n",
      "sigma_ult = 20000 #psi\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "x = T*12/(math.pi/2)\n",
      "r=(x/sigma_ult)**(1/3.0)\n",
      "\n",
      "#Display\n",
      "print'The smallest radius of the solid cast iron shaft  ',round(r,3),\"inch\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The smallest radius of the solid cast iron shaft   0.535 inch\n"
       ]
      }
     ],
     "prompt_number": 99
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "EXample 10.13 Page No 527"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "import math\n",
      "sigmay=36         #ksi, stress\n",
      "r = 0.5           #cm\n",
      "sigma_yield = 360 #MPa, yield stress\n",
      "T = 3.25          #kN/cm\n",
      "A= (math.pi*r**2)\n",
      "P = 15            #kN\n",
      "J = (math.pi/2.0)*(r**4)\n",
      "sigma_y_sqr = sigma_yield**2\n",
      "\n",
      "#Calculations\n",
      "sigma_x = -(P/A)\n",
      "sigma_y = 0\n",
      "tou_xy = (T*r)/J\n",
      "k = (sigma_x + sigma_y)/2.0\n",
      "R = sqrt(k**2 + (tou_xy**2))\n",
      "sigma1 = k+R\n",
      "sigma2 = k-R\n",
      "l = sigma1 - sigma2\n",
      "#Maximum Shear Stress Theory\n",
      "x=sigma1-sigma2\n",
      "y=sigma1**2+sigma2**2-sigma1*sigma2\n",
      "if x>sigmay:\n",
      "    print\"Shear failure of material will occur\"\n",
      "else:\n",
      "        print\"not\"\n",
      "if y<sigmay**2:\n",
      "    print\"Failure will not occur\"\n",
      "else:\n",
      "        print\"it will occur\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Shear failure of material will occur\n",
        "Failure will not occur\n"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}