{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4:Axial Load"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1 Page no 126"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "a_ab = 1\t\t    #inch**2, area\n",
      "a_bd = 2 \t\t    #inch**2\n",
      "a_bc = a_bd\n",
      "p = 29\t\t\t   #kN, load\n",
      "l_ab = 2\t\t   #ft\n",
      "l_bc = 1.5 \t\t   #ft\n",
      "l_cd = 1 \t     #ft\n",
      "\n",
      "#Calculations\n",
      "#Internal Forces By method of Sections\n",
      "p_bc = 15         #kip\n",
      "p_cd = 7          #kip\n",
      "p_ab=9           #kip\n",
      "#Displacement\n",
      "d=(p_bc*l_ab*12/(a_ab*p*10**3))+(p_cd*l_bc*12/(a_bd*p*10**3))+(p_ab*l_cd*12/(a_bc*p*10**3))\n",
      "d_=p_cd*l_bc*12/(a_bd*p*10**3)\n",
      "\n",
      "#Display\n",
      "print\"The displacement of B relative to C is = +%1.3f mm\",round(d*10,4),\"inch\"\n",
      "print \"Displacement of B relative to C is\",round(d_,5),\"inch\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The displacement of B relative to C is = +%1.3f mm 0.0217 inch\n",
        "Displacement of B relative to C is 0.00217 inch\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2 Page no 127"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "a_ab = 400.0      #mm**2, area\n",
      "d_rod = 10.0      #mm\n",
      "r_rod = d_rod/(2*1000) #radius in m\n",
      "P = 80.0           #kN, load\n",
      "E_st = 200*(10**9) #Pa, pressure\n",
      "E_al = 70*(10**9) #Pa\n",
      "l_ab = 400.0      #mm, length of ab\n",
      "l_bc = 600.0      #mm  length of bc\n",
      "\n",
      "#Calculations\n",
      "#Displacement\n",
      "#delta =PL/AE\n",
      "import math\n",
      "numerator1 = P*(10**3)*(l_bc/1000.0) \n",
      "denominator1 = (math.pi*r_rod**2*E_st)\n",
      "delta_cb = numerator1/denominator1 #to the right\n",
      "numerator2 = -P*(10**3)*(l_ab/1000.0) \n",
      "denominator2 = (a_ab* 10**-6 *E_al)\n",
      "delta_a = -numerator2/denominator2 #to the right\n",
      "delta_c = delta_a+delta_cb\n",
      "\n",
      "#Display\n",
      "print\"The displacement of C with respect to B     = \",round(delta_cb,4),\"m\"\n",
      "print\"The displacement of B with respect to A     = \",round(delta_a,4),\"m\"\n",
      "print'The displacement of C relative to A         = ',round(delta_c*1000,2),\"mm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The displacement of C with respect to B     =  0.0031 m\n",
        "The displacement of B with respect to A     =  0.0011 m\n",
        "The displacement of C relative to A         =  4.2 mm\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3 Page no 128"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "d_ac = 20.0                  #mm, ac diameter\n",
      "r_ac = d_ac/(2*1000)\t\t #radius in m\n",
      "d_bd =40.0 \t\t\t     #mm\n",
      "r_bd = d_bd/(2*1000) \t\t#radius in m\n",
      "P = 90.0 \t\t\t\t#kN\n",
      "E_st = 200*(10**9) \t\t#Pa\n",
      "E_al = 70*(10**9) \t\t#Pa\n",
      "l_af = 200.0 \t\t\t#mm\n",
      "l_fb = 400.0 \t\t\t#mm\n",
      "l_bd = 300.0\t\t\t#mm\n",
      "l_ac = l_bd\n",
      "\n",
      "#Calculations\n",
      "#Internal Force\n",
      "P_ac = 60 #kN\n",
      "P_bd = 30 #kN\n",
      "#Displacement\n",
      "import math\n",
      "num1 = -(P_ac*10**3*(l_ac/1000.0))\n",
      "denom1 = math.pi* r_ac**2*E_st\n",
      "delta_a = -num1/denom1 \n",
      "delta_a = delta_a*1000 \n",
      "#Post BD delta = PL/AE\n",
      "num2 = -(P_bd*10**3*(l_bd/1000))\n",
      "denom2 = math.pi* r_bd**2*E_al\n",
      "delta_b = -num2/denom2 \n",
      "delta_b = delta_b*1000 \n",
      "delta_f = delta_b + (0.184)*(l_fb/(l_af+l_fb)) \n",
      "\n",
      "#Display\n",
      "print'The displacement of Post AC       =',round(delta_a,3),\"mm downwards\"\n",
      "print'The displacement of Post BD       =',round(delta_b,3),\"mm downwards\"\n",
      "print'nThe displacement of point F      =',round(delta_f,3),\"mm downwards\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The displacement of Post AC       = 0.286 mm downwards\n",
        "The displacement of Post BD       = 0.102 mm downwards\n",
        "nThe displacement of point F      = 0.225 mm downwards\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5 Page no 139"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "import math\n",
      "d_ab = 5           #mm, ab diameter\n",
      "A = (math.pi/4)*(d_ab/1000)**2\n",
      "gap = 1           #mm\n",
      "P = 20            #kN, pressure\n",
      "E_st = 200        #GPa\n",
      "l_ac = 0.4        #m\n",
      "l_cb = 0.8        #m\n",
      "l_ab = l_ac+l_cb\n",
      "\n",
      "#Calculations\n",
      "#Equilibrium\n",
      "#  Eqn1 -Fa - Fb +P*10**3 = 0 \n",
      "#Compatibility\n",
      "delta_ba = gap/1000.0 #in m\n",
      "delta = delta_ba*(A*E_st*10**9) #delta_ba* Lac/AE \n",
      "\n",
      "#Eqn2 (L/AE)*Fa -(Lb/AE)*Fb = delta_ba\n",
      "#Solving Equations 1 and 2 by matrices\n",
      "Fa=16            #KN\n",
      "Fb=4.05          #KN\n",
      "\n",
      "#Display\n",
      "print\"The reaction force at A = \",Fa,\"kN\"\n",
      "print\"The reaction force at B = \",Fb,\"kN\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reaction force at A =  16 kN\n",
        "The reaction force at B =  4.05 kN\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6 Page no 140"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "P = 9 \t\t     #kip, load\n",
      "E_al = 10        #ksi, \n",
      "E_br = 15        # ksi\n",
      "h = 1.5 \t     #ft\n",
      "ri = 1 \t         #inch\n",
      "ro = 2 \t         #inch\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "A = (math.pi*(ro**2 -ri**2))\n",
      "Ai = math.pi*ri**2\n",
      "#Equilibrium Eqn1 F_al +F_br = P\n",
      "#Compatibility\n",
      "coeff_F_br = (A*E_al)/(Ai*E_br) \n",
      "#Eqn2  F_al- (coeff_F_br*F_br) = 0\n",
      "#Solving equations 1 and 2 using matrices\n",
      "Fal=6  \n",
      "Fbr=3\n",
      "\n",
      "avg_stress_al = Fal/A \n",
      "avg_stress_br = Fbr/Ai \n",
      "avg_stress_al = avg_stress_al/1000\n",
      "avg_stress_br = avg_stress_br/1000\n",
      "\n",
      "#Display\n",
      "print\"The axial force experienced by Al     = \",Fal,\"ksi\"\n",
      "print\"The axial force experienced by Brass  = \",Fbr,\"ksi\"\n",
      "print'The average normal stress in Al       = ',round(avg_stress_al*1000,3),\"ksi\"\n",
      "print'The average normal stress in Al Brass = ',round(avg_stress_br*1000,3),\"ksi\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The axial force experienced by Al     =  6 ksi\n",
        "The axial force experienced by Brass  =  3 ksi\n",
        "The average normal stress in Al       =  0.637 ksi\n",
        "The average normal stress in Al Brass =  0.955 ksi\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7 Page no 141"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "P = 15\t\t #kN. load\n",
      "a_ab = 50 \t#mm**2, area\n",
      "a_ef =a_ab\n",
      "a_cd = 30 \t#mm**2, area\n",
      "l_ef = 0.5 \t#m, ef length\n",
      "l_ce = 0.4 \t#m\n",
      "l_ac = 0.4 \t#m\n",
      "\n",
      "#Calculations\n",
      "#In the y direction    F_a +F_c +F_e = P\n",
      "#of moments -F_a(l_ac)+ P(l_ac/2) +F_e(l_ce) = 0\n",
      "\n",
      "#Compatibility equation for displacemnts\n",
      "coeff_Fc = (1/a_cd) #coefficient of Fc\n",
      "coeff_Fa = (0.5/a_ab) #coefficient of Fc\n",
      "coeff_Fe = (0.5/a_ef) #coefficient of Fc\n",
      "\n",
      "#Solving the 3 Equations\n",
      "F_a=9.52\n",
      "F_b=3.46\n",
      "F_c=2.02\n",
      "#Display\n",
      "print\"The force in rod AB       = \",F_a,\"kN\"\n",
      "print'The force in rod CD       = ',F_b,\"kN\"\n",
      "print'The force in rod EF       = ',F_c,\"kN\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force in rod AB       =  9.52 kN\n",
        "The force in rod CD       =  3.46 kN\n",
        "The force in rod EF       =  2.02 kN\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8 Page no 142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "r_o = 0.5\t\t #inch, outside radius\n",
      "r_i = 0.25\t\t#inch, inside radius\n",
      "l = 3 \t\t\t#inch\n",
      "one_turn =20   #threads per inch\n",
      "\n",
      "#calculations\n",
      "import math\n",
      "a_t = (math.pi)*(r_o**2 - r_i**2) #Area of thread\n",
      "a_b = (math.pi*(r_i**2))# Area of bolt\n",
      "# In Y direction F_b - F_t = 0\n",
      "\n",
      "#Compatibility\n",
      "half_turn = one_turn/2.0\n",
      "#Solving the two simultaneous equations for F_b and F_t\n",
      "F_b =11.22       #kip\n",
      "F_t = F_b\n",
      "stress_b = F_b/a_b\n",
      "stress_t = F_t/a_t\n",
      "F_b = F_b/1000.0\n",
      "F_t = F_t/1000.0\n",
      "\n",
      "#Display\n",
      "print'The stress in the bolt ',round(stress_b,1),\"ksi\"\n",
      "print'The stress in the screw   ',round(stress_t,1),\"ksi\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The stress in the bolt  57.1 ksi\n",
        "The stress in the screw    19.0 ksi\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9 Page no 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "import math\n",
      "l_ab = 800 + 400\t\t#mm, ab length\n",
      "P = 20 \t\t         \t#kN, load\n",
      "d = 5/1000.0 \t\t\t#m, diameter\n",
      "area = (math.pi/4.0)*d**2 \t#Cross sectional area\n",
      "l_bbdash = 1/1000.0\t\t#m\n",
      "E = 200.0 \t\t\t#GPa\n",
      "\n",
      "#Calculations\n",
      "#Compatibility\n",
      "delta_p = (P*10**3*0.4)/(area*E*10**9) #delta = PL/AE\n",
      "delta_b = delta_p-l_bbdash\n",
      "F_b = (delta_b*area*E*10**9)/(l_ab/1000.0)\n",
      "F_b = F_b/1000.0\n",
      "\n",
      "#Equilibrium\n",
      "F_a = P - F_b\n",
      "\n",
      "#Display\n",
      "print\"The reaction at A \",round(F_a,2),\"kN\"\n",
      "print'The reaction at B',round(F_b,2),\"kN\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reaction at A  16.61 kN\n",
        "The reaction at B 3.39 kN\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10 Page no 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "T1 = 60\t\t #degree celcius\n",
      "T2 = 120\t\t#degress celcius\n",
      "l_ab = 0.5\t\t#m\n",
      "area =l_ab**2 \t#m**2\n",
      "alpha = 6.6*10**-6\t# per degree celcius\n",
      "E = 29*10**6 \t\t#kPa\n",
      "\n",
      "#Equilibrium\n",
      "#F_a = F_b = F\n",
      "del_T = T2-T1\n",
      "F = alpha*del_T*area*E                   #Thermal Stress Formula\n",
      "avg_normal_comp_stress = (F*10**-3)/area # sigma = F/A\n",
      "\n",
      "#Display\n",
      "print\"The force at A and B   = \",F/1000,\"kip\"\n",
      "print'The average normal compressive stress  = ',avg_normal_comp_stress,\"ksi\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force at A and B   =  2.871 kip\n",
        "The average normal compressive stress  =  11.484 ksi\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12 Page no 154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "area_sleeve = 600*10**-6     #m**2, area\n",
      "area_bolt = 400*10**-6       #m**2, area\n",
      "T1 = 15                      #degree celcius\n",
      "T2 = 80                      #degree celcius\n",
      "alpha_bolt = 12*10**-6       #per degree celcius\n",
      "alpha_sleeve = 23*10**-6     #per degree celcius\n",
      "l = 0.15                    #m\n",
      "E_bolt = 200*10**9 #N/m**2 \n",
      "E_sleeve = 73.1*10**9 #N/m**2 \n",
      "\n",
      "#Equilibrium\n",
      "#F_s = F_b\n",
      "\n",
      "#Compatibility\n",
      "del_T = T2 - T1 \n",
      "delb_T = alpha_bolt*del_T*l \n",
      "delb_F = l/(area_bolt*E_bolt)\n",
      "dels_T = alpha_sleeve*del_T*l \n",
      "dels_F = l/(area_sleeve*E_sleeve)\n",
      "\n",
      "#delb_T + F_b*delb_F = dels_T + F_s*dels_F\n",
      "F_b = (dels_T-delb_T)/(delb_F+dels_F)\n",
      "F_b = F_b/1000 #in kN\n",
      "F_s= F_b\n",
      "\n",
      "#Display\n",
      "print\"The force experienced by sleeve and bolt, Fs=Fb \",round(F_s,1),\"kN\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force experienced by sleeve and bolt, Fs=Fb  20.3 kN\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13 Page no 165"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "yiel = 250      #MPa, yield stress\n",
      "r = 4            #mm, radius\n",
      "width = 40       #mm\n",
      "thick = 2       #mm\n",
      "\n",
      "#a)\n",
      "r_h = r/(width - (2*r))\n",
      "w_h = width/(width - (2*r))\n",
      "K = 1.75\n",
      "area = (thick*(width - (2*r))*10**-6)\n",
      "P_y = (yiel*10**6*area)/K\n",
      "P_y = P_y/1000.0\n",
      "#b)\n",
      "P_p = (yiel*10**6*area)\n",
      "P_p = P_p/1000.0\n",
      "\n",
      "#Display\n",
      "print\"The maximum load P that does not cause the steel to yield \",round(P_y,2),\"kN\"\n",
      "print'The maximum load that the bar can support ',P_p,\"kN\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum load P that does not cause the steel to yield  9.14 kN\n",
        "The maximum load that the bar can support  16.0 kN\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.14 Page No:166"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "P = 60             #KN, load\n",
      "sigmaY= 420       #MPa, bending stress\n",
      "E = 70*10**6       #MPa\n",
      "l1 = 0.1           #m\n",
      "l2 = 0.3           #m\n",
      "r=0.005         #m \n",
      "\n",
      "#Maximum Normal Stress:\n",
      "#r_h = 6/20.0\n",
      "#w_h = 40/20.0\n",
      "#K = 1.6\n",
      "#from sec 4.4\n",
      "Fa=45\n",
      "Fb=15\n",
      "sigmaAC=(Fa/1000.0)/((math.pi)*r**2)\n",
      "sigmaCB=(Fb/1000.0)/((math.pi)*r**2)\n",
      "Fay=sigmaY*10**3*(math.pi)*r**2\n",
      "Fb=P-Fay\n",
      "if sigmaAC>sigmaY:\n",
      "    print\"Calculate sigmaAC again\"\n",
      "else:\n",
      "    print\"It is OK\"    \n",
      "sigmaAC_=sigmaY\n",
      "sigmaCB_=Fb/1000.0/((math.pi)*r**2)\n",
      "if sigmaCB_<sigmaY:\n",
      "    print\"It is OK\"\n",
      "else:\n",
      "    print\"Calculate sigmaAC again\"    \n",
      "dL=Fb*l2/(((math.pi)*r**2)*E)\n",
      "epsilonCB=dL/l2\n",
      "epsilonAC=dL/l1\n",
      "epsilonY=sigmaY*10**6/(E*10**3)\n",
      "sigmaACr=-sigmaAC_+sigmaAC\n",
      "sigmaCBr=sigmaCB_-sigmaCB\n",
      "\n",
      "#Display:\n",
      "print\"Residual stress in AC is\",round(sigmaACr,0),\"MPa\"\n",
      "print\"Residual stress in CB is\",round(sigmaCBr,0),\"MPa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Calculate sigmaAC again\n",
        "It is OK\n",
        "420\n",
        "572.957795131\n",
        "190.98593171\n",
        "343.943726841\n",
        "Residual stress in AC is 153.0 MPa\n",
        "Residual stress in CB is 153.0 MPa\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.15 Page no 168"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "weight = 3.0           #kip, weight\n",
      "l_ab = 20.0            #ft, length\n",
      "l_ac= 20.03          #ft\n",
      "area = 0.05          #inch**2, area\n",
      "sigmaY=50               #ksi\n",
      "\n",
      "#calculations\n",
      "strain_ab = (l_ac-l_ab)/l_ab \n",
      "max_strain = 0.0017 \n",
      "stress_ab = (350*strain_ab)/max_strain\n",
      "F_ab = stress_ab*area \n",
      "E_st = 350/max_strain \n",
      "del1 = l_ab/(area*10**-6*E_st*10**3) \n",
      "del2 = l_ac/(area*10**-6*E_st*10**3) \n",
      "\n",
      "T_ab=sigmaY*area\n",
      "T_ac = weight-T_ab            #kip\n",
      "stress_in_ab = (T_ab*10**3)/area\n",
      "stress = (T_ac)/area\n",
      "strain_ac = (stress*max_strain)/50.0\n",
      "elong_ac = strain_ac*l_ac       #m\n",
      "elong_ab = (l_ac-l_ab)+elong_ac #m\n",
      "\n",
      "#Display\n",
      "print'The force experienced by wire AB  = ',T_ab,\"kip\"\n",
      "print'The force experienced by wire AC  = ',T_ac,\"kip\"\n",
      "print'The elongation in wire AB         = ',round(elong_ab,4),\"ft\"\n",
      "print'The elongation in wire AC         = ',round(elong_ac,5),\"ft\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force experienced by wire AB  =  2.5 kip\n",
        "The force experienced by wire AC  =  0.5 kip\n",
        "The elongation in wire AB         =  0.0368 ft\n",
        "The elongation in wire AC         =  0.00681 ft\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}