{
 "metadata": {
  "name": "",
  "signature": "sha256:84b48278b7f3c96235822dbaf287a816273c08b171a3ad371f818f325de3125f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11: Columns"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.1, page no. 763"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation\n",
      "E = 29000                   # Modulus of elasticity in ksi\n",
      "spl = 42                    # Proportional limit in ksi\n",
      "L = 25                      # Total length of coloum in ft\n",
      "n = 2.5                     # factor of safety\n",
      "I1 = 98                     # Moment of inertia on horizontal axis\n",
      "I2 = 21.7                   # Moment of inertia on vertical axis\n",
      "A = 8.25                    # Area of the cross section\n",
      "\n",
      "#calculation\n",
      "Pcr2 = (4*math.pi**2*E*I2)/((L*12)**2)          # Criticle load if column buckles in the plane of paper\n",
      "Pcr1 = (math.pi**2*E*I1)/((L*12)**2)            # Criticle load if column buckles in the plane of paper\n",
      "Pcr = min(Pcr1,Pcr2)                            # Minimum pressure would govern the design\n",
      "scr = Pcr/A                                     # Criticle stress\n",
      "Pa = Pcr/n                                      # Allowable load in k\n",
      "print \"The allowable load is \", round(Pa), \"k\"\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The allowable load is  110.0 k\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.2, page no. 774"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation\n",
      "L = 3.25                        # Length of alluminium pipe in m\n",
      "d = 0.1                         # Outer diameter of alluminium pipe\n",
      "P = 100000                      # Allowable compressive load in N\n",
      "n =3                            # Safety factor for eular buckling\n",
      "E = 72e09                       # Modulus of elasticity in Pa\n",
      "l = 480e06                      # Proportional limit\n",
      "\n",
      "#calculation\n",
      "Pcr = n*P                                   # Critice load\n",
      "t = (0.1-(55.6e-06)**(1.0/4.0) )/2.0        # Required thickness\n",
      "\n",
      "tmin = t \n",
      "print \"The minimum required thickness of the coloumn is\", round(tmin*1000,2), \"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum required thickness of the coloumn is 6.82 mm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.3, page no. 780"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "from sympy import *\n",
      "\n",
      "#initialisation\n",
      "P = 1500                    # Load in lb\n",
      "e = 0.45                    # ecentricity in inch\n",
      "h = 1.2                     # Height of cross section in inch\n",
      "b = 0.6                     # Width of cross section in inch\n",
      "E = 16e06                   # Modulus of elasticity \n",
      "my_del = 0.12               # Allowable deflection in inch\n",
      "\n",
      "#calculation\n",
      "L = mpmath.asec(1.2667)/0.06588        # Maximum allowable length possible\n",
      "\n",
      "#Result\n",
      "print \"The longest permissible length of the bar is\", round(L), \"inch\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The longest permissible length of the bar is 10.0 inch\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.4, page no. 785"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "from sympy import *\n",
      "import math\n",
      "\n",
      "#initialisation\n",
      "L = 25                      # Length of coloum in ft\n",
      "P1 = 320                    # Load in K\n",
      "P2 = 40                     # Load in K\n",
      "E = 30000                   # Modulus of elasticity of steel in Ksi\n",
      "P = 360                     # Euivalent load\n",
      "e = 1.5                     # Ecentricity of compressive load\n",
      "A = 24.1                    # Area of the Cross section\n",
      "r = 6.05                    # in inch\n",
      "c = 7.155                   # in inch\n",
      "sy = 42                     # Yeild stress of steel in Ksi\n",
      "\n",
      "#calculation\n",
      "\n",
      "smax = (P/A)*(1+(((e*c)/r**2)*mpmath.sec((L/(2*r))*math.sqrt(P/(E*A)))))           # Maximum compressive stress\n",
      "print \"The Maximum compressive stress in the column \", round(smax,2), \"ksi\"\n",
      "# Bisection method method to solve for yeilding\n",
      "def stress(a,b,f):\n",
      "    N = 100\n",
      "    eps = 1e-5\n",
      "    if((f(a)*f(b))>0):\n",
      "        print 'no root possible f(a)*f(b)>0'\n",
      "        sys.exit()\n",
      "    if(abs(f(a))<eps):\n",
      "        print 'solution at a'\n",
      "        sys.exit()\n",
      "    if(abs(f(b))<eps):\n",
      "        print 'solution at b'\n",
      "    while(N>0):\n",
      "        c = (a+b)/2.0\n",
      "        if(abs(f(c))<eps):\n",
      "            x = c \n",
      "            return x\n",
      "        if((f(a)*f(c))<0 ):\n",
      "            b = c \n",
      "        else:\n",
      "          a = c \n",
      "        N = N-1\n",
      "    print 'no convergence'\n",
      "    sys.exit()\n",
      "\n",
      "def p(x): \n",
      "\t return  x + (0.2939*x*sec(0.02916*sqrt(x))) - 1012 \n",
      "x = stress(710,750,p)\n",
      "Py = x                  # Yeilding load in K\n",
      "n = Py/P                # Factor of safety against yeilding\n",
      "print \"The factor of safety against yeilding is\", round(n)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Maximum compressive stress in the column  19.32 ksi\n",
        "The factor of safety against yeilding is 2.0\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.5, page no. 804"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "import numpy\n",
      "\n",
      "#initialisation\n",
      "E = 29000                       # Modulus of elasticity in ksi\n",
      "sy = 36                         # Yeilding stress in ksi\n",
      "L = 20                          # Length of coloumn in ft\n",
      "r = 2.57                        # radius of gyration of coloumn\n",
      "K = 1                           # Effetive Length factor\n",
      "\n",
      "#calculation\n",
      "s = math.sqrt((2*math.pi**2*E)/sy)          # Criticle slenderness ratio (K*L)/r\n",
      "s_ = (L*12)/r                               # Slenderness ratio\n",
      "\n",
      "# Part(a)\n",
      "n1 = (5.0/3.0)+((3.0/8.0)*(s_/s))-((1.0/8.0)*((s_**3)/(s**3)))  # Factor of safety \n",
      "sallow = (sy/n1)*(1-((1.0/2.0)*((s_**2)/(s**2))))               # Allowable axial load\n",
      "A = 17.6                                                        # Cross sectional area from table E1\n",
      "Pallow = sallow*A                                               # Allowable axial load\n",
      "print \"Allowable axial load is\", round(Pallow,2), \"k\"\n",
      "\n",
      "# Part (b)\n",
      "Pe = 200                        # Permissible load in K\n",
      "L_ = 25                         # Assumed length in ft\n",
      "s__ = (L_*12)/r                 # Slenderness ratio\n",
      "n1_ = (5.0/3.0)+((3.0/8.0)*(s__/s))-((1.0/8.0)*((s__**3)/(s**3)))   # Factor of safety \n",
      "sallow_ = (sy/n1_)*(1-((1.0/2.0)*((s__**2)/(s**2))))                # Allowable axial load\n",
      "A = 17.6                                                            # Area of the cross section in**2\n",
      "Pallow = sallow_*A                                                  # Allowable load\n",
      "L1 = [24, 24.4, 25]\n",
      "P1 = [201, 194, 190]\n",
      "L_max = numpy.interp(200.0, P1, L1)\n",
      "print \"The maximum permissible length is\", L_max, \"ft\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Allowable axial load is 242.84 k\n",
        "The maximum permissible length is 25.0 ft\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.6, page no. 806"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "import numpy\n",
      "\n",
      "#initialisation\n",
      "L = 3.6                         # Length of steel pipe coloumn\n",
      "d = 0.16                        # Outer diameter in m\n",
      "P = 240e03                      # Load in N\n",
      "E = 200e09                      # Modulus of elasticity in Pa\n",
      "sy = 259e06                     # yeilding stress in Pa\n",
      "K = 2.0\n",
      "Le = K*L                        # As it in fixed-free condition\n",
      "\n",
      "#calculation\n",
      "sc = math.sqrt((2*math.pi**2*E)/sy) # Critical slenderness ratio\n",
      "\n",
      "# First trial\n",
      "t = 0.007                               # Assumed thick ness in m\n",
      "I = (math.pi/64)*(d**4-(d-2*t)**4)      # Moment of inertia\n",
      "A = (math.pi/4)*(d**2-(d-2*t)**2)       # Area of cross section\n",
      "r = math.sqrt(I/A)                      # Radius of gyration\n",
      "sc_ = round((K*L)/r)                    # Slender ness ratio\n",
      "n2 = 1.92                               # From equation 11.80\n",
      "sa = (sy/(2*n2))*(sc**2/sc_**2)         # Allowable stress\n",
      "Pa = round((sa*A)/1000)                 # Allowable axial load in N\n",
      "\n",
      "# Interpolation\n",
      "t = [7, 8, 9]\n",
      "Pa = [196, 220, 243]\n",
      "t_min = numpy.interp(240.0, Pa, t)\n",
      "print \"The minimum required thickness of the steel pipe is\", round(t_min,1), \"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum required thickness of the steel pipe is 8.9 mm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.7, page no. 808"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "#initialisation\n",
      "\n",
      "L = 16                          # Effective length in inch\n",
      "P = 5                           # axial load in K\n",
      "\n",
      "#calculation\n",
      "# Bisection method for solvong the quaderatic\n",
      "def stress(a,b,f):\n",
      "    N = 100\n",
      "    eps = 1e-5\n",
      "    if((f(a)*f(b))>0):\n",
      "        print 'no root possible f(a)*f(b)>0'\n",
      "        sys.exit()\n",
      "    if(abs(f(a))<eps):\n",
      "        print 'solution at a'\n",
      "        sys.exit()\n",
      "    if(abs(f(b))<eps):\n",
      "        print 'solution at b'\n",
      "    while(N>0):\n",
      "        c = (a+b)/2.0\n",
      "        if(abs(f(c))<eps):\n",
      "            x = c \n",
      "            return x\n",
      "        if((f(a)*f(c))<0 ):\n",
      "            b = c \n",
      "        else:\n",
      "          a = c \n",
      "        N = N-1\n",
      "    print 'no convergence'\n",
      "    sys.exit()\n",
      "def p(x): \n",
      "\t return  30.7*x**2 - 11.49*x -17.69 \n",
      "x = stress(0.9,1.1,p)\n",
      "d = x                               # Diameter in inch\n",
      "sl = 49.97/d                        # Slenderness ration L/r\n",
      "dmin = d                            # Minimum diameter\n",
      "print \"The minimum required outer diameter of the tube is\", round(dmin,2), \"inch\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum required outer diameter of the tube is 0.97 inch\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.8, page no. 810"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation\n",
      "Fc = 11e06                          # Compressive demath.sing stress in Pa\n",
      "E = 13e09                           # Modulus of elasticity in Pa\n",
      "\n",
      "#calculation\n",
      "# Part (a)\n",
      "Kce = 0.3  \n",
      "c = 0.8 \n",
      "A = 0.12*0.16                           # Area of cross section\n",
      "Sl = 1.8/0.12                           # Slenderness ratio\n",
      "fi = (Kce*E)/(Fc*Sl**2)                 # ratio of stresses\n",
      "Cp = ((1+fi)/(2*c)) - math.sqrt(((1+fi)/(2*c))**2-(fi/c)) # Coloumn stability factor \n",
      "Pa = Fc*Cp*A\n",
      "print \"The allowable axial load is\", Pa, \"N\"\n",
      "\n",
      "# Part (b)\n",
      "P = 100000                              # Allowable Axial load\n",
      "Cp_ = P/(Fc*A)                          # Coloumn stability factor\n",
      "\n",
      "# Bisection method method to solve for fi\n",
      "def stress(a,b,f):\n",
      "    N = 100\n",
      "    eps = 1e-5\n",
      "    if((f(a)*f(b))>0):\n",
      "        print 'no root possible f(a)*f(b)>0'\n",
      "        sys.exit()\n",
      "    if(abs(f(a))<eps):\n",
      "        print 'solution at a'\n",
      "        sys.exit()\n",
      "    if(abs(f(b))<eps):\n",
      "        print 'solution at b'\n",
      "    while(N>0):\n",
      "        c = (a+b)/2.0\n",
      "        if(abs(f(c))<eps):\n",
      "            x = c \n",
      "            return x\n",
      "        if((f(a)*f(c))<0 ):\n",
      "            b = c \n",
      "        else:\n",
      "          a = c \n",
      "        N = N-1\n",
      "    print 'no convergence'\n",
      "    sys.exit()\n",
      "def p(x): \n",
      "    return  ((1+x)/(2.0*c)) - math.sqrt(((1+x)/(2.0*c))**2-(x/c)) - Cp_ \n",
      "x = stress(0.1,1.0,p) \n",
      "fi_ = x\n",
      "d_ = 0.12                               # Diameter in m\n",
      "L_max = d_*math.sqrt((Kce*E)/(fi_*Fc))  # Maximum length in m\n",
      "print \"The minimum allowable length is\", round(L_max,2), \"m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The allowable axial load is 173444.30361 N\n",
        "The minimum allowable length is 3.02 m\n"
       ]
      }
     ],
     "prompt_number": 12
    }
   ],
   "metadata": {}
  }
 ]
}