{
 "metadata": {
  "name": "",
  "signature": "sha256:35167c2920a96b28d2f9772d7854ca2ec822d5efce1d68ac1a2ac93b9d95fe9f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2: Axially Loaded Members"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1, page no. 72"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "#initialisation\n",
      "\n",
      "W = 2.0                       #lb\n",
      "b = 10.5                   #inch\n",
      "c = 6.4                    #inch\n",
      "k = 4.2                    #inch\n",
      "p = 1.0/16.0                   #inch\n",
      "\n",
      "#calculation\n",
      "\n",
      "n = (W*b)/(c*k*p)          #inch\n",
      "\n",
      "#result\n",
      "\n",
      "print \" No. of revolution required = \", n, \"revolutions\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " No. of revolution required =  12.5 revolutions\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2, page no. 74"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "import numpy\n",
      "\n",
      "#initialisation\n",
      "\n",
      "Fce_ = 2.0                    #dummy variable\n",
      "Fbd_ = 3.0                    #dummy variable    \n",
      "Lbd = 480.0                   #mm\n",
      "Lce = 600.0                  #mm\n",
      "E = 205e6                   #205Gpa\n",
      "Abd = 1020.0                  #mm\n",
      "Ace = 520.0                   #mm\n",
      "\n",
      "#calculation\n",
      "Dbd_ = (Fbd_*Lbd)/(E*Abd)   #dummy variable\n",
      "Dce_ = (Fce_*Lce)/(E*Ace)   #dummy variable\n",
      "Da = 1 #limiting value\n",
      "P = ((((450+225)/225)*(Dbd_ + Dce_) - Dce_ )**(-1)) * Da  \n",
      "Fce = 2*P # Real value in newton\n",
      "Fbd = 3*P #real value in newton\n",
      "Dbd = (Fbd*Lbd)/(E*Abd) #print lacement in mm\n",
      "Dce = (Fce*Lce)/(E*Ace) # print lacement in mm\n",
      "a = numpy.degrees(numpy.arctan(((Da+Dce)/675)))  #alpha in degree\n",
      "\n",
      "#result\n",
      "print \"alpha = \", round(a,2), \"degree\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "alpha =  0.11 degree\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3, page no. 80"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation\n",
      "P1 = 2100.0                       #lb\n",
      "P2 = 5600.0                       #lb\n",
      "b = 25.0                          #inch\n",
      "a = 28.0                          #inch\n",
      "A1 = 0.25                       #inch^2\n",
      "A2 = 0.15                       #inch^2\n",
      "L1 = 20.0                         #inch\n",
      "L2 = 34.8                       #inch\n",
      "E = 29e6                        #29Gpa\n",
      "\n",
      "#Calculations\n",
      "P3 = (P2*b)/a \n",
      "Ra = P3-P1\n",
      "N1 = -Ra \n",
      "N2 = P1 \n",
      "D = ((N1*L1)/(E*A1)) + ((N2*L2)/(E*A2))     #print lacement\n",
      "\n",
      "#Result\n",
      "print  \"Downward print lacement is = \", D, \"inch\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Downward print lacement is =  0.0088 inch\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.6, page no. 90"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#Numerical calculation of allowable load\n",
      "\n",
      "d1 = 4.0                      #mm\n",
      "d2 = 3.0                      #mm\n",
      "A1 = (math.pi*(d1**2))/4    #area\n",
      "A2 = (math.pi*(d2**2))/4    #area\n",
      "L1 = 0.4                    #meter\n",
      "L2 = 0.3                    #meter\n",
      "E1 = 72e9                   #Gpa\n",
      "E2 = 45e9                   #Gpa\n",
      "f1 = L1/(E1*A1) * 1e6       # To cpmpensate for the mm**2\n",
      "f2 = L2/(E2*A2) * 1e6 \n",
      "s1 = 200e6                  #stress\n",
      "s2 = 175e6                  #stress\n",
      "\n",
      "#Calculations\n",
      "P1 = ( (s1*A1*(4*f1 + f2))/(3*f2) ) * 1e-6      # To cpmpensate for the mm**2\n",
      "P2 = ( (s2*A2*(4*f1 + f2))/(6*f1) ) * 1e-6 \n",
      "\n",
      "#Result\n",
      "print \"Newton Minimum allowable stress aomong the two P1 and P2 is smaller one, therefore MAS = \", P2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Newton Minimum allowable stress aomong the two P1 and P2 is smaller one, therefore MAS =  1264.49104307\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.10, page no. 113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation\n",
      "P = 90000.0                   #newton\n",
      "A = 1200e-6                   # meter^2\n",
      "s_x = -P/A                    #stress\n",
      "t_1 = 25.0                    #for the stresses on ab and cd plane\n",
      "\n",
      "#Calculations\n",
      "s_1 = s_x*(math.cos(math.radians(t_1))**2)\n",
      "T_1 = -s_x*math.cos(math.radians(t_1))*math.sin(math.radians(t_1))\n",
      "t_2 = -65.0                   #for the stresses on ad and bc plane\n",
      "s_2 = s_x*(math.cos(math.radians(t_2))**2)\n",
      "T_2 = -s_x*math.cos(math.radians(t_2))*math.sin(math.radians(t_2))\n",
      "\n",
      "#Result\n",
      "print \"The normal and shear stresses on the plane ab and cd are\", round((T_1/1E+6),2), round((s_1/1E+6),2), \"MPa respecively\" \n",
      "print \"respecively The normal and shear stresses on the plane ad and bc are\", round((T_2/1E+6),2), round((s_2/1E+6),2), \"MPa respecively\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The normal and shear stresses on the plane ab and cd are 28.73 -61.6 MPa respecively\n",
        "respecively The normal and shear stresses on the plane ad and bc are -28.73 -13.4 MPa respecively\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.11, page no. 114"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "# Value of s_x based on allowable stresses on glued joint\n",
      "\n",
      "#initialisation\n",
      "s_t = -750.0                                  #psi\n",
      "t = -50.0                                     #degree\n",
      "T_t = -500.0                                  #psi\n",
      "\n",
      "sg_x_1 = s_t/(math.cos(math.radians(t))**2)\n",
      "sg_x_2 = -T_t/(math.cos(math.radians(t))*math.sin(math.radians(t)))\n",
      "\n",
      "# Value of s_x based on allowable stresses on plastic\n",
      "\n",
      "sp_x_1 = -1100.0                              #psi\n",
      "T_t_p = 600.0                                  #psi\n",
      "t_p = 45.0                                    #degree\n",
      "sp_x_2 = -T_t_p/(math.cos(math.radians(t_p))*math.sin(math.radians(t_p)))\n",
      "\n",
      "# Minimum width of bar\n",
      "\n",
      "P = 8000.0                                    #lb\n",
      "A = P/sg_x_2\n",
      "b_min = math.sqrt(abs(A))                        #inch\n",
      "print \"The minimum width of the bar is\", round(b_min,2), \"inch\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum width of the bar is 2.81 inch\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.15, page no. 126"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#Bolt with reduced shank diameter\n",
      "\n",
      "#initialisation\n",
      "g = 1.50                     # inch\n",
      "d = 0.5                      #inch\n",
      "t = 0.25                     #inch\n",
      "d_r = 0.406                  #inch\n",
      "L = 13.5                     #inch\n",
      "\n",
      "#calculation\n",
      "ratio = ((g*(d**2))/(((g-t)*(d_r**2))+(t*(d**2))))              #U2/U1\n",
      "\n",
      "print \"The energy absorbing capacity of the bolts with reduced shank diameter\", round(ratio,2)\n",
      "ratio_1 = ( (((L-t)*(d_r**2))+(t*(d**2))) / ((2*(g-t)*(d_r**2))+2*(t*(d**2))) )         #U3/2U1\n",
      "print \"The energy absorbing capacity of the long bolts\", round(ratio_1,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The energy absorbing capacity of the bolts with reduced shank diameter 1.4\n",
        "The energy absorbing capacity of the long bolts 4.18\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "    Example 2.16, page no. 133"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation\n",
      "# Maximum elongation\n",
      "M = 20                      #kg\n",
      "g = 9.81                    #m/s^2\n",
      "L = 2                       #meter\n",
      "E = 210e9                   #210Gpa\n",
      "h = 0.15                    #meter\n",
      "diameter = 0.015            #milimeter\n",
      "\n",
      "#Calculations & Result\n",
      "A = (math.pi/4)*(diameter**2)               #area\n",
      "D_st = ((M*g*L)/(E*A)) \n",
      "D_max = D_st*(1+(1+(2*h/D_st))**0.5) \n",
      "D_max_1 = math.sqrt(2*h*D_st)                # another approach to find D_max\n",
      "i = D_max / D_st                             # Impact factor\n",
      "print \"Maximum elongation is\",round((D_max/1E-3),2), \"mm\"  # Maximum tensile stress\n",
      "s_max = (E*D_max)/L                          #Maximum tensile stress\n",
      "s_st = (M*g)/A                               #static stress\n",
      "i_1 = s_max / s_st                           #Impact factor \n",
      "print \"Maximum tensile stress is \", round((s_max/1E+6),2), \"MPa\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum elongation is 1.79 mm\n",
        "Maximum tensile stress is  188.13 MPa\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.18, page no. 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "\n",
      "#initialisation\n",
      "P1 = 108000.0                 #Newton\n",
      "P2 = 27000.0                  #Newton\n",
      "L = 2.2                     #meter\n",
      "A = 480.0                     #mm^2\n",
      "\n",
      "\n",
      "#calculations\n",
      "\n",
      "# Displacement due to load P1 acting alone\n",
      "s = (P1/A)                      #stress in MPa\n",
      "e = (s/70000) + (1/628.2)*((s/260)**10)         #strain\n",
      "D_b = e*L*1e3                                   #elongation in mm\n",
      "print \"elongation when only P1 load acting is = \", round(D_b,2), \" mm\"\n",
      "\n",
      "# Displacement due to load P2 acting alone\n",
      "s_1 = (P2/A) #stress in MPa\n",
      "e_1 = (s_1/70000) + (1/628.2)*((s_1/260)**10) #strain\n",
      "D_b_1 = e_1*(L/2)*1e3 #elongation in mm (no elongation in lower half)\n",
      "print \"elongation when only P2 load acting is = \", round(D_b_1,2), \" mm\"\n",
      "\n",
      "# Displacement due to both load acting simonmath.taneously\n",
      "#upper half\n",
      "s_2 = (P1/A) #stress in MPa\n",
      "e_2 = (s_2/70000) + (1/628.2)*((s_2/260)**10) #strain\n",
      "\n",
      "#lower half\n",
      "s_3 = (P1+P2)/A #stress in MPa\n",
      "e_3 = (s_3/70000) + (1/628.2)*((s_3/260)**10) #strain\n",
      "D_b_2 = ((e_2*L)/2 + (e_3*L)/2) * 1e3 # elongation in mm\n",
      "print \"elongation when P1 and P2 both loads are acting is = \", round(D_b_2,2), \" mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "elongation when only P1 load acting is =  7.9  mm\n",
        "elongation when only P2 load acting is =  0.88  mm\n",
        "elongation when P1 and P2 both loads are acting is =  12.21  mm\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}