{
 "metadata": {
  "name": "",
  "signature": "sha256:2328a7dc3cc0ee8a847caf61a092e7220be4bed1f89464a7bc727661ff6069c6"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter1-Introduction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the The ultimate strength  and the yield strength\n",
      "## initialization of variables\n",
      "import math\n",
      "## part (a)\n",
      "a=700. ## M Pa from figure 1.8\n",
      "b=100. ## M Pafrom figure 1.8\n",
      "m=1/6. ## from figure 1.8\n",
      "Y=450. ## M Pa from figure 1.9\n",
      "##calculations\n",
      "sigma_u=a+m*b\n",
      "## results\n",
      "print('\\n part (a) \\n')\n",
      "print\"%s %.2f %s\"%(' The ultimate strength is sigma = ',sigma_u,' M Pa')\n",
      "print\"%s %.2f %s\"%('\\n and the yield strength is Y = ',Y,'M Pa')\n",
      "\n",
      "## part (b)\n",
      "c1=62. ## from figure 1.8\n",
      "d1=0.025 ## from figure 1.8\n",
      "c2=27. ## from figure 1.10a\n",
      "d2=0.04 ## from figure 1.10a\n",
      "## calculations\n",
      "U_f1=c1*b*d1*10**6\n",
      "U_f2=c2*b*d2*10**6\n",
      "## results\n",
      "print('\\n part (b)')\n",
      "print\"%s %.2e %s\"%('\\n The modulus of toughness for alloy steel is Uf = ',U_f1,' N/m^2')\n",
      "print\"%s %.2e %s\"%('\\n and structural steel is Uf = ',U_f2,' N/m^2')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " part (a) \n",
        "\n",
        " The ultimate strength is sigma =  716.67  M Pa\n",
        "\n",
        " and the yield strength is Y =  450.00 M Pa\n",
        "\n",
        " part (b)\n",
        "\n",
        " The modulus of toughness for alloy steel is Uf =  1.55e+08  N/m^2\n",
        "\n",
        " and structural steel is Uf =  1.08e+08  N/m^2\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-pg16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the permanet strain\n",
      "## initialization of variables\n",
      "import math\n",
      "sigma=500. ## Stress M Pa\n",
      "eps=0.0073 ## Strain\n",
      "sigma_A=343. ## M Pa from figure 1.9\n",
      "eps_A=0.00172 ## from figure 1.9\n",
      "## part (a)\n",
      "E=sigma_A/eps_A\n",
      "\n",
      "## part (B)\n",
      "eps_e=sigma/E\n",
      "eps_p=eps-eps_e\n",
      "## results\n",
      "print(' part (a) \\n')\n",
      "print\"%s %.2f %s\"%(' The modulus of elasticity of the rod is E = ',E/1000,' G Pa')\n",
      "print('\\n part (b)')\n",
      "print\"%s %.4f %s\"%('\\n the permanent strain is = ',eps_p,'')\n",
      "print\"%s %.4f %s\"%('\\n and the strain recovered is =',eps_e,'')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " part (a) \n",
        "\n",
        " The modulus of elasticity of the rod is E =  199.42  G Pa\n",
        "\n",
        " part (b)\n",
        "\n",
        " the permanent strain is =  0.0048 \n",
        "\n",
        " and the strain recovered is = 0.0025 \n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex3-pg19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##calculate the diameter\n",
      "## initialization of variables\n",
      "import math\n",
      "D=25. ## kN\n",
      "L=60. ## kN\n",
      "W=30. ##kN\n",
      "Y=250. ## M Pa\n",
      "safety=5./3. ## AISC, 1989\n",
      "## calculations\n",
      "Q=(D+L+W)*10**3. ## converted to N\n",
      "A=safety*Q/Y\n",
      "r=math.sqrt(A/math.pi)+0.5 ## additional 0.5 mm is for extra safety\n",
      "d=1.8*r ## diameter\n",
      "## results\n",
      "print('Part (a) \\n ')\n",
      "print\"%s %.2f %s %.2f %s \"%('A rod of ',d,' mm'and ' in diameter, with a cross sectional area of ',math.pi*(d**2./4.),' mm^2, is adequate')\n",
      "## The diameter is correct as given in the textbook. Area doesn't match due to rounding off error and partly because it's a design problem.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part (a) \n",
        " \n",
        "A rod of  29.02  in diameter, with a cross sectional area of  661.39  mm^2, is adequate \n"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}