{
 "metadata": {
  "name": "",
  "signature": "sha256:9a9db8433ab57f1254bcf525f290f9e1ef0d063ac15516708405e3ee93106db3"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter9-Combined Stresses"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg361"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate values of R at A,B,C\n",
      "##initialization of variables\n",
      "import math\n",
      "##case (a)\n",
      "A=72.9 ##cm^2\n",
      "Iy=633 ##cm^4\n",
      "Ix=1199. ##cm^4\n",
      "t=24./(5.*Ix)+13.5/(5.*Iy)\n",
      "r=1/(A*t)\n",
      "print'%s %.2f %s'%('case (a) \\n r = ',r,' cm')\n",
      "## case (b)\n",
      "t=24./(5.*Ix)-13.5/(5.*Iy)\n",
      "r=1/(A*t)\n",
      "print'%s %.2f %s'%('\\n case (b) \\n r = ',r,' cm')\n",
      "##case (c)\n",
      "t=-24./(5.*Ix)+13.5/(5.*Iy)\n",
      "r=1./(A*t)\n",
      "print'%s %.2f %s'%('\\n case (a) \\n r =',r,' cm')\n",
      "print'%s %.2f %s'%('\\n So the load is to be placed on the leg OD, at a distance of ',r,' cm from O' )\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "case (a) \n",
        " r =  1.66  cm\n",
        "\n",
        " case (b) \n",
        " r =  -52.34  cm\n",
        "\n",
        " case (a) \n",
        " r = 52.34  cm\n",
        "\n",
        " So the load is to be placed on the leg OD, at a distance of  52.34  cm from O\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex3-pg365"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate steel height and Width\n",
      "##initialization of variables\n",
      "import math\n",
      "b=14. ##cm\n",
      "d=20. ##cm\n",
      "rx=8.46 ##cm\n",
      "ry=2.99 ##cm\n",
      "## calculations\n",
      "ex=2.*rx**2/d\n",
      "ey=2*ry**2/b\n",
      "h=2*ex\n",
      "w=2*ey\n",
      "## results\n",
      "print'%s %.2f %s %.2f %s '%('for steel height=',h,' cm and width=',w,' cm')\n",
      "## ISHB 225\n",
      "b=22.5 ##cm\n",
      "d=22.5 ##cm\n",
      "rx=9.8 ##cm\n",
      "ry=4.96 ##cm\n",
      "## calculations\n",
      "ex=2*rx**2/d\n",
      "ey=2*ry**2/b\n",
      "h=2*ex\n",
      "w=2*ey\n",
      "## results\n",
      "print'%s %.2f %s %.2f %s '%('\\n for an ISHB height=',h,' cm and width=',w,' cm')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for steel height= 14.31  cm and width= 2.55  cm \n",
        "\n",
        " for an ISHB height= 17.07  cm and width= 4.37  cm \n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex4-pg366"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate Safe load\n",
      "##initialization of variables\n",
      "import math\n",
      "t=280. ##kg/cm^2\n",
      "c=840. ##kg/cm^2\n",
      "xbar=7.5 ##cm from AB\n",
      "A=210. ##cm^2\n",
      "## calculations\n",
      "e=50.+xbar ##cm\n",
      "Iyy=7433. ##cm^2\n",
      "k=(1./210.+e*xbar/Iyy)\n",
      "P=t/k\n",
      "k1=(-1./210.+e*(xbar+5.)/Iyy)\n",
      "P1=c/k1\n",
      "P_safe=min(P1,P)\n",
      "## results\n",
      "print'%s %.2f %s'%('The safe load is ',P_safe,' kg')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The safe load is  4460.00  kg\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5-pg367"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calcualte compression and tension\n",
      "##initialization of the variables\n",
      "import math\n",
      "s=1.6 ##m\n",
      "s1=4. ##m\n",
      "pi=28. ##degrees\n",
      "w=16. ##kg/m^2\n",
      "p=100. ##kg/m^2\n",
      "pl=20. ##cm\n",
      "pb=10. ##cm\n",
      "r=500. ##kg/m^3\n",
      "## calculations\n",
      "pi=pi*math.pi/180 ##radians\n",
      "W=w*s+(r*pl*pb/(100.*100.))\n",
      "P=p*s\n",
      "L=P+W*math.cos(pi)\n",
      "Mx=L*s1**2*100./8.\n",
      "sigma_1=Mx*6./(pb*pl**2)\n",
      "My=W*math.sin(pi)*s1**2*100./8.\n",
      "sigma_2=My*6./(pl*pb**2)\n",
      "sigma1=sigma_1+sigma_2\n",
      "## results\n",
      "print'%s %.2f %s %.2f %s '%('Due to bending in the noth the planes, D experiences maximum \\n compression of ',sigma1,' kg/cm^2 and B has maximum tension of ',sigma1,' kg/cm^2')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Due to bending in the noth the planes, D experiences maximum \n",
        " compression of  67.46  kg/cm^2 and B has maximum tension of  67.46  kg/cm^2 \n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex6-pg369"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate maximum stresses\n",
      "##initialization of the problems\n",
      "import math\n",
      "s=1.6 ##m\n",
      "s1=4. ##m\n",
      "pi=28. ##degrees\n",
      "w=16. ##kg/m^2\n",
      "p=100. ##kg/m^2\n",
      "pl=20. ##cm\n",
      "pb=10. ##cm\n",
      "r=500. ##kg/m^3\n",
      "Zx=54.8 ##cm^3\n",
      "Zy=3.9 ##cm^3\n",
      "## calculations\n",
      "pi=pi*math.pi/180. ##radians\n",
      "W=w*s+8.1\n",
      "P=p*s\n",
      "L=P+W*math.cos(pi)\n",
      "Mx=L*s1**2*100./8.\n",
      "sigma_1=Mx/Zx\n",
      "My=W*math.sin(pi)*s1**2*100./8.\n",
      "sigma_2=My/Zy\n",
      "sigma=sigma_1+sigma_2\n",
      "## results\n",
      "print'%s %.2f %s'%('Maximum stresses are ',sigma,' kg/cm^2, tension or compression')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum stresses are  1503.88  kg/cm^2, tension or compression\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex7-pg369"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate strain gauge \n",
      "##initialization of variables\n",
      "import math\n",
      "s=1.6 ##m\n",
      "s1=4. ##m\n",
      "pi=28. ##degrees\n",
      "w=16. ##kg/m^2\n",
      "p=100. ##kg/m^2\n",
      "pl=20. ##cm\n",
      "pb=10. ##cm\n",
      "r=500. ##kg/m^3\n",
      "sg=5. ##cm\n",
      "E=12*10**4\n",
      "pi=pi*math.pi/180 ##radians\n",
      "## calculations\n",
      "W=w*s+(r*pl*pb/(100.*100.))\n",
      "P=p*s\n",
      "L=P+W*math.cos(pi)\n",
      "Mx=L*s1**2*100/8.\n",
      "sigma_1=Mx*6./(pb*pl**2)\n",
      "My=W*math.sin(pi)*s1**2*100/8.\n",
      "sigma_2=My*6./(pl*pb**2)\n",
      "st=sigma_1*sg/10.\n",
      "Ts=st-sigma_2\n",
      "ez=Ts/E\n",
      "## results\n",
      "print'%s %.2e %s'%('The strain gauge, aligned to the z axis will give compression strain of ',ez,'')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The strain gauge, aligned to the z axis will give compression strain of  1.56e-04 \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8-pg371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calcualte bending stress and shearing stress\n",
      "##initialization of variables\n",
      "import math\n",
      "P=3. ##tonne/m\n",
      "s=6. ##m\n",
      "l=50. ##cm\n",
      "b=20. ##cm\n",
      "k=0.5 ##m\n",
      "##calculations\n",
      "R=P*s/2.\n",
      "sf=R-k*P\n",
      "bm=R*k-P*k**2/2.\n",
      "tau_xy=1.5*sf*1000./(l*b)\n",
      "tau_max=tau_xy\n",
      "str=bm*s*10**5/(b*l*l)\n",
      "\n",
      "## consider the line a-a\n",
      "\n",
      "sigma_x=str*12.5/25.\n",
      "sigma_y=0.\n",
      "tau_xy=tau_xy*(1.-(12.5/25.)**2)\n",
      "\n",
      "sigma_1=(sigma_x+sigma_y)/2.+math.sqrt((1/2*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "sigma_2=(sigma_x+sigma_y)/2.-math.sqrt((1/2*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "\n",
      "print'%s %.2f %s %.2f %s '%('For the line a-a the bending stress and shearing stress are \\n respectively ',sigma_x,' kg/cm^2'and'',tau_xy,'kg/cm^2 ')\n",
      "print'%s %.2f %s %.2f %s '%('\\n The principal stresses are ',sigma_1,' kg/cm^2 (tension)' and  '',sigma_2,'kg/cm^2 (compression) ')\n",
      "\n",
      "##consider the line c-c\n",
      "print'%s %.2f %s %.2f %s '%('\\n For the line c-c the bending stress and shearing stress are \\n respectively ',sigma_x,' kg/cm^2'and '',tau_xy,' kg/cm^2 ')\n",
      "print'%s %.2f %s %.2f %s '%('\\n The principal stresses are ',sigma_2,' kg/cm^2 (compression)'and '',sigma_1,' kg/cm^2 (tension) ')\n",
      "\n",
      "##for the line b-b\n",
      "tau_xy=tau_max\n",
      "sigma_x=0.\n",
      "sigma_y=0.\n",
      "sigma_1=(sigma_x+sigma_y)/2.+math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "sigma_2=(sigma_x+sigma_y)/2.-math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "## results\n",
      "print'%s %.7f %s %.2f %s '%('\\n For the line b-b the bending stress and shearing stress are \\n respectively ',sigma_x,' kg/cm^2'and '',tau_xy,' kg/cm^2 ')\n",
      "print'%s %.2f %s %.2f %s '%('\\n The principal stresses are ',sigma_1,' kg/cm^2 (tension)'and'',sigma_2,' kg/cm^2 (compression) ')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For the line a-a the bending stress and shearing stress are \n",
        " respectively  24.75  8.44 kg/cm^2  \n",
        "\n",
        " The principal stresses are  20.81  3.94 kg/cm^2 (compression)  \n",
        "\n",
        " For the line c-c the bending stress and shearing stress are \n",
        " respectively  24.75  8.44  kg/cm^2  \n",
        "\n",
        " The principal stresses are  3.94  20.81  kg/cm^2 (tension)  \n",
        "\n",
        " For the line b-b the bending stress and shearing stress are \n",
        " respectively  0.0000000  11.25  kg/cm^2  \n",
        "\n",
        " The principal stresses are  11.25  -11.25  kg/cm^2 (compression)  \n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9-pg372"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate tension and principal stress\n",
      "##initialization of variables\n",
      "import math\n",
      "P=3. ##tonne/m\n",
      "s=6. ##m\n",
      "l=50. ##cm\n",
      "b=20. ##cm\n",
      "k=0.5 ##m\n",
      "##calculations\n",
      "R=P*s/2.\n",
      "sf=R-k*P\n",
      "bm=R*k-P*k**2/2.\n",
      "tau_xy=1.5*sf*1000./(l*b)  ##max shear stress\n",
      "tau_max=tau_xy  \n",
      "str=bm*s*10**5/(b*l*l)  ##max bending stress\n",
      "\n",
      "## consider the line a-a\n",
      "\n",
      "sigma_x=str*12.5/25.\n",
      "sigma_y=0.\n",
      "tau_xy=tau_xy*(1.-(12.5/25.)**2)\n",
      "\n",
      "sigma_1=(sigma_x+sigma_y)/2.+math.sqrt((1/2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "sigma_2=(sigma_x+sigma_y)/2-math.sqrt((1/2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "\n",
      "theta=1/2.*math.atan(2.*tau_xy/(sigma_x-sigma_y))*57.3\n",
      "sigma_p=sigma_1/math.cos(theta)\n",
      "P=sigma_p*2.*l*b/(3.*1000.)\n",
      "print'%s %.2f %s'%('A prestressing force of ',P,' Tonne must be applied to balance the tension at a-a')\n",
      "\n",
      "##At bottom point D or C\n",
      "pre_str=P*2.*1000./(l*b)\n",
      "net=str-pre_str\n",
      "print('\\n At bottom point D or C')\n",
      "print'%s %.2f %s'%('\\n Net tension = ',net,' kg/cm^2 ')\n",
      "\n",
      "##consider the line b-b\n",
      "pre_str=P\n",
      "sigma_x=pre_str\n",
      "sigma_y=0.\n",
      "tau_xy=tau_max\n",
      "sigma_1=(sigma_x+sigma_y)/2.+math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "sigma_2=(sigma_x+sigma_y)/2.-math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "print('\\n At section b-b')\n",
      "print'%s %.2f %s '%('\\n pre-stress=',pre_str,' kg/cm^2')\n",
      "print'%s %.2f %s %.2f %s '%('\\n principal stresses are ',sigma_1,''and'',sigma_2,'  kg/cm^2 ')\n",
      "\n",
      "##for the line c-c\n",
      "sigma_x=str*12.5/25.\n",
      "sigma_y=0.\n",
      "tau_xy=tau_xy*(1-(12.5/25.)**2)\n",
      "sigma_1=(sigma_x+sigma_y)/2.+math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "sigma_2=(sigma_x+sigma_y)/2.-math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "pre_str=pre_str/2.\n",
      "net=sigma_1+pre_str\n",
      "sigma_x=net\n",
      "sigma_y=0.\n",
      "sigma_1=(sigma_x+sigma_y)/2.+math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "sigma_2=(sigma_x+sigma_y)/2.-math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "## results\n",
      "print('\\n At section c-c')\n",
      "print'%s %.2f %s'%('\\n the direct stress is ',net,' kg/cm^2')\n",
      "print'%s %.2f %s'%('\\n pre-stress =',pre_str,' kg/cm^2')\n",
      "print'%s %.2f %s %.2f %s '%('\\n principal stresses are',sigma_1,'kg/cm^2'and '',sigma_2,'kg/cm^2')\n",
      "print('wrong calculations in the thext for some parts')\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "A prestressing force of  -136.43  Tonne must be applied to balance the tension at a-a\n",
        "\n",
        " At bottom point D or C\n",
        "\n",
        " Net tension =  322.36  kg/cm^2 \n",
        "\n",
        " At section b-b\n",
        "\n",
        " pre-stress= -136.43  kg/cm^2 \n",
        "\n",
        " principal stresses are  0.92  -137.35   kg/cm^2  \n",
        "\n",
        " At section c-c\n",
        "\n",
        " the direct stress is  -40.86  kg/cm^2\n",
        "\n",
        " pre-stress = -68.22  kg/cm^2\n",
        "\n",
        " principal stresses are 1.67  -42.54 kg/cm^2 \n",
        "wrong calculations in the thext for some parts\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex10-pg373"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate sigma and Tau\n",
      "##initialization of variables\n",
      "import math\n",
      "b=2. ##cm\n",
      "h=2. ##cm\n",
      "T=2000. ##kg-cm\n",
      "V=250. ##kg\n",
      "M=2000. ##kg-cm\n",
      "## calculations\n",
      "Mmax=M*6./(b*h*b)\n",
      "Vmax=3.*V/(2.*b*h)\n",
      "Zt=0.208*b**2*h\n",
      "Tmax=T/(Zt)\n",
      "\n",
      "sigma=Mmax\n",
      "print('points A,B,')\n",
      "print'%s %.2f %s'%('\\n sigma=',sigma,' kg/cm^2 (tension)')\n",
      "print('\\n points C,D,')\n",
      "print'%s %.2f %s'%('\\n sigma=',sigma,' kg/cm^2 (cmpression)')\n",
      "tau=Vmax+Tmax\n",
      "print('\\n point E')\n",
      "print'%s %.2f %s'%('\\n tau=',tau,'kg/cm^2 shear')\n",
      "tau=Vmax-Tmax\n",
      "print'%s %.2f %s'%('\\n tau=',tau,' kg/cm^2 shear')\n",
      "## at G\n",
      "sigma_x=sigma\n",
      "sigma_y=0.\n",
      "tau_xy=Tmax\n",
      "sigma_1=(sigma_x+sigma_y)/2.+math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "sigma_2=(sigma_x+sigma_y)/2.-math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "## results\n",
      "print('\\n at point G')\n",
      "print'%s %.2f %s'%('\\n sigma_1 = ',sigma_1,' kg/cm^2 (tension)')\n",
      "print'%s %.2f %s'%('\\n sigma_2 = ',sigma_2,' kg/cm^2 (compression)')\n",
      "\n",
      "print('Question was asked only to find out at A,B,C,D,E,F and G')\n",
      "print(' And in book Ans worng')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "points A,B,\n",
        "\n",
        " sigma= 1500.00  kg/cm^2 (tension)\n",
        "\n",
        " points C,D,\n",
        "\n",
        " sigma= 1500.00  kg/cm^2 (cmpression)\n",
        "\n",
        " point E\n",
        "\n",
        " tau= 1295.67 kg/cm^2 shear\n",
        "\n",
        " tau= -1108.17  kg/cm^2 shear\n",
        "\n",
        " at point G\n",
        "\n",
        " sigma_1 =  2166.73  kg/cm^2 (tension)\n",
        "\n",
        " sigma_2 =  -666.73  kg/cm^2 (compression)\n",
        "Question was asked only to find out at A,B,C,D,E,F and G\n",
        " And in book Ans worng\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex11-pg374"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate total shear and bending stress and principal stress\n",
      "##initialization of variables\n",
      "import math\n",
      "w=10. ##cm\n",
      "s=2.8 ##m\n",
      "P=1. ##tonne\n",
      "Ft=1.4 ##cm\n",
      "Wt=0.8 ##cm\n",
      "Ix=13989.5 ##cm^4\n",
      "Z=699.5 ##cm^3\n",
      "## calculations\n",
      "BM= 2.8 \n",
      "T=P*1000*8.21\n",
      "SF=P*1000.\n",
      "BS=BM*10**5/(Z)\n",
      "sigmaXA=BS*18.6/20.\n",
      "K=w*Ft*19.3+18.6*Wt*9.3\n",
      "tau_xy_C=SF/(Ix*Wt)*K\n",
      "tau_xy_A=tau_xy_C*(w*Ft*19.3)/K     \n",
      "tau_xy_B=tau_xy_A*0.5*Wt/w\n",
      "sigmaXB=sigmaXA*19.3/20.\n",
      "\n",
      "tau_max=3*Ft*8210./(w*Ft**3+37.2*Wt**3)\n",
      "tau_A=3*Wt*8210./(w*Ft**3+37.2*Wt**3)\n",
      "\n",
      "##For point A\n",
      "Shear=tau_xy_A-tau_A\n",
      "sigma_x=sigmaXA\n",
      "sigma_y=0.\n",
      "tau_xy=Shear\n",
      "sigma_1=(sigma_x+sigma_y)/2.+math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "sigma_2=(sigma_x+sigma_y)/2.-math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "\n",
      "print('For point A')\n",
      "print'%s %.2f %s'%('\\n Total shear= ',Shear,' kg/cm^2 ')\n",
      "print'%s %.2f %s'%('\\n Bending stress = ',sigma_x,' kg/cm^2 (Compr.)')\n",
      "print'%s %.2f %s %.2f %s '%('\\n Principal stresses are ',sigma_1,'(tension)kg/cm^2 'and'' ,sigma_2,'(comp.) kg/cm^2 ')\n",
      "\n",
      "##For point B\n",
      "print('\\n FOr point B')\n",
      "print'%s %.2f %s'%('\\n Bending shear stress is ',tau_xy_B,' k/cm^2')\n",
      "sigmaXB=BS*19.3/20.\n",
      "sigma_x=sigmaXB\n",
      "sigma_y=0.\n",
      "tau_xy=tau_max\n",
      "sigma_1=(sigma_x+sigma_y)/2.+math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "sigma_2=(sigma_x+sigma_y)/2.-math.sqrt((1./2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "print'%s %.2f %s %.2f %s '%('\\n Principal stresses are ',sigma_1,' (tension) kg/cm^2'and'',sigma_2,' (comp.) kg/cm^2 ')\n",
      "print('Answers in the text are approximations')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For point A\n",
        "\n",
        " Total shear=  -399.72  kg/cm^2 \n",
        "\n",
        " Bending stress =  372.27  kg/cm^2 (Compr.)\n",
        "\n",
        " Principal stresses are  627.07  -254.80 (comp.) kg/cm^2  \n",
        "\n",
        " FOr point B\n",
        "\n",
        " Bending shear stress is  0.97  k/cm^2\n",
        "\n",
        " Principal stresses are  959.64  -573.36  (comp.) kg/cm^2  \n",
        "Answers in the text are approximations\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex12-pg380"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calcualte permissible stress and developed stress\n",
      "##initialization of variables\n",
      "import math\n",
      "b=10. ##cm\n",
      "h=10. ##cm\n",
      "P=5. ##tonne\n",
      "e=1. ##cm\n",
      "E=12*10**4 ##kg/cm^2\n",
      "str=130. ## kg/cm^2\n",
      "n=3.\n",
      "L=2. ##m\n",
      "## calculations\n",
      "L=L*100. ##cm\n",
      "Pcr=math.pi**2*E*b*h**3/(12.*L**2.)\n",
      "Pcr=Pcr/1000.\n",
      "Smax=-P*1000./(b*h)-(P*1000.*1.*5.*12./10**4)*1./(1.-(n*P/Pcr))\n",
      "## results\n",
      "print'%s %.2f %s'%('permissible stress = ',str,' kg/cm^2')\n",
      "print'%s %.2f %s'%('\\n develoed stress = ',Smax,' kg/cm^2')\n",
      "print('\\n Since it is below the permissible stress, the design is safe')\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "permissible stress =  130.00  kg/cm^2\n",
        "\n",
        " develoed stress =  -126.52  kg/cm^2\n",
        "\n",
        " Since it is below the permissible stress, the design is safe\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex13-pg381"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "##initializatio of variables\n",
      "#calculate Smax and percentage error\n",
      "## linked to 9.13\n",
      "b=10. ##cm\n",
      "h=10. ##cm\n",
      "P=5. ##tonne\n",
      "e=1. ##cm\n",
      "E=12.*10**4 ##kg/cm^2\n",
      "str=130. ## kg/cm^2\n",
      "n=3.\n",
      "L=2. ##m\n",
      "## calculations\n",
      "L=L*100. ##cm\n",
      "Pcr=math.pi**2*E*b*h**3/(12*L**2)\n",
      "Pcr=Pcr/1000.\n",
      "Smax=-P*1000./(b*h)-(P*1000.*1.*5.*12./10**4)*1./(1.-(n*P/Pcr))\n",
      "Smax=abs(Smax)\n",
      "\n",
      "rr=b*h**3/(12.*100.)\n",
      "Smax_se=P*1000./(b*h)*(1+e*5/rr*(1./math.cos(math.pi/2.*math.sqrt(n*P/Pcr))))\n",
      "Perror=(Smax-Smax_se)/Smax\n",
      "Perror=Perror*100.\n",
      "Perror=abs(Perror)\n",
      "## results\n",
      "print'%s %.2f %s'%('Using secent formula, stress obtained is ',Smax_se,' kg/cm^2')\n",
      "print'%s %.2f %s'%('\\n hence, the percentage error ',Perror,'')\n",
      "## approximate answees in the text\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Using secent formula, stress obtained is  138.45  kg/cm^2\n",
        "\n",
        " hence, the percentage error  9.43 \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex14-pg382"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "##initialization of variables\n",
      "#calculate maximum stress developed\n",
      "P=400. ##kg/m\n",
      "L=10. ##m\n",
      "F=10. ##tonne\n",
      "n=3.\n",
      "Ixx=5943.1 ##cm^4\n",
      "A=52.03 ##cm^2\n",
      "rx=10.69 ##cm\n",
      "E=2*10**6 ##kg/cm^2\n",
      "## calculations\n",
      "Pcr=math.pi**2*E*Ixx/((L*100.)**2.)\n",
      "Pcr=Pcr/1000.\n",
      "e=P*L**2/(8*F*1000.)\n",
      "g=e*12.5*100./rx**2\n",
      "Smax=F*1000./A*(1.+g*1./(1-n*(F/Pcr)))\n",
      "## results\n",
      "print'%s %.2f %s'%('The maximum stress developed is ',Smax,' kg/cm^2')\n",
      "\n",
      "print('approximate calculations involved in the text book')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum stress developed is  1604.54  kg/cm^2\n",
        "approximate calculations involved in the text book\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex15-pg383"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate maximum stress developed\n",
      "##initialization of variables\n",
      "import math\n",
      "## linked to 9_14\n",
      "## calculations\n",
      "P=400. ##kg/m\n",
      "L=10. ##m\n",
      "F=10. ##tonne\n",
      "n=3.\n",
      "Ixx=5943.1 ##cm^4\n",
      "A=52.03 ##cm^2\n",
      "rx=10.69 ##cm\n",
      "E=2*10**6 ##kg/cm^2\n",
      "Pcr=math.pi**2.*E*Ixx/((L*100.)**2)\n",
      "Pcr=Pcr/1000.\n",
      "e=P*L**2./(8.*F*1000.)\n",
      "g=e*12.5*100./rx**2.\n",
      "Smax=F*1000./A*(1+g*1./(1.+n*(F/Pcr)))\n",
      "## results\n",
      "print'%s %.2f %s'%('The maximum stress developed is ',Smax,' kg/cm^2')\n",
      "\n",
      "print('approximate answer in the text')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum stress developed is  1029.29  kg/cm^2\n",
        "approximate answer in the text\n"
       ]
      }
     ],
     "prompt_number": 36
    }
   ],
   "metadata": {}
  }
 ]
}