{
 "metadata": {
  "name": "",
  "signature": "sha256:a578101ccbcde1509a97d02129920a3db28366bac3115a1e48214601165df384"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 : Flow Through Open Channels"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.1 page no : 196"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "i = 0.000146\n",
      "v = 2.8 \t\t\t#ft/sec\n",
      "m = 7. \t\t\t#ft\n",
      "#CALCULAIONS\n",
      "C = v/math.sqrt(m*i)\n",
      "K = (157.6-C)*math.sqrt(m)/C\n",
      "#RESULTS\n",
      "print  'C  = %.3f  '%(C)\n",
      "print  'K  = %.3f  '%(K)\n",
      "\n",
      "# answers may vary because of rounding error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "C  = 87.586  \n",
        "K  = 2.115  \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.2 pageno : 197"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "b = 10. \t\t\t#ft\n",
      "n = 1.\n",
      "i = 1./1000\n",
      "d = 1.5 \t\t\t#ft\n",
      "C = 110.\n",
      "w = 62.4 \t\t\t#lb/ft**3\n",
      "#CALCULATIONS\n",
      "L = math.sqrt(2*d**2)\n",
      "P = b+2*L\n",
      "A = d*(b+n*d)\n",
      "m = A/P\n",
      "v = round(C*math.sqrt(m*i),2)\n",
      "A_v = round(A*v)\n",
      "Q = A_v*w*60*60*24/10\n",
      "#RESULTS\n",
      "print  'Discharge  = %.2e gal/day '%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge  = 3.56e+07 gal/day \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.3 page no : 197"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "b = 10. \t\t\t#ft\n",
      "n = 2.\n",
      "d = 3.5 \t\t\t#ft\n",
      "i = 1./625\n",
      "#CALCULATIONS\n",
      "A = d*(b+(d/n))\n",
      "L = math.sqrt(d**2+(d/2)**2)\n",
      "P = b+2*L\n",
      "m = A/P\n",
      "v = 1.486*m**(2./3)*i**0.5/0.03\n",
      "Q = A*v\n",
      "#RESULTS\n",
      "print  'Discharge  = %.1f cuses '%(Q)\n",
      "\n",
      "# Note : answer may vary because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge  = 142.3 cuses \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.4 pageno :  198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "d = 3. \t\t\t#ft\n",
      "i = 1./4500\n",
      "C = 80.\n",
      "#CALCULATIONS\n",
      "A = 0.5*(math.pi*d**2/4)\n",
      "P = math.pi*d/2\n",
      "m = A/P\n",
      "v = C*math.sqrt(m*i)\n",
      "Q = v*A\n",
      "#RESULTS\n",
      "print  'Discharge  = %.2f cuses '%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge  = 3.65 cuses \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.5 page  no : 198\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "A = 2500. \t\t\t#acres\n",
      "n = 20.\n",
      "Q = 40. \t\t\t#gal/head\n",
      "C = 130.\n",
      "i = 1./3000\n",
      "p  = 7. \t\t\t#per cent\n",
      "w = 62.4 \t\t\t#lb/ft**3\n",
      "#CALCULATIONS\n",
      "Q1 = Q*50000*p/(60*100*60*w)\n",
      "Q2 = Q1+(A*4840*9/(12*24*60*60))\n",
      "d = (Q2*8*math.sqrt(4/i)/(math.pi*C))**0.4\n",
      "#RESULTS\n",
      "print  'Diameter  = %.3f ft '%(d)\n",
      "\n",
      "# answer is different because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Diameter  = 8.754 ft \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.6 page no : 199"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "Qt = 150000. \t\t\t#cuses\n",
      "i = 1/10000.\n",
      "n1 = 1.\n",
      "n2 = 2./3\n",
      "d1 = 30. \t\t\t#ft\n",
      "C1 = 100.\n",
      "C2 = 75.\n",
      "b1 = 600. \t\t\t#ft\n",
      "b2 = 2000. \t\t\t#ft\n",
      "r = 2.\n",
      "A1 = (b1+d1)*d1\n",
      "P1 = b1+(2*d1*math.sqrt(2))\n",
      "m1 = A1/P1\n",
      "v1 = C1*math.sqrt(m1*i)\n",
      "Q1 = A1*v1\n",
      "Q2 = Qt-Q1\n",
      "v2 = v1/2\n",
      "A2 = Q2/v2\n",
      "d2 = (-b2+math.sqrt(b2**2+4*1.5*A2))/(2*1.5)\n",
      "#RESULTS\n",
      "print  'depth of water  = %.f ft '%(d2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "depth of water  = 10 ft \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.7 page no :  200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "d = 3. \t\t\t#ft\n",
      "i = 1./1000\n",
      "C = 65.\n",
      "Cd = 0.56\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "h1 = 7.5 \t\t\t#ft\n",
      "h2 = 3. \t\t\t#ft\n",
      "#CALCULATIONS\n",
      "m = d\n",
      "v = C*math.sqrt(m*i)\n",
      "Q = v*d\n",
      "H = (Q*d/(2*math.sqrt(2*g)*Cd))**(2./3)\n",
      "h = h1+h2-H\n",
      "#RESULTS\n",
      "print  'Height of dam  = %.2f ft '%(h)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Height of dam  = 8.17 ft \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.8  page no : 207"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "Q =100.\t\t\t#cuses\n",
      "v = 2. \t\t\t#/ft/sec\n",
      "n = 1.5\n",
      "A = 50. \t\t\t#ft**2\n",
      "C = 120.\n",
      "#CALCULATIONS\n",
      "d = math.sqrt((Q/v)/(2*math.sqrt(n**2+1)-n))\n",
      "m = A/d\n",
      "h1 = m-n*d\n",
      "h2 = m+n*d\n",
      "i = (v/C)**2*(2/d)\n",
      "#RSULTS\n",
      "print  'Depth  = %.2f ft '%(d)\n",
      "print  ' Bottom width  = %.2f ft '%(h1)\n",
      "print  ' Top width  = %.2f ft '%(h2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Depth  = 4.87 ft \n",
        " Bottom width  = 2.95 ft \n",
        " Top width  = 17.57 ft \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.9 page no :  208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "Q = 1100. \t\t\t#cuses\n",
      "i = 1/1800.\n",
      "C = 95.\n",
      "n = 1.5\n",
      "#CALCULATIONS\n",
      "d = ((Q*math.sqrt(3600)/C)/(n+0.6))**0.4\n",
      "b = 0.6*d\n",
      "ht = b+2*(n*d)\n",
      "#RESULTS\n",
      "print  'Depth  = %.1f ft '%(d)\n",
      "print  ' Bottom width  = %.2f ft '%(b)\n",
      "print  ' Top width  = %.1f ft '%(ht)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Depth  = 10.2 ft \n",
        " Bottom width  = 6.11 ft \n",
        " Top width  = 36.7 ft \n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.10 pageno : 209"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "\n",
      "n = 1.5\n",
      "Q = 800. \t\t\t#cuses\n",
      "i = 2.5/5280\n",
      "n1 = 9.24\n",
      "r = 0.6\n",
      "k = 1.49\n",
      "#CALCULATIONS\n",
      "d = (k*10**7*4/n1)**(1/8.)\n",
      "#RESULTS\n",
      "print  'Depth of channel  = %.1f ft '%(d)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Depth of channel  = 7.1 ft \n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.11 page no :  210"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "d = 8. \t\t\t#ft\n",
      "i = 1./1200\n",
      "C = 90.\n",
      "a = 308. \t\t\t#degrees\n",
      "#CALCULATIONS\n",
      "h = 0.95*d\n",
      "A = (d/2)**2*(a*(math.pi/180)-math.sin(math.radians(a)))/2\n",
      "m = 0.29*d\n",
      "Q = A*C*math.sqrt(m*i)\n",
      "#RESULTS\n",
      "print  'Discharge  = %.f cuses '%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge  = 195 cuses \n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.12 page no : 213"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "v = 5. \t\t\t#ft/sec\n",
      "Q = 500. \t\t\t#cuses\n",
      "w = 25. \t\t\t#ft\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "h = (Q/v)/w\n",
      "E = h+(v**2/(2*g))\n",
      "he = round((400*2/64.4)**(1./3),2)\n",
      "ve = round(20./2.32,2)\n",
      "Emin = he + (ve**2 / (g*2))\n",
      "\n",
      "#RESULTS\n",
      "print  'Specific energy  = %.2f ft '%(E)\n",
      "print \"Critical Velocity of flow = %.2f ft/sec\"%ve\n",
      "print 'Minimum energy Emin = %.2f ft'%Emin"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific energy  = 4.39 ft \n",
        "Critical Velocity of flow = 8.62 ft/sec\n",
        "Minimum energy Emin = 3.47 ft\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.13 page no : 216"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "\n",
      "i = 1./5000\n",
      "C = 100.\n",
      "b = 50. \t\t\t#ft\n",
      "h = 10. \t\t\t#ft\n",
      "Q = 1000. \t\t\t#cuses\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "f = 2.*g/C**2\n",
      "m = (b*h)/(b+2*h)\n",
      "v = Q/(b*h)\n",
      "r = (i-(f*4/(2*g*m)))/(1-(2**2/(g*h)))\n",
      "s = i-r\n",
      "#RESULTS\n",
      "print  'Slope  = %.6f  '%(s)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Slope  = 0.000054  \n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.14 page no : 221"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#Initialization of variables\n",
      "B =48. \t\t\t#ft\n",
      "D =5. \t\t\t#ft\n",
      "f =0.005\n",
      "i =1./1000\n",
      "g =32.2\n",
      "#calculations\n",
      "C =math.sqrt(2*g/f)\n",
      "m =B*D/(B+2*D)\n",
      "V =C*math.sqrt(m*i)\n",
      "Q =B*D*V\n",
      "Dc =(Q**2 /(g*B**2))**(1./3)\n",
      "d1 =2.25 \t\t\t#ft\n",
      "Q1 =1*D*V\n",
      "d2 =-d1/2 + math.sqrt(2*Q1**2 /(g*d1) + d1**2 /4)\n",
      "hd =d2-d1\n",
      "#results\n",
      "print \"height required  = %.1f ft\"%(hd)\n",
      "#The answer is a bit different due to rounding off error in textbook\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "height required  = 2.8 ft\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.15 page no : 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "Q = 360. \t\t\t#cfs\n",
      "d1 = 1. \t\t\t#ft\n",
      "B = 18. \t\t\t#ft\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "w1 = 624. \t\t\t#lb/ft**3\n",
      "d2 =4.5  \t\t\t#ft\n",
      "#CALCULATIONS\n",
      "w = Q/B\n",
      "v1 = w/d1\n",
      "v2 = v1/d2\n",
      "d2 = -0.5+math.sqrt((2*v1**2*d1/(g))+(d1**2./4))\n",
      "El = (d1+(w**2/(2*g)))-(d2+(v2**2/(2*g)))\n",
      "EL = round(w1*Q*El,-4)\n",
      "#RESULTS\n",
      "print  'loss in energy  = %.f lb '%(EL)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "loss in energy  = 540000 lb \n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.16 page no : 223"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "d1 = 4. \t\t\t#ft\n",
      "v1 = 60. \t\t\t#ft/sec\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALULATIONS\n",
      "d2 = d1*(math.sqrt(1+8*v1**2/(g*d1))-1)/2.\n",
      "#RESULTS\n",
      "print  'd2  = %.f ft '%(d2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "d2  = 28 ft \n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.17 page no : 224"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "b = 150. \t\t\t#ft\n",
      "d = 12. \t\t\t#ft\n",
      "N = 0.03\n",
      "i = 1./10000\n",
      "h = 10. \t\t\t#ft\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "A = b*d\n",
      "P = b+2*d\n",
      "m = A/P\n",
      "v = m**(2/3.)*1.49*i**0.5/N\n",
      "A1 = b*(h+d)\n",
      "P1 = b+2*(h+d)\n",
      "m1 = A1/P1\n",
      "C1 = 1.49*m1**(1./6)/N\n",
      "v1 = A*v/A1\n",
      "s = (i-(v1**2/(C1**2*m1)))/(1-(v1**2/(g*(h+d))))\n",
      "L = round(2*h/s,-3)\n",
      "#RESULTS\n",
      "print  'Length of back water  = %.f ft '%(L)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Length of back water  = 236000 ft \n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.18 page no : 227"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "b1 = 3.2 \t\t\t#ft\n",
      "b2 = 1.3 \t\t\t#ft\n",
      "h1 = 1.86 \t\t\t#ft\n",
      "h2 = 1.63 \t\t\t#ft\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "a1 = b1*h1\n",
      "a2 = b2*h2\n",
      "Q = a1*a2*math.sqrt(2*g)*math.sqrt(h1-h2)/(math.sqrt(a1**2-a2**2))\n",
      "#RESULTS\n",
      "print  'Discharge  = %.1f cuses '%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge  = 8.7 cuses \n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.19 page no : 227"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "b1 = 4. \t\t\t#ft\n",
      "b2 = 2. \t\t\t#ft\n",
      "h1 = 2. \t\t\t#ft\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "Qmax = 3.09*b2*h1**1.5\n",
      "v1 = Qmax/(b1*h1)\n",
      "H = h1+(v1**2/(2*g))\n",
      "Qmax2 = 3.09*b2*H**1.5\n",
      "h2 = 2*H/3\n",
      "#RESULTS\n",
      "print  'Qmax  = %.2f cfs '%(Qmax2)\n",
      "print  'h2  = %.3f ft '%(h2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Qmax  = 18.46 cfs \n",
        "h2  = 1.383 ft \n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.20 pageno : 229"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "h1 = 8. \t\t\t#ft\n",
      "b1 = 32. \t\t\t#ft\n",
      "h = 1. \t\t\t#ft\n",
      "b2 = 24. \t\t\t#ft\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "\n",
      "#CALCULATIONS\n",
      "H = h1-h\n",
      "h = 9.65\n",
      "Q = 3.09*H**1.5*b2\n",
      "v1 = Q/(b1*h1)\n",
      "Q1 = 3.09*(H+(v1**2/(2*g)))**1.5*b2\n",
      "hc = (Q1**2/(g*b2**2))**(1./3)\n",
      "d2 = -(hc/2)+math.sqrt(9*hc**2/2)\n",
      "\n",
      "#RESULTS\n",
      "print  'Q  = %.f cfs '%(Q1)\n",
      "print  'hc  = %.2f ft '%(hc)\n",
      "print  'max depth  = %.2f ft '%(d2)\n",
      "print  'Maximum depth of water downstream %.2f ft'%(d2+1)\n",
      "print  'h = %.2f ft'%h\n",
      "\n",
      "# answers may vary because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Q  = 1507 cfs \n",
        "hc  = 4.97 ft \n",
        "max depth  = 8.05 ft \n",
        "Maximum depth of water downstream 9.05 ft\n",
        "h = 9.65 ft\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}