{
 "metadata": {
  "name": "",
  "signature": "sha256:6a2b99a338c7d2a71ec20bddeaf4c19ec8da980602f4c9834a7faee562a1e5cc"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6:Pure Bending and Bending with Axial force "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.3 page number 293"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "#Entire area - hallow area\n",
      "l_e = 60.0     #mm - length of the entire area\n",
      "b_e = 40       #mm - width of the entire area\n",
      "l_h = 30       #mm - length of the hallow area\n",
      "b_h = 20       #mm - width of the hallow area\n",
      "A_e = l_e*b_e  #mm2 - The entire area\n",
      "A_h = -l_h*b_h #mm2 - The hallow area '-' because its hallow\n",
      "A_re = A_e + A_h #mm2 resultant area\n",
      "y_e = l_e/2      #  mm com from bottom \n",
      "y_h = 20+l_h/2   #mm com from bottom \n",
      "y_com = (A_e*y_e + A_h*y_h)/A_re \n",
      "#moment of inertia caliculatins - bh3/12 +ad2\n",
      "I_e = b_e*(l_e**3)/12 + A_e*((y_e-y_com)**2)  #Parallel axis theorm\n",
      "I_h =  b_h*(l_h**3)/12 - A_h*((y_h-y_com)**2) #Parallel axis theorm\n",
      "I_total = I_e - I_h\n",
      "print \"The moment of inertia of total system is \",I_total,\"mm4\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The moment of inertia of total system is  655000.0 mm4\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.4 page number 295"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "l = 400    #mm - Length \n",
      "b = 300    #mm - breath \n",
      "F = 20     #KN _ the force applied on the beam \n",
      "F_d = 0.75 #KN-m - The force distribution \n",
      "d = 2      #mt - the point of interest from the free end\n",
      "#caliculations \n",
      "#From moment diagram\n",
      "M = F*d - F_d*d*1\n",
      "I = b*(l**3)/12 #mm4 - Bending moment diagram \n",
      "c = l/2         # the stress max at this C\n",
      "S = I/c         #The maximum shear stress \n",
      "shear_max = M*(10**6)/S #MPA -  the maximum stress \n",
      "print \"The maximum stress at 2 mt is\",round(shear_max,2),\"Mpa\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum stress at 2 mt is 4.81 Mpa\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.5 pagr number 297"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "#We will divide this into three parts\n",
      "F = 8   #k - force applied\n",
      "d = 16  #inch -distance\n",
      "l_1 = 1 #in \n",
      "l_2 = 3 #in \n",
      "b_1 = 4 #in \n",
      "b_2 = 1 #in\n",
      "A_1 = l_1* b_1 #in2 - area of part_1\n",
      "y_1 = 0.5      #in com distance from ab\n",
      "A_2 =l_2*b_2   #in2 - area of part_1\n",
      "y_2 = 2.5      #in com distance from ab\n",
      "A_3 = l_2*b_2  #in2 - area of part_1\n",
      "y_3 = 2.5      #in com distance from ab\n",
      "\n",
      "y_net = (A_1*y_1  +A_2*y_2 + A_3*y_3)/(A_1+A_2+A_3) #in - The com of the whole system\n",
      "c_max = (4-y_net)                                   #in - The maximum distace from com to end\n",
      "c_min  = y_net                                      #in - the minimum distance from com to end\n",
      "I_1 = b_1*(l_1**3)/12 + A_1*((y_1-y_net)**2)        #Parallel axis theorm\n",
      "I_2 =  b_2*(l_2**3)/12 + A_2*((y_2-y_net)**2)\n",
      "I_3 =  b_2*(l_2**3)/12 + A_2*((y_2-y_net)**2)\n",
      "I_net = I_1 + I_2 + I_3 #in4 - the total moment of inertia\n",
      "M_c = F*d*c_max \n",
      "stress_cmax = M_c/I_net  #Ksi - The maximum compressive stress\n",
      "\n",
      "M_t= F*d*c_min \n",
      "stress_tmax = M_t/I_net  #Ksi - The maximum tensile stress\n",
      "print \"The maximum tensile stress\",stress_tmax ,\"Ksi\"\n",
      "print \"The maximum compressive stress\",round(stress_cmax,1) ,\"Ksi\"\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum tensile stress 16.0 Ksi\n",
        "The maximum compressive stress 21.6 Ksi\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.8 page number 303"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "#Given \n",
      "#We will divide this into two parts\n",
      "E_w = 10.0  #Gpa - Youngs modulus of wood\n",
      "E_s = 200.0 #Gpa - Youngs modulus of steel\n",
      "M = 30.0    #K.N-m _ applied bending moment \n",
      "n = E_s/E_w \n",
      "l_1 = 250    #mm \n",
      "l_2 = 10     #mm\n",
      "b_1 = 150.0  #mm\n",
      "b_2 = 150.0*n  #mm\n",
      "A_1 = l_1* b_1 #mm2 - area of part_1\n",
      "y_1 = 125.0    #mm com distance from top\n",
      "A_2 =l_2*b_2   #mm2 - area of part_1\n",
      "y_2 = 255.0    #mm com distance from top\n",
      "y_net = (A_1*y_1  +A_2*y_2)/(A_1+A_2)          #mm - The com of the whole system from top\n",
      "I_1 = b_1*(l_1**3)/12.0 + A_1*((y_1-y_net)**2) #Parallel axis theorm\n",
      "I_2 =  b_2*(l_2**3)/12.0 + A_2*((y_2-y_net)**2)\n",
      "I_net = I_1 + I_2  #mm4 - the total moment of inertia\n",
      "c_s= y_net         # The maximum distance in steel \n",
      "stress_steel = M*(10.0**6)*c_s/I_net   #Mpa - The maximum stress in steel \n",
      "\n",
      "c_w= l_1+l_2-y_net                     # The maximum distance in wood \n",
      "stress_wood = n*M*(10.0**6)*c_w/I_net  #MPa - The maximum stress in wood \n",
      "\n",
      "print \"The maximum stress in steel \",round(stress_steel,2) ,\"Mpa\"\n",
      "print \"The maximum stress in wood\",round(stress_wood,2) ,\"Mpa\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum stress in steel  11.49 Mpa\n",
        "The maximum stress in wood 97.09 Mpa\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.9 page number 305"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "M = 50000     #ft-lb , positive bending moment applied\n",
      "N =  9        # number of steel bars \n",
      "n = 15        # The ratio of steel to concrete \n",
      "A_s = 30      #in2 area of steel in concrete\n",
      "#(10*y)*(y/2) = 30*(20-y)\n",
      "#y**2 + 6*y -120\n",
      "#solving quadractic equation \n",
      "import math\n",
      "\n",
      "a = 1\n",
      "b = 6\n",
      "c = -120\n",
      "# calculate the discriminant\n",
      "d = (b**2) - (4*a*c)\n",
      "\n",
      "# find two solutions\n",
      "sol1 = (-b-math.sqrt(d))/(2*a)\n",
      "sol2 = (-b+math.sqrt(d))/(2*a)\n",
      "y = sol2   # Nuetral axis is found\n",
      "l_1 = y    #in- the concrete below nuetral axis is not considered\n",
      "b_1 = 10   #in - width\n",
      "A_1 = l_1* b_1 #in2 - area of concrete\n",
      "y_1 = y/2      #in com of the concrete \n",
      "y_2 = 20-y     #in com of the transformed steel \n",
      "I_1 = b_1*(l_1**3)/12.0 + A_1*((y_1-y)**2) #in4 parallel axis theorm\n",
      "I_2 =   A_s*((y_2)**2) #in4 first part is neglected\n",
      "I_net = I_1 + I_2      #in4 - the total moment of inertia\n",
      "c_c= y                 #in The maximum distance in concrete \n",
      "stress_concrete = M*12*c_c/I_net   #psi - The maximum stress in concrete \n",
      "c_s= 20- y           \n",
      "stress_steel =n*M*12*c_s/I_net     #psi - The maximum stress in concrete \n",
      "print \"The maximum stress in concrete \",round(stress_concrete,2) ,\"psi\"\n",
      "print \"The stress in steel\",round(stress_steel,2) ,\"psi\"\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum stress in concrete  834.07 psi\n",
        "The stress in steel 17427.61 psi\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 6.10 page number 309"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "l = 50.0    #mm - the length of the beam \n",
      "b =  50.0   #mm - the width of the beam\n",
      "M  = 2083   #Nm\n",
      "A = l*b     #mm2 - The area \n",
      "#straight beam \n",
      "I = b*(l**3)/12.0 #mm4 - The moment of inertia of the beam\n",
      "c_1= l/2          # the distance where the stress is maximum \n",
      "c_2 = -l/2        # the distance where the stress is maximum \n",
      "s_1 = I/c_1\n",
      "s_2 = I/c_2\n",
      "stress_max_1 = M*(10**3)/s_1 #Mpa - the maximum strss recorded in the  crossection\n",
      "stress_max_2 = M*(10**3)/s_2 #Mpa - the maximum strss recorded in the  crossection \n",
      "print \"The maximum stress upward in straight case is\",stress_max_1,\"Mpa\"\n",
      "print \"The maximum stress downward in straight case is\",stress_max_2,\"Mpa\"\n",
      "\n",
      "#curved beam \n",
      "import math\n",
      "r = 250.0                 #mm Radius of beam curved \n",
      "r_0 = r - l/2             # inner radius \n",
      "r_1 = r + l/2             # outer radius\n",
      "R = l/(math.log(r_1/r_0)) #mm \n",
      "e = r - R \n",
      "stressr_max_1 = M*(10**3)*(R-r_0)/(r_0*A*e)\n",
      "stressr_max_2 = M*(10**3)*(R-r_1)/(r_1*A*e)\n",
      "print \"The maximum stress upward in curved case is\",stressr_max_1,\"Mpa\"\n",
      "print \"The maximum stress downward in curved case is\",stressr_max_2,\"Mpa\"\n",
      "\n",
      "#curved beam _2 \n",
      "import math\n",
      "r = 75.0      #mm Radius of beam curved \n",
      "r_0 = r - l/2 # inner radius \n",
      "r_1 = r + l/2 # outer radius\n",
      "R = l/(math.log(r_1/r_0)) #mm \n",
      "e = r - R \n",
      "stressr_max_1 = M*(10**3)*(R-r_0)/(r_0*A*e)\n",
      "stressr_max_2 = M*(10**3)*(R-r_1)/(r_1*A*e)\n",
      "print \"The maximum stress upward in curved case2 is\",stressr_max_1,\"Mpa\"\n",
      "print \"The maximum stress downward in curved case2 is\",stressr_max_2,\"Mpa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum stress upward in straight case is 99.984 Mpa\n",
        "The maximum stress downward in straight case is -99.984 Mpa\n",
        "The maximum stress upward in curved case is 107.093207632 Mpa\n",
        "The maximum stress downward in curved case is -93.6813516989 Mpa\n",
        "The maximum stress upward in curved case2 is 128.733538525 Mpa\n",
        "The maximum stress downward in curved case2 is -81.0307692623 Mpa\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page number 6.14 page number 318"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given  \n",
      "#from example 6.9\n",
      "St_ul = 2500 #psi - ultimate strength\n",
      "st_yl = 40000 #psi _ yielding strength \n",
      "b = 10 #in - width from example \n",
      "A = 2 #in2 The area of the steel\n",
      "d = 20 \n",
      "t_ul = st_yl*A #ultimate capasity\n",
      "y = t_ul/(St_ul*b*0.85) #in 0.85 because its customary\n",
      "M_ul = t_ul*(d-y/2)/12 #ft-lb Plastic moment \n",
      "print \"The plastic moment of the system is \",M_ul,\"ft-lb\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The plastic moment of the system is  120784.313725 ft-lb\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.15 page number 231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "#From example 5.8 \n",
      "W = 4.0   #N/m - The force distribution \n",
      "L = 3     # m - The length of the force applied\n",
      "M = W*L/8.0 # KN.m The moment due to force distribution\n",
      "o = 30    # the angle of force applid to horizantal\n",
      "l = 150.0 #mm length of the crossection \n",
      "b = 100.0 #mm - width of the crossection \n",
      "import math \n",
      "M_z = M*(math.cos(3.14/6))\n",
      "M_y = M*(math.sin(math.pi/6))\n",
      "I_z = b*(l**3)/12.0\n",
      "I_y = l*(b**3)/12.0\n",
      "#tanb = I_z /I_y *tan30\n",
      "b = math.atan(math.radians(I_z*math.tan(3.14/6.0)/I_y ))\n",
      "print \"The angle at which nuetral axis locates is\",b,\"radians\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The angle at which nuetral axis locates is 0.0226547191205 radians\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.16 pagenumber 323"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "M = 10                #KN.m - The moment applied\n",
      "I_max = 23.95*(10**6) #mm4 - I_z The moment of inertia\n",
      "I_min = 2.53*(10**6)  #mm4 - I_y The moment of inertia\n",
      "o = 14.34             # degress the principle axis rotated\n",
      "#Coponents of M in Y,Z direction \n",
      "M_z = M*(10**6)*math.cos(math.radians(o))\n",
      "M_y = M*(10**6)*math.sin(math.radians(o))\n",
      "#tanb = I_z /I_y *tan14.34\n",
      "b = math.atan((I_max*math.tan(math.radians(o))/I_min ))\n",
      "B = math.degrees(b) \n",
      "y_p = 122.9      # mm - principle axis Y cordinate\n",
      "z_p = -26.95     #mm - principle axis z cordinate\n",
      "stress_B = - M_z*y_p/I_max + M_y*z_p/I_min  #Mpa - Maximum tensile stress\n",
      "y_f = -65.97     # mm - principle axis Y cordinate\n",
      "z_f = 41.93      #mm - principle axis z cordinate\n",
      "stress_f = - M_z*y_f/I_max + M_y*z_f/I_min #Mpa - Maximum compressive stress\n",
      "print \"The maximum tensile stress\",round(stress_B,2) ,\"Mpa\"\n",
      "print \"The maximum compressive stress\",round(stress_f,2),\"Mpa\"\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum tensile stress -76.1 Mpa\n",
        "The maximum compressive stress 67.73 Mpa\n"
       ]
      }
     ],
     "prompt_number": 83
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.18 page number 328"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "l = 50    #mm - The length of the beam \n",
      "b = 50    #mm - The width of the beam \n",
      "A = l*b   #mm2 - The area of the beam \n",
      "p = 8.33  #KN - The force applied on the beam \n",
      "stress_max = p*(10**3)/A  #Mpa After cutting section A--b\n",
      "print \"The maximum stress in the beam\",stress_max ,\"Mpa \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum stress in the beam 3.332 Mpa \n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.24 page number 339"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "M = 10                #KN.m - The moment applied\n",
      "I_max = 23.95*(10**6) #mm4 - I_z The moment of inertia\n",
      "I_min = 2.53*(10**6)  #mm4 - I_y The moment of inertia\n",
      "o = 14.34             # degress the principle axis rotated\n",
      "#Coponents of M in Y,Z direction \n",
      "M_z = M*(10**6)*math.cos(math.radians(o))\n",
      "M_y = M*(10**6)*math.sin(math.radians(o))\n",
      "#tanb = I_z /I_y *tan14.34\n",
      "b = math.atan((I_max*math.tan(math.radians(o))/I_min ))\n",
      "B = math.degrees(b) \n",
      "y_p = 122.9      # mm - principle axis Y cordinate\n",
      "z_p = -26.95     #mm - principle axis z cordinate\n",
      "stress_B = - M_z*y_p/I_max + M_y*z_p/I_min  #Mpa - Maximum tensile stress\n",
      "y_f = -65.97     # mm - principle axis Y cordinate\n",
      "z_f = 41.93      #mm - principle axis z cordinate\n",
      "stress_f = - M_z*y_f/I_max + M_y*z_f/I_min #Mpa - Maximum compressive stress\n",
      "#location of nuetral axis To show these stresses are max and minimum \n",
      "#tanB = MzI_z + MzI_yz/MyI_y +M_YI_yz\n",
      "I_z = 22.64 *(10**6) #mm4 moment of inertia in Z direction\n",
      "I_y = 3.84 *(10**6) #mm4 moment of inertia in Y direction\n",
      "I_yz =5.14 *(10**6) #mm4 moment of inertia in YZ  direction \n",
      "M_y = M #KN.m bending moment in Y dorection \n",
      "M_z = M #KN.m bending moment in Y dorection \n",
      "B = math.atan(( M_z*I_yz)/(M_z*I_y )) #radians  location on neutral axis\n",
      "beta =  math.degrees(B)\n",
      "print \"By sketching the line with angle\",round(beta,1),\"degrees The farthest point associated with B and F\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "By sketching the line with angle 53.2 degrees The farthest point associated with B and F\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}