{
 "metadata": {
  "name": "",
  "signature": "sha256:dfaf77db4c85042efee22fb6763c694430ec032753268abcad247883d2c6e223"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter10-Beams On Elastic Foundations"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg366"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the maximum deflection and maximum bending moment and maximum flexural stress in the rail for single wheel load and maximum bending moment\n",
      "## initialization of variables\n",
      "import math\n",
      "##part(a)\n",
      "E=200. ##GPa\n",
      "d=184. ##mm\n",
      "c=99.1 ##mm\n",
      "Ix=36.9e+06##mm^4\n",
      "k=14.0 ##N/mm^2\n",
      "P=170. ##kN\n",
      "##calculations\n",
      "E=E*10**3\n",
      "P=P*10**3\n",
      "Beta=(k/(4.*E*Ix))**(1/4.)\n",
      "y_max=P*Beta/(2.*k)\n",
      "M_max=P/(4.*Beta)\n",
      "S_max=M_max*c/Ix\n",
      "print('part (a)')\n",
      "print\"%s %.2f %s\"%('\\n y_max = ',y_max,' mm')\n",
      "print\"%s %.2f %s\"%('\\n M_max = ',M_max/10**6,' kN.m')\n",
      "print\"%s %.2f %s\"%('\\n S_max = ',S_max,' MPa')\n",
      "## part (b)\n",
      "z1=1.7##m\n",
      "z1=z1*10**3 ##mm\n",
      "z2=2*z1\n",
      "## A_bz=exp(-Beta*z)*(sin(Beta*z)+cos(Beta*z))\n",
      "## C_bz=exp(-Beta*z)*(-sin(Beta*z)+cos(Beta*z))\n",
      "A_bzo=1.\n",
      "C_bzo=1.\n",
      "A_bz1=math.exp(-Beta*z1)*(math.sin(Beta*z1)+math.cos(Beta*z1))\n",
      "A_bz2=math.exp(-Beta*z2)*(math.sin(Beta*z2)+math.cos(Beta*z2))\n",
      "C_bz1=math.exp(-Beta*z1)*(-math.sin(Beta*z1)+math.cos(Beta*z1))\n",
      "C_bz2=math.exp(-Beta*z2)*(-math.sin(Beta*z2)+math.cos(Beta*z2))\n",
      "y_end=P*Beta/(2.*k)*(A_bzo+A_bz1+A_bz2)\n",
      "M_end=P/(4.*Beta)*(C_bzo+C_bz1+C_bz2)\n",
      "y_center=P*Beta/(2.*k)*(A_bzo+2.*A_bz1)\n",
      "M_center=P/(4.*Beta)*(C_bzo+2.*C_bz1)\n",
      "y_max=max(y_end,y_center)\n",
      "M_max=max(M_end,M_center)\n",
      "S_max=M_max*c/Ix\n",
      "print('\\n part(b)')\n",
      "print\"%s %.2f %s\"%('\\n y_max = ',y_max,' mm')\n",
      "print\"%s %.2f %s\"%('\\n M_max = ',M_max/10**6,' kN.m')\n",
      "print\"%s %.2f %s\"%('\\n S_max =',S_max,' MPa')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "part (a)\n",
        "\n",
        " y_max =  5.04  mm\n",
        "\n",
        " M_max =  51.21  kN.m\n",
        "\n",
        " S_max =  137.54  MPa\n",
        "\n",
        " part(b)\n",
        "\n",
        " y_max =  7.86  mm\n",
        "\n",
        " M_max =  37.02  kN.m\n",
        "\n",
        " S_max = 99.42  MPa\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-pg367"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "## initialization of variables\n",
      "##calculate the load carried by each spring and deflection of beam\n",
      "d=100. ##mm\n",
      "Ix=2.45e+06 ##mm^4\n",
      "E=72. ##GPa\n",
      "L=6.8 ##m\n",
      "K=110. ##N/mm\n",
      "l=1.1 ##m\n",
      "P=12. ##kN\n",
      "##calculations\n",
      "E=E*10**3\n",
      "P=P*10**3\n",
      "l=l*10**3\n",
      "k=K/l\n",
      "L1=7.*l\n",
      "Beta=(k/(4.*E*Ix))**(1/4.)\n",
      "if(l<math.pi/(4.*Beta)):\n",
      "\ty_max=P*Beta/(2.*k)\n",
      "\n",
      "if(L1>3*math.pi/(2.*Beta)):\n",
      "\tM_max=P/(4.*Beta)\n",
      "S_max=M_max*d/(2.*Ix)\n",
      "\n",
      "print\"%s %.2f %s\"%('y_max = ',y_max,' mm')\n",
      "print\"%s %.2f %s\"%('\\n M_max = ',M_max/10**6,' kN.m')\n",
      "print\"%s %.2f %s\"%('\\n S_max = ',S_max,' MPa')\n",
      "A_bl=math.exp(-Beta*l)*(math.sin(Beta*l)+math.cos(Beta*l))\n",
      "A_2bl=math.exp(-Beta*2*l)*(math.sin(Beta*2*l)+math.cos(Beta*2*l))\n",
      "A_3bl=math.exp(-Beta*3*l)*(math.sin(Beta*3*l)+math.cos(Beta*3*l))\n",
      "y_C=P*Beta/(2.*k)*A_bl\n",
      "y_B=P*Beta/(2.*k)*A_2bl\n",
      "y_A=P*Beta/(2.*k)*A_3bl\n",
      "print\"%s %.2f %s\"%('\\n y_C = ',y_C,' mm')\n",
      "print\"%s %.2f %s\"%('\\n y_B = ',y_B,' mm')\n",
      "print\"%s %.2f %s\"%('\\n y_A = ',y_A,' mm' )\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "y_max =  36.81  mm\n",
        "\n",
        " M_max =  4.89  kN.m\n",
        "\n",
        " S_max =  99.78  MPa\n",
        "\n",
        " y_C =  26.35  mm\n",
        "\n",
        " y_B =  11.41  mm\n",
        "\n",
        " y_A =  2.24  mm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex4-pg372"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "## initialization of variables\n",
      "##calculate the maximum deflection maximum flexural stress and maximum pressure between the beam and foundation\n",
      "E=10. ##GPa\n",
      "h=200. ##mm\n",
      "b=100. ##mm\n",
      "ko=0.04 ##N/mm^3\n",
      "w=35. ##N/mm\n",
      "L1=3.61 ##m\n",
      "##calculations\n",
      "E=E*10**3\n",
      "L1=L1*10**3\n",
      "k=b*ko\n",
      "Ix=b*h**3/12.\n",
      "Beta=(k/(4.*E*Ix))**(1/4.)\n",
      "ba=2.00 ## ba = Beta*a  based on the discussion\n",
      "##D_bz=exp(-Beta*z)*sin(Beta*z)\n",
      "D_ba=math.exp(-ba)*math.cos(ba)\n",
      "y_max=w/k*(1-D_ba)\n",
      "ba=0.777 ##Beta*a\n",
      "bb=4.777 ##Beta*b\n",
      "B_ba=math.exp(-ba)*math.sin(ba)\n",
      "B_bb=math.exp(-bb)*math.sin(bb)\n",
      "M_max=abs(-w*(B_ba-B_bb)/(4.*Beta**2))\n",
      "c=h/2.\n",
      "S_max=M_max*c/Ix\n",
      "## calculation of M_H\n",
      "ba=math.pi/4. ##Beta*a\n",
      "bb=4-math.pi/4. ##Beta*b\n",
      "B_ba=math.exp(-ba)*math.sin(ba)\n",
      "B_bb=math.exp(-bb)*math.sin(bb)\n",
      "M_H=w/(4.*Beta**2)*(B_ba+B_bb)\n",
      "print\"%s %.2f %s\"%('y_max = ',y_max,' mm')\n",
      "print\"%s %.2f %s\"%('\\n M_max = ',M_max/10**6,' kN.m')\n",
      "print\"%s %.2f %s\"%('\\n S_max = ',S_max,' MPa')\n",
      "print\"%s %.2f %s\"%('\\n M_H = ',M_H/10**6,' kN.m')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "y_max =  9.24  mm\n",
        "\n",
        " M_max =  2.36  kN.m\n",
        "\n",
        " S_max =  3.54  MPa\n",
        "\n",
        " M_H =  2.28  kN.m\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5-pg375"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "## initialization of variables\n",
      "##calculate the maximum deflection and maximum flexural stress in the beam and locations of each\n",
      "E=200. ##GPa\n",
      "h=102. ##mm\n",
      "b=68. ##mm\n",
      "Ix=2.53e+06 ##mm^4\n",
      "L1=4. ##m\n",
      "ko=0.35 ##N/mm^3\n",
      "P=30.0 ##kN\n",
      "##calculations\n",
      "E=E*10**3\n",
      "P=P*10**3\n",
      "L1=L1*10**3\n",
      "k=b*ko\n",
      "Beta=(k/(4.*E*Ix))**(1/4.)\n",
      "if(L1>3*math.pi/(2.*Beta)):\n",
      "    y_max=2.*P*Beta/k\n",
      "M_max=-0.3224*P/Beta\n",
      "S_max=abs(M_max*h/(2.*Ix))\n",
      "\n",
      "z=math.pi/(4.*Beta)\n",
      "print\"%s %.2f %s\"%('y_max = ',y_max,' mm')\n",
      "print\"%s %.2f %s\"%('\\n M_max = ',M_max,' kN.m')\n",
      "print\"%s %.2f %s\"%('\\n S_max = ',S_max,' MPa')\n",
      "print\"%s %.2f %s\"%('\\n Location of Sigma_max is z = ',z,' mm') \n",
      "    \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "y_max =  4.67  mm\n",
        "\n",
        " M_max =  -5223055.92  kN.m\n",
        "\n",
        " S_max =  105.29  MPa\n",
        "\n",
        " Location of Sigma_max is z =  424.13  mm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex6-pg377"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "## initialization of variables\n",
      "##calculate the maximum deflection and maximum flexural stress\n",
      "P=30.0 ##kN\n",
      "a=500. ##mm\n",
      "h=102. ##mm\n",
      "b=68. ##mm\n",
      "k=23.8 ##N/mm**2\n",
      "Beta=0.001852\n",
      "Ix=2.53e+06 ##mm**4\n",
      "##calculations\n",
      "P=P*10**3.\n",
      "C_ba=math.exp(-Beta*a)*(-math.sin(Beta*a)+math.cos(Beta*a))\n",
      "D_ba=math.exp(-Beta*a)*math.cos(Beta*a)\n",
      "## y = P*Beta/(2*k)*(A_bz+2*D_ba*D_baz+C_ba*C_baz))\n",
      "## Mx = P/(4*Beta)*(C_bz-2*D_ba*B_baz-C_ba*A_baz)\n",
      "A_ba=math.exp(-Beta*a)*(math.sin(Beta*a)+math.cos(Beta*a))\n",
      "B_ba=math.exp(-Beta*a)*math.sin(Beta*a)\n",
      "C_ba=math.exp(-Beta*a)*(-math.sin(Beta*a)+math.cos(Beta*a))\n",
      "D_ba=math.exp(-Beta*a)*math.cos(Beta*a)\n",
      "z1=424 ##mm\n",
      "z=z1-a\n",
      "A_bz=math.exp(-Beta*z)*(math.sin(Beta*z)+math.cos(Beta*z))\n",
      "B_bz=math.exp(-Beta*z)*math.sin(Beta*z)\n",
      "C_bz=math.exp(-Beta*z)*(-math.sin(Beta*z)+math.cos(Beta*z))\n",
      "D_bz=math.exp(-Beta*z)*math.cos(Beta*z)\n",
      "## to find out X_baz\n",
      "z=a+z\n",
      "A_baz=math.exp(-Beta*z)*(math.sin(Beta*z)+math.cos(Beta*z))\n",
      "B_baz=math.exp(-Beta*z)*math.sin(Beta*z)\n",
      "C_baz=math.exp(-Beta*z)*(-math.sin(Beta*z)+math.cos(Beta*z))\n",
      "D_baz=math.exp(-Beta*z)*math.cos(Beta*z)\n",
      "y_max = P*Beta/(2*k)*(A_bz+2*D_ba*D_baz+C_ba*C_baz)\n",
      "print\"%s %.2f %s\"%('y_max = ',y_max,' mm')\n",
      "## For M_max\n",
      "z1=500. ##mm\n",
      "z=z1-a\n",
      "A_bz=math.exp(-Beta*z)*(math.sin(Beta*z)+math.cos(Beta*z))\n",
      "B_bz=math.exp(-Beta*z)*math.sin(Beta*z)\n",
      "C_bz=math.exp(-Beta*z)*(-math.sin(Beta*z)+math.cos(Beta*z))\n",
      "D_bz=math.exp(-Beta*z)*math.cos(Beta*z)\n",
      "## to find out X_baz\n",
      "z=a+z\n",
      "A_baz=math.exp(-Beta*z)*(math.sin(Beta*z)+math.cos(Beta*z))\n",
      "B_baz=math.exp(-Beta*z)*math.sin(Beta*z)\n",
      "C_baz=math.exp(-Beta*z)*(-math.sin(Beta*z)+math.cos(Beta*z))\n",
      "D_baz=math.exp(-Beta*z)*math.cos(Beta*z)\n",
      "M_max = P/(4.*Beta)*(C_bz-2.*D_ba*B_baz-C_ba*A_baz)\n",
      "print\"%s %.2f %s\"%('\\n M_max = ',M_max,' N.mm')\n",
      "S_max=M_max*h/(2.*Ix)\n",
      "print\"%s %.2f %s\"%('\\n Sigma_max = ',S_max,' MPa')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "y_max =  1.32  mm\n",
        "\n",
        " M_max =  3615504.81  N.mm\n",
        "\n",
        " Sigma_max =  72.88  MPa\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex7-pg381"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "## initialization of variables\n",
      "##calculate the maximum shear stress and \n",
      "D=30. ##m\n",
      "t=10. ##m\n",
      "h=20. ##mm\n",
      "E=200. ##GPa\n",
      "v=0.29\n",
      "rho=900. ##kg/m**3\n",
      "##calculations\n",
      "##part (a)\n",
      "E=E*10**3.\n",
      "a=D/2*10**3.\n",
      "p=t*10**3*9.807*rho*10**-9\n",
      "S_th=p*a/h\n",
      "tau_max=S_th/2.\n",
      "print('part (a)')\n",
      "print\"%s %.2f %s\"%('\\n Maximum shear stress= ',tau_max,' MPa')\n",
      "## part (b)\n",
      "k=E*h/(a**2)\n",
      "Beta=(3*(1.-v**2)/(h**2*a**2))**(1/4.)\n",
      "L1=3.*math.pi/(4.*Beta) ##L1=L/2\n",
      "u=S_th*a/E\n",
      "w=2.*k*u/(Beta)\n",
      "M_max=w/(4.*Beta)\n",
      "Szz_max=M_max*(h/2.)/(h**3/12.)\n",
      "Sth_max=v*Szz_max\n",
      "tau_max=Szz_max/2.\n",
      "u_b=w*(1-v)*a/(2*E*h)\n",
      "print('\\n part (b)')\n",
      "print\"%s %.2f %s\"%('\\n Maximum shear stress= ',tau_max,' MPa')\n",
      "print\"%s %.2f %s\"%('\\n u_bottom = ',u_b,' mm')\n",
      "## part (c)\n",
      "w=u*k/(2.*Beta)\n",
      "z=math.pi/(4.*Beta)\n",
      "B_bz=math.exp(-Beta*z)*math.sin(Beta*z)\n",
      "M_max=-w*B_bz/Beta\n",
      "c=6.\n",
      "I=h**2\n",
      "Szz_max=(M_max*c/I)\n",
      "S_th1=v*(Szz_max)\n",
      "k=0.3224\n",
      "S_th2=(1-k)*S_th\n",
      "Sigma_th=S_th1+S_th2\n",
      "tau_max=(Sigma_th-Szz_max)/2.\n",
      "print('\\n part (c)')\n",
      "print\"%s %.2f %s\"%('\\n Maximum shear stress= ',tau_max,' MPa')\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "part (a)\n",
        "\n",
        " Maximum shear stress=  33.10  MPa\n",
        "\n",
        " part (b)\n",
        "\n",
        " Maximum shear stress=  59.90  MPa\n",
        "\n",
        " u_bottom =  0.10  mm\n",
        "\n",
        " part (c)\n",
        "\n",
        " Maximum shear stress=  36.14  MPa\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}