{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6:Bending"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.10 Page No 271"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Lab=12.0       #ft, length\n",
      "f=120        #lb/ft , force\n",
      "shear=240    #shear at x=0\n",
      "\n",
      "#Calculation\n",
      "a=f/Lab      #a=w/x\n",
      "x=(shear*2/(a))**(1/2.0)\n",
      "#Moment diagram\n",
      "Mmax=shear*x-(0.5)*(a*x)*x*(1/3.0)*x\n",
      "\n",
      "#Result\n",
      "print\"The Maximum Bending Moment is\",round(Mmax,0),\"lb-ft\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Maximum Bending Moment is 1109.0 lb-ft\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.11 Page No:289"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "b = 6.0         #inch, length\n",
      "h = 12.0        #inch\n",
      "sigma_max = 2.0 #ksi\n",
      "c = b\n",
      "\n",
      "#Part (a):\n",
      "I = (1/12.0)*b*h**3\n",
      "M1 = (sigma_max*I)/(c) #sigma_max = Mc/I Flexure Formula\n",
      "\n",
      "F = (0.5*sigma_max*b*b)\n",
      "c = (2/3.0)*(b) #distance between centroids of each volume.\n",
      "d=2*c          #distance\n",
      "M2 = F*d\n",
      "\n",
      "#Display:\n",
      "print\"The internal moment M calculated using : \"\n",
      "print\"a)The flexure formula = \",M1,\"kip-inch or \",M1/12.0,\"kip-ft\"\n",
      "print\"b)The resultant of the stress distribution using the basic principles \",M2,\"kip-inch or\",M2/12.0,\"kip-ft\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The internal moment M calculated using : \n",
        "a)The flexure formula =  288.0 kip-inch or  24.0 kip-ft\n",
        "b)The resultant of the stress distribution using the basic principles  288.0 kip-inch or 24.0 kip-ft\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.12 Page No:290"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "udl = 5     #kN/m, force\n",
      "l1 = 3        #m , lenght\n",
      "l2 = 6        #m\n",
      "t = 20/1000.0 #mm\n",
      "yb = 0.15   #m\n",
      "\n",
      "#Section Property:\n",
      "I_bar1 = (1/12.0)*(0.25)*(t**3)\n",
      "Ad2 = (0.25)*(0.02)*(yb+(t/2.0))**2\n",
      "I_bar2 = (1/12.0)*(0.02)*(0.3**3)\n",
      "I = 2*(I_bar1 + Ad2) + I_bar2\n",
      "\n",
      "#Bending stress:\n",
      "c = 0.15 + t\n",
      "M= 22.5 #kNm\n",
      "sigma_max = (M*c)/(I*1000)\n",
      "sigma_B = (M*yb)/(I*1000)\n",
      "\n",
      "#Display:\n",
      "print\"The absolute maximum bending stress is \",round(sigma_max,1),\"MPa\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The absolute maximum bending stress is  12.7 MPa\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.13 Page No:291"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "t1 = 15/1000.0 #m, thickness\n",
      "t2 = 20/1000.0 #m\n",
      "l = 250/1000.0 #m\n",
      "b = 200/1000.0 #m\n",
      "P = 2.4        #kN, load\n",
      "l_a = 2        #m\n",
      "l_b = 1        #m\n",
      "\n",
      "#Internal Moment:\n",
      "y1 = b/2.0\n",
      "y2 = t2/2.0\n",
      "A = (2*t1*b)+(t2*l)\n",
      "y_bar = ((2*y1*t1*b)+(y2*t2*l))/A\n",
      "M = (P*l_a)+(1*y_bar)\n",
      "\n",
      "#Section Property:\n",
      "I1 = (1/12.0)*(l*t2**3) + (l*t2*(y_bar - y2)**2)\n",
      "I2 = (1/12.0)*(t1*b**3) + (t1*b*(y1 - y_bar)**2)\n",
      "I =I1+ 2*I2\n",
      "\n",
      "#Maximum Bending Stress:\n",
      "c = b - y_bar\n",
      "sigma_max = (M*c)/(I*1000)\n",
      "\n",
      "#Display:\n",
      "print'The maximum bending stress at section a-a is',round(sigma_max,1),\"MPa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum bending stress at section a-a is 16.2 MPa\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.14 Page No:292"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "b = 60/1000.0    #m, breadth\n",
      "h = 30/1000.0    #m, height\n",
      "M = 40           #Nm, moment\n",
      "c1= h/2.0\n",
      "rib_t = 5/1000.0  #m\n",
      "rib_w = 10/1000.0 #m\n",
      "\n",
      "#Without Ribs:\n",
      "I1 = (1/12.0)*(b*h**3)\n",
      "sigma_max1 = (M*c1)/(I1*10**6)\n",
      "\n",
      "#With Ribs:\n",
      "y1 = c1\n",
      "y2 = h+(rib_t/2.0)\n",
      "A1 = h*b\n",
      "A2 = rib_t*rib_w\n",
      "y_bar = ((y1*A1)+2*(y2*A2))/(A1 + 2*A2)\n",
      "\n",
      "c2 = h+rib_t - y_bar\n",
      "I2 = I1 + (b*h*(y_bar - y1)**2)\n",
      "I3 = (1/12)*rib_w*rib_t**3 + (rib_w*rib_t*(y2 - y_bar)**2)\n",
      "I = I2 + 2*I3\n",
      "sigma_max2 = (M*c2)/(I*10**6)\n",
      "\n",
      "if(sigma_max2>sigma_max1):\n",
      "    print\"The maximum normal stress in the member without ribs\",round(sigma_max1,2),\"MPa\"   \n",
      "    print\"The maximum normal stress in the member with ribs = \",round(sigma_max2,2),\"MPa\"\n",
      "    print\"The ribs should be omitted.\"\n",
      " \n",
      "else:\n",
      "    print\"no\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum normal stress in the member without ribs 4.44 MPa\n",
        "The maximum normal stress in the member with ribs =  4.65 MPa\n",
        "The ribs should be omitted.\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.15 Page No:306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "M = 12     #kNm, moment\n",
      "l_bc = 0.2 #m, length\n",
      "l_be = 0.4 #m\n",
      "\n",
      "#Internal Moment Components:\n",
      "import math\n",
      "My = (-4/5.0)*M\n",
      "Mz = (3/5.0)*M\n",
      "\n",
      "Iy = (1/12.0)*(l_be*l_bc**3)\n",
      "Iz = (1/12.0)*(l_bc*l_be**3) \n",
      "\n",
      "#Bending Stress:\n",
      "sigma_B = (-Mz*1000*(l_be/2.0))/Iz + (My*1000*(-l_bc/2.0))/Iy\n",
      "sigma_B = sigma_B/10.0**6\n",
      "sigma_C = (-Mz*1000*(l_be/2.0))/Iz + (My*1000*(l_bc/2.0))/Iy\n",
      "sigma_C = sigma_C/10.0**6\n",
      "sigma_D = (-Mz*1000*(-l_be/2.0))/Iz + (My*1000*(l_bc/2.0))/Iy\n",
      "sigma_D = sigma_D/10.0**6\n",
      "sigma_E = (-Mz*1000*(-l_be/2.0))/Iz + (My*1000*(-l_bc/2.0))/Iy\n",
      "sigma_E = sigma_E/10.0**6\n",
      "\n",
      "#Orientation of Nuetral Axis:\n",
      "z = (0.45)/(sigma_E + sigma_B)\n",
      "\n",
      "#theta = -atan(4/3.0)\n",
      "import math\n",
      "tanA = (Iz/Iy)*(-4/3.0)\n",
      "alpha = math.atan(tanA)\n",
      "alpha = alpha*(180/math.pi)\n",
      "\n",
      "\n",
      "#Display:\n",
      "print\"The normal stress at B\",sigma_B,\"MPa\"\n",
      "print\"The normal stress at C \",sigma_C,\"MPa\"\n",
      "print\"The normal stress at D \",sigma_D,\"MPa\"\n",
      "print\"The normal stress at E \",sigma_E,\"MPa\"\n",
      "print\"The orientation of the nuetral axis \",round(alpha,1),\"degree\"\n",
      " \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The normal stress at B 2.25 MPa\n",
        "The normal stress at C  -4.95 MPa\n",
        "The normal stress at D  -2.25 MPa\n",
        "The normal stress at E  4.95 MPa\n",
        "The orientation of the nuetral axis  -79.4 degree\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.16 Page No:308"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "import math\n",
      "M =20            #kN, moment\n",
      "Iy = 0.96*10**-3 #m**4, moment of inertia\n",
      "Iz = 7.54*10**-3 #m**4\n",
      "theta = 57.1*(math.pi/180.0)  #angle\n",
      "\n",
      "#Calculation\n",
      "#Internal moment Components:\n",
      "My = M*sin(theta) \n",
      "Mz = M*cos(theta) \n",
      "#Bending Stress:\n",
      "y_p = -0.2 #y Coordinate of P\n",
      "z_p = 0.35 #z Coordinate of P\n",
      "\n",
      "theta1 = (math.pi/2)-(theta)\n",
      "yp = -z_p*math.sin(theta1)+ y_p*math.cos(theta1)\n",
      "zp = z_p*math.cos(theta1) + y_p*math.sin(theta1)\n",
      "\n",
      "#Eq 6-17\n",
      "\n",
      "sigma_p = ((Mz*-yp)/Iz) + ((My*zp)/Iy) \n",
      "sigma_p = sigma_p/10.0**3\n",
      "#Orientation of the Nuetral Axis:\n",
      "alpha = math.atan((Iz/Iy)*math.tan(theta))\n",
      "alpha = alpha*(180/math.pi)\n",
      "\n",
      "#Display:\n",
      "print\"The maximum normal stress at point P is\",round(sigma_p,1),\"Mpa\"\n",
      "print\"The orientation of the nuetral axis is\",round(alpha,1),\"degree\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum normal stress at point P is 3.8 Mpa\n",
        "The orientation of the nuetral axis is 85.3 degree\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.17 Page No:316"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "M = 2       #kNm, moment\n",
      "Ew = 12     #GPa, Pressure\n",
      "Est = 200.0 #GPa\n",
      "bw = 150/1000.0 #m\n",
      "t = 20/1000.0 #m\n",
      "rib = 9/1000.0#m\n",
      "\n",
      "#Section Properties:\n",
      "n = (Ew/Est)\n",
      "bst = n*bw\n",
      "y1 = t/2.0\n",
      "A1 = t*bw\n",
      "y2 = bw/2.0 + t\n",
      "A2 = rib*bw\n",
      "\n",
      "y_bar = (y1*A1 +y2*A2)/(A1+A2)\n",
      "I1 = (1/12.0)*(bw)*(t**3) + A1*(y_bar - y1)**2\n",
      "I2 = (1/12.0)*(rib)*(bw**3) + A2*(y2-y_bar)**2\n",
      "Ina = I1+I2\n",
      "\n",
      "#Normal Stress:\n",
      "sigma_B = (M*(bw+t-y_bar))/(Ina*1000)\n",
      "sigma_C = (M*(y_bar))/(Ina*1000)\n",
      "\n",
      "#Normal Stress in the wood:\n",
      "sigmaB = n*sigma_B\n",
      "\n",
      "#Display:\n",
      "print\"The normal stress at point B = \",round(sigma_B,1),\"MPa\"\n",
      "print\"The normal stress at point C = \",round(sigma_C,1),\"MPa\"\n",
      "print\"The normal stress at point B in the wood =\",round(sigmaB,2),\"MPa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The normal stress at point B =  28.6 MPa\n",
        "The normal stress at point C =  7.8 MPa\n",
        "The normal stress at point B in the wood = 1.71 MPa\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.18 Page No:308"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "M = 60          #kip, moment \n",
      "Est = 29*10**3  #GPa, stress\n",
      "Econc = 3.6*10**3  #GPa\n",
      "d = 25.0        #mm, diameter\n",
      "r = d/2.0    #radius\n",
      "w = 12      #inch, width\n",
      "ht =16      #inch, height\n",
      "\n",
      "#Section Properties:\n",
      "import math\n",
      "n = Est/Econc\n",
      "Ast = 2*math.pi*r**2\n",
      "A = n*Ast\n",
      "\n",
      "#h**2+2.11h-33.7=0\n",
      "#Constants (a,b,c) of quadratic no\n",
      "a=1\n",
      "b=2.11\n",
      "c=-33.7\n",
      "d=b**2-4*a*c\n",
      "x1 = (-b+math.sqrt(b**2-4*a*c))/2*a\n",
      "x2 = (-b-math.sqrt(b**2-4*a*c))/2*a\n",
      "I = (1/12.0)*(w*x1**3) +w*x1*(x1/2.0)**2 + 12.65*(ht - x1)**2\n",
      "\n",
      "#Normal Stress:\n",
      "sigma_conc_max = (M*12*x1)/(I)\n",
      "sigma_conc = (M*12*(ht-x1))/(I)\n",
      "sigma_st = n*sigma_conc\n",
      "\n",
      "#Display:\n",
      "print\"The normal stress in each steel reinforcing rod = \",round(sigma_st,1),\"ksi\"\n",
      "print\"The maximum normal stress in the concrete = \",round(sigma_conc_max,2),\"ksi\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The normal stress in each steel reinforcing rod =  31.9 ksi\n",
        "The maximum normal stress in the concrete =  1.72 ksi\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.19 Page No:324"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "#The given radius are\n",
      "ri = 200/1000.0 #m\n",
      "r1 = 250/1000.0 #m\n",
      "ro = 280/1000.0 #m\n",
      "M = 4 #kNm\n",
      "a = 0.05 #m\n",
      "h = 0.03 #m\n",
      "\n",
      "#Section Properties:\n",
      "import math\n",
      "A1 = a**2 \n",
      "A2 =  (0.5*a*h)\n",
      "A = A1+A2\n",
      "r_avg1 = (r1+ri)/2.0\n",
      "r_avg2 = r1+(h/3.0)\n",
      "r_bar =((r_avg1*A1)+(r_avg2*A2))/A\n",
      "\n",
      "int_dA_r1 = a*math.log(r1/ri)\n",
      "int_dA_r2 = (a*ro*math.log(ro/r1))/(ro-r1) - a\n",
      "R = (A)/(int_dA_r1+ int_dA_r2)\n",
      "k= r_bar - R\n",
      "\n",
      "#Normal Stress:\n",
      "sigma_B = (-M*(R-ri))/(A*ri*k*1000)\n",
      "sigma_A = (-M*(R-ro))/(A*ro*k*1000)\n",
      "sigma = max(abs(sigma_B),abs(sigma_A))\n",
      "\n",
      "#Display:\n",
      "print\"The maximum normal stress in the bar =\",round(sigma,0),\"MPa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum normal stress in the bar = 129.0 MPa\n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.20 Page No:328"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "M = 5         #kNm, moment\n",
      "sigma_y = 500 #MPa, stress\n",
      "r = 16        #mm, radius\n",
      "h = 80.0      #mm, height\n",
      "w = 120        #mm, width\n",
      "r_h = r/h\n",
      "w_h = w/h\n",
      "k = 1.45 \n",
      "c = h/(2000.0)\n",
      "t = 20/1000.0 #m\n",
      "\n",
      "#Calculations:\n",
      "I = (1/12.0)*(t)*(h/1000.0)**3\n",
      "sigma_max = (k*M*c)/(I*1000)\n",
      "\n",
      "#Display:\n",
      "print\"The maximum normal stress in the steel =\",round(sigma_max,0),\"Mpa\"\n",
      " \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum normal stress in the steel = 340.0 Mpa\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.21 Page No:341"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "sigma_y = 36 #ksi, stress\n",
      "t = 0.5       #inch, thickness\n",
      "w = 8       #inch, width\n",
      "h = 9         #inch, height\n",
      "\n",
      "#Maximum Elastic Moment:\n",
      "yy = (h+t)/2.0\n",
      "I1 = (1/12.0)*(w*t**3) + (w*t*yy**2)\n",
      "I = (1/12.0)*(t*h**3) + 2*(I1)\n",
      "c = 5.0 #mm\n",
      "\n",
      "My = (sigma_y*I)/(c) #Flexure Formula\n",
      "#Plastic Moment:\n",
      "C1= sigma_y*t*(h/2.0)\n",
      "C2= sigma_y*t*(w)\n",
      "Mp = (2*2.25*C1) + (2*yy*C2)\n",
      "\n",
      "#Shape Factor:\n",
      "k = Mp/My\n",
      "\n",
      "#Display:\n",
      "print\"The shape factor for the beam = \",round(k,2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The shape factor for the beam =  1.14\n"
       ]
      }
     ],
     "prompt_number": 60
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.22 Page no 342"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "sigma_y = 250 #MPa, bending stress\n",
      "t = 15/1000.0 #m, thickness\n",
      "w = 100/1000.0 #m, width\n",
      "h = 120/1000.0 #m, height\n",
      "c = 10/1000.0 #m\n",
      "\n",
      "#Calculations:\n",
      "d = ((sigma_y*t*w)+(sigma_y*t*h))/(sigma_y*t*2)\n",
      "T = sigma_y*t*d*10**3\n",
      "C1 = sigma_y*t*c*10**3\n",
      "C2 = sigma_y*t*w*10**3\n",
      "Mp = (T*d/2.0)+(C1*c/2.0)+(C2*(c+t/2.0))\n",
      "\n",
      "#Display:\n",
      "print\"The plastic moment that can be resisted by the beam = \",round(Mp,1),\"MPa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The plastic moment that can be resisted by the beam =  29.4 MPa\n"
       ]
      }
     ],
     "prompt_number": 62
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.23 Page no 343"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "sigma_y = 36   #ksi, bending stress\n",
      "t = 12.5       #mm, thickness\n",
      "w = 8          #inch, width\n",
      "h = 9        #inch, height\n",
      "c = (h/2.0)+t\n",
      "I = 211        #inch**4, moment of inertia\n",
      "Mp = 1732.5   #kip\n",
      "\n",
      "#Calculations:\n",
      "sigma_allow = (Mp*c)/(I)\n",
      "y = (sigma_y*c)/(sigma_allow)\n",
      "\n",
      "#Display:\n",
      "print\"The point of zero normal stress = \",round(y,2),\"inch\"\n",
      " \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The point of zero normal stress =  4.38 inch\n"
       ]
      }
     ],
     "prompt_number": 65
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.24,Page no :344"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "ep1 = 0.01      #Strain at top\n",
      "ep2 = 0.05      #strain at bottom\n",
      "sig1 = 150      #kip\n",
      "sig2 = 150     #N/mm**2\n",
      "sig3 = 40      #N/mm**2\n",
      "y = 0.3         #in\n",
      "h = 3           #in\n",
      "w = 2           #in\n",
      "\n",
      "#Calculations:\n",
      "yy = (h/2.0)-y\n",
      "T1 = (1/2.0)*(sig3*yy*w)\n",
      "y1 = y +(2/3.0)*(yy)\n",
      "T2 = yy*sig1*w\n",
      "y2 = y+(0.5*yy)\n",
      "T3 = (0.5*y*sig1*w)\n",
      "y3 = (2/3.0)*(y)\n",
      "M = 2*(T1*y1 + T2*y2 + T3*y3)\n",
      "\n",
      "#Display:\n",
      "print\"The bending moment applied that will cause a strain of \",round(M,0),\"kip in\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The bending moment applied that will cause a strain of  772.0 kip in\n"
       ]
      }
     ],
     "prompt_number": 71
    }
   ],
   "metadata": {}
  }
 ]
}