{
 "metadata": {
  "name": "",
  "signature": "sha256:e12f0108acb310aeba000776a82c4a1b31f726cbbe18892055744a39e8eaaef8"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter7-Bending Of Straight Beams"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg270"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the depth of the Beams cross section\n",
      "## initialization of variables\n",
      "import math\n",
      "E=200. ##G Pa\n",
      "Y=250. ##M Pa\n",
      "SF=1.9\n",
      "w=1. ##kN/m\n",
      "L=3. ##m\n",
      "S_max=Y\n",
      "## Calculations\n",
      "E=E*10**9\n",
      "Y=Y*10**6\n",
      "w=w*10**3\n",
      "Mx=-SF*w*L**2/2.\n",
      "S_max=S_max*10**6\n",
      "k=2 ## c_max=h/k\n",
      "##Formula to be used\n",
      "## S_max=abs(Mx)*c_max/Ix\n",
      "## Note that c_max=h/2 and Ix=h^4/24\n",
      "h=(abs(Mx)*24./(k*S_max))**(1./3.)\n",
      "print\"%s %.3f %s\"%('h = ',h,' m')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "h =  0.074  m\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-pg271"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the maxmum tensile and maximum normal stress\n",
      "## initialization of variables\n",
      "import math\n",
      "P1=1.5 ##kN\n",
      "P2=4.5 ##kN\n",
      "## part (a)\n",
      "A=1000. ##mm^2\n",
      "A1=500. ##mm^2\n",
      "A2=500. ##mm^2\n",
      "##calculation\n",
      "A=A*10**-6\n",
      "A1=A1*10**-6\n",
      "A2=A2*10**-6\n",
      "y1=25*10**-3\n",
      "y2=55*10**-3\n",
      "c1=(A1*y1+A2*y2)/A\n",
      "c2=60.*10**-3-c1 ## c1+c2=60 mm\n",
      "y_1=c1-25.*10**-3\n",
      "y_2=c2-5*10**-3\n",
      "b1=50.*10**-3\n",
      "h1=10.*10**-3\n",
      "h2=50.*10**-3\n",
      "b2=10.*10**-3\n",
      "Ix=1/12.*b1*h1**3 + A1*y_1**2 + 1/12.*b2*h2**3 + A2*y_2**2\n",
      "print('part (a)')\n",
      "R1=2550. ##N\n",
      "Vy=750. ##N\n",
      "Mx=975. ##N.m\n",
      "S_zzT=Mx*c1/Ix\n",
      "S_zzC=Mx*(-c2)/Ix\n",
      "print\"%s %.2f %s\"%('\\n Maximum Tensile stress = ',S_zzT/10**6,'MPa')\n",
      "print\"%s %.2f %s\"%('\\n Maximum Compressive stress =',S_zzC/10**6,' MPa')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "part (a)\n",
        "\n",
        " Maximum Tensile stress =  117.00 MPa\n",
        "\n",
        " Maximum Compressive stress = -58.50  MPa\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex3-pg276"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the maximum tensile and compressive stress and stress magnitudes\n",
      "## initialization of variables\n",
      "import math\n",
      "P=12. ##kN\n",
      "Phi=math.pi/3.\n",
      "## calculations\n",
      "L=3. ##m\n",
      "P=12. ##kN\n",
      "A=10000. ##mm^2\n",
      "Ix=39.69*10**6 ##mm^4\n",
      "yo=82. ##mm\n",
      "Iy=30.73*10**6 ##mm^4\n",
      "Ixy=0.\n",
      "P=P*10**3\n",
      "Ix=Ix*10**-12\n",
      "Iy=Iy*10**-12\n",
      "alpha=math.atan(-Ix/(Iy*math.tan(Phi)))\n",
      "M=-L*P\n",
      "Mx=M*math.sin(Phi)\n",
      "yA=-118.*10**-3 ##m\n",
      "xA=-70.*10**-3 ##m\n",
      "xB=-xA\n",
      "yB=82*10**-3 ##m\n",
      "S_A=Mx*(yA-xA*math.tan(alpha))/(Ix-Ixy*math.tan(alpha))\n",
      "S_B=Mx*(yB-xB*math.tan(alpha))/(Ix-Ixy*math.tan(alpha))\n",
      "print\"%s %.2f %s\"%(' Sigma A = ',S_A/10**6,' M Pa \\n')\n",
      "print\"%s %.2f %s\"%(' Sigma B = ',S_B/10**6,' M Pa')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Sigma A =  133.69  M Pa \n",
        "\n",
        " Sigma B =  -105.41  M Pa\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex4-pg277"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the load stress relations derived for nonsymmetrical bending\n",
      "## initialization of variables\n",
      "import math\n",
      "P=4. ##kN\n",
      "L=1.2 ##m\n",
      "A=1900. ##mm**2\n",
      "Ix=2.783*10**6 ##mm**4\n",
      "Iy=1.003*10**6 ##mm**4\n",
      "Ixy=-0.973*10**6 ##mm**4\n",
      "P=P*10**3\n",
      "Ix=Ix*10**-12\n",
      "Iy=Iy*10**-12\n",
      "Ixy=Ixy*10**-12\n",
      "A=1900. ##mm**2\n",
      "xo=19.74 ##mm\n",
      "yo=39.74 ##mm\n",
      "Phi=2.*math.pi/3.\n",
      "Nr=Ixy-Ix/math.tan(Phi)\n",
      "Dr=Iy-Ixy/math.tan(Phi)\n",
      "alpha=math.atan(Nr/Dr)\n",
      "M=L*P\n",
      "Mx=M*math.sin(Phi)\n",
      "yA=39.74*10**-3 ##m\n",
      "xA=-60.26*10**-3 ##m\n",
      "xB=19.74*10**-3\n",
      "yB=-80.26*10**-3 ##m\n",
      "S_A=Mx*(yA-xA*math.tan(alpha))/(Ix-Ixy*math.tan(alpha))\n",
      "S_B=Mx*(yB-xB*math.tan(alpha))/(Ix-Ixy*math.tan(alpha))\n",
      "print('part (a)')\n",
      "print\"%s %.2f %s\"%('\\n Sigma A = ',S_A/10**6,' M Pa \\n')\n",
      "print\"%s %.2f %s\"%(' Sigma B = ',S_B/10**6,' M Pa')\n",
      "\n",
      "## part (b)\n",
      "th=1/2.*math.atan(-2.*Ixy/(Ix-Iy))\n",
      "th1=0.415 ##rad\n",
      "th2=-1.156 ##rad\n",
      "IX=Ix*(math.cos(th1))**2+Iy*(math.sin(th1))**2-2*Ixy*math.sin(th1)*math.cos(th1)\n",
      "IY=Ix+Iy-IX\n",
      "Phi=2*math.pi/3-th1\n",
      "alphA=-IX/(IY*math.tan(Phi))\n",
      "alpha=alphA+th1\n",
      "XA=xA*math.cos(th1)+yA*math.sin(th1)\n",
      "YA=yA*math.cos(th1)-xA*math.sin(th1)\n",
      "XB=xB*math.cos(th1)+yB*math.sin(th1)\n",
      "YB=yB*math.cos(th1)-xB*math.sin(th1)\n",
      "MX=M*math.sin(Phi)\n",
      "MY=-M*math.cos(Phi)\n",
      "S_A=MX*YA/IX-MY*XA/IY\n",
      "S_B=MX*YB/IX-MY*XB/IY\n",
      "print('\\n part (b)')\n",
      "print\"%s %.2f %s\"%('\\n Sigma A = ',S_A/10**6,' M Pa \\n')\n",
      "print\"%s %.2f %s\"%(' Sigma B = ',S_B/10**6,' M Pa')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "part (a)\n",
        "\n",
        " Sigma A =  125.58  M Pa \n",
        "\n",
        " Sigma B =  -108.00  M Pa\n",
        "\n",
        " part (b)\n",
        "\n",
        " Sigma A =  125.57  M Pa \n",
        "\n",
        " Sigma B =  -108.00  M Pa\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5-pg279"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the maximum load\n",
      "## initialization of variables\n",
      "import math\n",
      "A=3085.9 ##mm**2\n",
      "Ix=29.94e-6 ##m**4\n",
      "Iy=4.167e-6 ##m**4\n",
      "Ixy=0.\n",
      "ybar=207.64 ##mm\n",
      "tau_max=165e6 ##Pa\n",
      "##calculations\n",
      "A=A*1e-6\n",
      "ybar=ybar*1e-3\n",
      "Mxk=-6.1*math.cos(math.pi/6.) ## Mx=Mxk*P\n",
      "Myk=-6.1*math.sin(math.pi/6.) ##My=Myk*P\n",
      "## Equation to be followed\n",
      "## S_zz=Mx*y/Ix-My*x/Iy\n",
      "## At A x=100 mm  y=-92.36 mm \n",
      "x=100e-3\n",
      "y=-92.36e-3\n",
      "S_zzA=Mxk*y/Ix-Myk*x/Iy ##Sigma_zz=S_zz*P\n",
      "## At B x=-100 mm  y=-92.36 mm \n",
      "x=-100e-3\n",
      "y=-92.36e-3\n",
      "S_zzB=Mxk*y/Ix-Myk*x/Iy ##Sigma_zz=S_zz*P\n",
      "## At C x=-3.125 mm  y=207.64 mm \n",
      "x=-3.125e-3\n",
      "y=207.64e-3\n",
      "S_zzC=Mxk*y/Ix-Myk*x/Iy ##Sigma_zz=S_zz*P\n",
      "## To find P\n",
      "P=2*tau_max/max(S_zzA,S_zzB,S_zzC)\n",
      "print\"%s %.2f %s\"%('P = ',P/10**3,' kN')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "P =  3.69  kN\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex6-pg282"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the maximum deflection of the beam\n",
      "## initialization of variables\n",
      "import math\n",
      "P=35. ##kN\n",
      "Phi=5.*math.pi/9.\n",
      "E=72e9 ##Pa\n",
      "L=3. ##m\n",
      "Ix=39.69*10**6 ##mm**4\n",
      "Iy=30.73*10**6 ##mm**4\n",
      "Ixy=0.\n",
      "##calculations\n",
      "P=P*1e3\n",
      "Ix=Ix*10**-12\n",
      "Iy=Iy*10**-12\n",
      "alpha=math.atan(-Ix/(Iy*math.tan(Phi)))\n",
      "M=P*L/4.\n",
      "Mx=M*math.sin(Phi)\n",
      "yA=-118.*10**-3 ##m\n",
      "xA=70.*10**-3 ##m\n",
      "xB=-xA\n",
      "yB=82.*10**-3 ##m\n",
      "S_comp=Mx*(yA-xA*math.tan(alpha))/(Ix-Ixy*math.tan(alpha))\n",
      "S_tens=Mx*(yB-xB*math.tan(alpha))/(Ix-Ixy*math.tan(alpha))\n",
      "print\"%s %.2f %s\"%(' Tensile strength = ',S_tens/10**6,' M Pa \\n')\n",
      "print\"%s %.2f %s\"%(' Compressive Strength = ',S_comp/10**6,' M Pa')\n",
      "v=P*L**3*math.sin(Phi)/(48.*E*Ix)\n",
      "u=-v*math.tan(alpha)\n",
      "delta=math.sqrt(u**2+v**2)\n",
      "print\"%s %.2f %s\"%('\\n The total deflection is ',delta*10**3,' mm')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Tensile strength =  63.79  M Pa \n",
        "\n",
        " Compressive Strength =  -87.24  M Pa\n",
        "\n",
        " The total deflection is  6.96  mm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex7-pg283"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the magnitude of P necessary ti intiate yeilding in the beam \n",
      "## initialization of variables\n",
      "import math\n",
      "L=3. ##m\n",
      "Ix=56.43e6 ##mm**4\n",
      "Iy=18.11e6 ##mm**4\n",
      "Ixy=22.72e6 ##mm**4\n",
      "Phi=math.pi/3.\n",
      "E=200e9 ##Pa\n",
      "Y=300e6 ##Pa\n",
      "##calculations\n",
      "Ix=Ix*10**-12\n",
      "Iy=Iy*10**-12\n",
      "Ixy=Ixy*10**-12\n",
      "yA=-120*10**-3 ##m\n",
      "xA=-91.*10**-3 ##m\n",
      "Nr=Ixy-Ix/math.tan(Phi)\n",
      "Dr=Iy-Ixy/math.tan(Phi)\n",
      "alpha=math.atan(Nr/Dr)\n",
      "## M=-L*P To know P we do the following\n",
      "Mxk=-L*math.sin(Phi)##Mx=Mxk*P\n",
      "P=Y*(Ix-Ixy*math.tan(alpha))/(Mxk*(yA-xA*math.tan(alpha)))\n",
      "print\"%s %.2f %s\"%('P =',P/10**3,' kN \\n')\n",
      "v=P*L**3*math.sin(Phi)/(3*E*(Ix-Ixy*math.tan(alpha)))\n",
      "u=-v*math.tan(alpha)\n",
      "delta=math.sqrt(u**2+v**2)\n",
      "print\"%s %.2f %s\"%(' deflection = ',delta*10**3,' mm')\n",
      "## Wrong calculation starting from v in Textbook\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "P = 39.03  kN \n",
        "\n",
        " deflection =  33.24  mm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8-pg284"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the neutral axis orientation and ratio of the maximum tensile stress \n",
      "## initialization of variables\n",
      "import math\n",
      "Ix=937e+06 ##mm^4\n",
      "Iy=18.7e+6 ##mm^4\n",
      "Ixy=0.\n",
      "yA=305 ##mm\n",
      "xA=90.5 ##mm\n",
      "Phi=1.5533 ##rad\n",
      "##calculations\n",
      "Ix=Ix*10**-12\n",
      "Iy=Iy*10**-12\n",
      "Ixy=Ixy*10**-12\n",
      "yA=yA*10**-3 ##m\n",
      "xA=xA*10**-3 ##m\n",
      "alpha=math.atan(-Ix/(Iy*math.tan(Phi)))\n",
      "Mxk=math.sin(Phi) ## Mx=Mxk*M\n",
      "Sigma_Ak1=Mxk*(yA-xA*math.tan(alpha))/(Ix-Ixy*math.tan(alpha)) \n",
      "##Sigma_A=Aigma_Ak*M\n",
      "## When the plane of the loads coincide with the y axes\n",
      "Sigma_Ak2=yA/Ix\n",
      "ratio=Sigma_Ak1/Sigma_Ak2\n",
      "percent=(ratio-1.)*100.\n",
      "print\"%s %.2f %s\"%('alpha = ',alpha,' rad')\n",
      "print\"%s %.2f %s\"%('\\n The maximum stress in the beam is increased ',percent,' percent when the plane of the loads is merely 1 degre from the symmetrical vertical plane')\n",
      "## Wrong alpha given in the textbook\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "alpha =  -0.72  rad\n",
        "\n",
        " The maximum stress in the beam is increased  26.00  percent when the plane of the loads is merely 1 degre from the symmetrical vertical plane\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9-pg286"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the orientation of the neutral axis and plane of the loads\n",
      "## initialization of variables\n",
      "import math\n",
      "Y=280. ##MPa\n",
      "AB=40. ##mm\n",
      "BC=60. ##mm\n",
      "##calculations\n",
      "Y=Y*10**6\n",
      "alpha=math.atan(BC/AB)\n",
      "C11=20./3. ##mm\n",
      "C12=-10. ##mm\n",
      "C21=-20/3. ##mm\n",
      "C22=10. ##mm\n",
      "Beta=math.atan((C11-C21)/(C22-C12))\n",
      "Phi=math.pi/2.+Beta\n",
      "d=math.sqrt((AB/2.-C11)**2+(BC/2.-C22)**2)\n",
      "d=d*10**-3 ##m\n",
      "At=1/2.*AB*BC/2.*10**-6\n",
      "Mp=At*Y*d\n",
      "print\"%s %.2f %s\"%('Mp = ',Mp/10**3,' kN.m')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mp =  4.04  kN.m\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}