{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# Chapter 8: Computation of volume" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-8 page-241 pb-1" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(10.215, 14.84375, 28.433749999999996, 34.375, 23.633750000000003, 16.23375, 9.58375)\n", "by trapezoidal rule\n", "('V=', 5096.775, 'meter cube')\n", "by prismoidal rule\n", "('V=', 5143.25, 'meter cube')\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "h1=0.90;h2=1.25;h3=2.15;h4=2.50;h5=1.85;h6=1.35;h7=0.85;\n", "\n", "b=10;\n", "sh=1.5;\n", "\n", "h=40;\n", "\n", "d1=(b+(sh*h1))*h1;\n", "d2=(b+(sh*h2))*h2;\n", "d3=(b+(sh*h3))*h3;\n", "d4=(b+(sh*h4))*h4;\n", "d5=(b+(sh*h5))*h5;\n", "d6=(b+(sh*h6))*h6;\n", "d7=(b+(sh*h7))*h7;\n", "\n", "print(d1,d2,d3,d4,d5,d6,d7)\n", "print('by trapezoidal rule');\n", "v=(h/2)*(d1+d7+2*(d2+d3+d4+d5+d6));\n", "print('V=',v,'meter cube');\n", "\n", "print('by prismoidal rule');\n", "\n", "v1=(h/3)*(d1+d7+4*(d2+d4+d6)+2*(d3+d5));\n", "\n", "print('V=',v1,'meter cube');\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-8 page-241,242 pb-2" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(19.736842105263158, 29.487179487179485, 19.047619047619047, 23.214285714285715)\n", "(7.125, 11.845, 7.68, 13.78, 16.5, 7.125)\n", "from chainage 0 to 50\n", "(70.3125, 179.3165955128205)\n", "from chainage 50 to 100\n", "(78.74925714285715, 174.63782051282053)\n", "from chainage 100 to 150\n", "(73.14285714285714, 213.2455)\n", "from chainage 150 to 200\n", "(221.13535714285715, 159.94642857142858)\n", "from chainage 200 to 250\n", "590.625\n", "('total cutting =', 1033.9649714285715)\n", "('total fitting=', 727.1463445970695)\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "h1=0.75;h2=1.15;h3=0.80;h4=1.30;h5=1.5;h6=0.75\n", "b=8;sh=2;\n", "\n", "x1=(50*h1)/(h1+h2);\n", "x2=(50*h2)/(h2+h3);\n", "x3=(50*h3)/(h4+h3);\n", "x4=(50*h4)/(h4+h5);\n", "print(x1,x2,x3,x4);\n", "\n", "a1=(b+(sh*h1))*h1;\n", "a2=(b+(sh*h2))*h2;\n", "a3=(b+(sh*h3))*h3;\n", "a4=(b+(sh*h4))*h4;\n", "a5=(b+(sh*h5))*h5;\n", "a6=(b+(sh*h6))*h6;\n", "print(a1,a2,a3,a4,a5,a6)\n", "\n", "print('from chainage 0 to 50');\n", "c1=(a1/2)*(x1);\n", "f1=(a2/2)*(x2+0.79);\n", "print(c1,f1);\n", "\n", "\n", "\n", "print('from chainage 50 to 100');\n", "f2=(a2/2)*(x2);\n", "c2=(a3/2)*(x3+1.46);\n", "print(c2,f2);\n", "\n", "print('from chainage 100 to 150');\n", "c3=(a3/2)*(x3);\n", "f3=(a4/2)*(30.95);\n", "print(c3,f3);\n", "\n", "print('from chainage 150 to 200');\n", "f4=(a4/2)*(x4);\n", "c4=(a5/2)*(x4+3.59);\n", "print(c4,f4);\n", "\n", "print('from chainage 200 to 250');\n", "c5=((a1+a5)/2)*50;\n", "\n", "print(c5);\n", "\n", "tc=c1+c2+c3+c4+c5;\n", "tf=f1+f2+f3+f4;\n", "\n", "print('total cutting =',tc);\n", "print('total fitting=',tf);\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-8 page-244 pb-3" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(26.25, 11.5625, 8.5025, 15.9225, 22.44, 30.9225, 6.5625)\n", "('volume=', 5472.125)\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "h=50;\n", "h1=2.50;h2=1.25;h3=0.95;h4=1.65;h5=2.20;h6=2.85;h7=0.75;\n", "b=8;sh=1;\n", "\n", "\n", "a1=(b+(sh*h1))*h1;\n", "a2=(b+(sh*h2))*h2;\n", "a3=(b+(sh*h3))*h3;\n", "a4=(b+(sh*h4))*h4;\n", "a5=(b+(sh*h5))*h5;\n", "a6=(b+(sh*h6))*h6;\n", "a7=(b+(sh*h7))*h7;\n", "\n", "print(a1,a2,a3,a4,a5,a6,a7);\n", "\n", "v=(h/3)*(a1+a7+4*(a2+a4+a6)+2*(a3+a5));\n", "\n", "\n", "print('volume=',v);\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-8 page-245 pb-4" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "according to trapezoidal rule\n", "('volume =', 330375.0)\n", "according to prismoidal rule\n", "('volume =', 330250.0)\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "a1=2050;a2=8400;a3=16300;a4=24600;a5=31500;\n", "\n", "h=5;\n", "\n", "print('according to trapezoidal rule')\n", "\n", "v1=(h/2)*(a1+a5+2*(a2+a3+a4));\n", "\n", "print('volume =',v1);\n", "\n", "print('according to prismoidal rule')\n", "\n", "v2=(h/3)*(a1+a5+4*(a2+a4)+2*(a3));\n", "\n", "print('volume =',v2)\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-8 page-245,246 pb-5" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "bottom section\n", "('area A1=', 1200)\n", "mid section\n", "('area A2=', 2000.0)\n", "top section\n", "('area A3=', 30000)\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "print('bottom section')\n", "L=40;\n", "B=30;\n", "a1=L*B;\n", "print('area A1=',a1)\n", "\n", "print('mid section')\n", "b=40;\n", "sh=2.5;\n", "\n", "l=L+2*2*sh;\n", "b=B+2*2*sh;\n", "a2=l*b;\n", "print('area A2=',a2);\n", "\n", "print('top section')\n", "sh=5;\n", "\n", "l1=L+2*sh;\n", "b1=B*2*2*sh;\n", "a3=l1*b1;\n", "print('area A3=',a3)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-8 page-246,247 pb-6" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "first section\n", "(6.666666666666666, 5.454545454545455)\n", "('area A1=', 20.36363636363636)\n", "second section\n", "(7.777777777777778, 6.363636363636363)\n", "('area A2=', 33.494949494949495)\n", "third section\n", "(8.88888888888889, 7.2727272727272725)\n", "('area A3=', 48.64646464646465)\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "b=8;\n", "h=2;\n", "n=10;\n", "s=1;\n", "\n", "print('first section');\n", "b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));\n", "b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));\n", "\n", "a1=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));\n", "print(b1,b2)\n", "\n", "print('area A1=',a1);\n", "\n", "print('second section');\n", "b=8;h=3;n=10;s=1;\n", "\n", "\n", "b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));\n", "b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));\n", "\n", "a2=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));\n", "print(b1,b2)\n", "\n", "print('area A2=',a2);\n", "\n", "print('third section');\n", "b=8;h=4;n=10;s=1;\n", "\n", "\n", "b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));\n", "b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));\n", "\n", "a3=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));\n", "print(b1,b2)\n", "\n", "print('area A3=',a3);\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-8 page-247,248 pb-7" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "first section\n", "(6.666666666666667, 5.454545454545454)\n", "('area A1=', 11.36363636363636)\n", "second section\n", "(8.75, 5.833333333333333)\n", "('area A2=', 26.041666666666664)\n", "third section\n", "(7.428571428571429, 5.777777777777778)\n", "('area A3=', 17.920634920634917)\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "b=10;\n", "h=1;\n", "n=10;\n", "s=1;\n", "\n", "print('first section');\n", "b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));\n", "b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));\n", "\n", "a1=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));\n", "print(b1,b2)\n", "\n", "print('area A1=',a1);\n", "\n", "print('second section');\n", "b=10;h=2;n=5;s=1;\n", "\n", "\n", "b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));\n", "b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));\n", "\n", "a2=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));\n", "print(b1,b2)\n", "\n", "print('area A2=',a2);\n", "\n", "print('third section');\n", "b=10;h=1.5;n=8;s=1;\n", "\n", "\n", "b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));\n", "b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));\n", "\n", "a3=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));\n", "print(b1,b2)\n", "\n", "print('area A3=',a3);\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-8 page-248 pb-8" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "at station 1\n", "('area=', 14.25)\n", "at station 2\n", "('area=', 18.975)\n", "('v=', 830.625, 'cp=', 0.20833333333333262)\n", "('correct volume =', 830.4166666666666)\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "print('at station 1');\n", "h=1;h1=2.55;h2=0.95;b=9;b1=7.5;b2=5.25;\n", "w1=b1+b2\n", "a=(((h/2)*(b1+b2))+((b/4)*(h1+h2)));\n", "print('area=',a)\n", "\n", "print('at station 2');\n", "h=1.5;h1=2.8;h2=1.35;b=9;b1=8.1;b2=4.75;\n", "\n", "a1=(((h/2)*(b1+b2))+((b/4)*(h1+h2)));\n", "d=50;\n", "k=10.01;\n", "v=(d/2)*(a+a1);\n", "w2=b1+b2\n", "print('area=',a1)\n", "h2=1;\n", "h1=1.5;\n", "cp=(d/12)*(h1-h2)*(w2-w1);\n", "\n", "\n", "cv=v-cp;\n", "print('v=',v,'cp=',cp)\n", "print('correct volume =',cv);\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-8 page-249 pb-9" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "section 1\n", "(7.03125, 1.0416666666666667)\n", "section 2\n", "(9.03125, 0.375)\n", "('vc=', 401.5625, 'vf=', 35.41666666666667)\n", "('corrected volume (in cutting)=', 400.5208333333333)\n", "('corrected volume(in filling)', 34.027777777777786)\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "print('section 1')\n", "b=10;n=5;s=1;s1=2;\n", "d=50;h1=0.5;h2=0.7;\n", "\n", "ac=0.5*(((0.5*b+n*h1)*(0.5*b+n*h1))/(n-s));\n", "\n", "af=0.5*(((0.5*b-n*h1)*(0.5*b-n*h1))/(n-s1));\n", "\n", "print(ac,af)\n", "\n", "\n", "print('section 2')\n", "\n", "\n", "ac1=0.5*(((0.5*b+n*h2)*(0.5*b+n*h2))/(n-s));\n", "\n", "af1=0.5*(((0.5*b-n*h2)*(0.5*b-n*h2))/(n-s1));\n", "D=50;\n", "print(ac1,af1)\n", "vc=((ac+ac1)/2)*D;\n", "vf=((af+af1)/2)*D;\n", "\n", "print('vc=',vc,'vf=',vf);\n", "\n", "D=50;\n", "pcc=(D/(12*(n-s)))*(n*n*(h1-h2)*(h1-h2));\n", "\n", "\n", "pcf=(D/(12*(n-s1)))*(n*n*(h1-h2)*(h1-h2));\n", "\n", "\n", "cvc=vc-pcc;\n", "cvf=vf-pcf;\n", "\n", "print('corrected volume (in cutting)=',cvc);\n", "\n", "print('corrected volume(in filling)',cvf)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-8 page-251 pb-10" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "at station 1\n", "(40.2, 82.475)\n", "('area =', 21.137499999999996)\n", "at station 2\n", "(53.7, 105.675)\n", "('area =', 25.987499999999997)\n", "volume by average end area rule\n", "('volume=', 1178.1249999999998)\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "a1=0;a2=3.0;\n", "b1=2.20;b2=5.50;\n", "c1=1.75;c2=3.0;\n", "d1=1.5;d2=0;\n", "e1=4.75;e2=5.25;\n", "f1=6.40;f2=7.30;\n", "g1=0;g2=3.0;\n", "\n", "print('at station 1')\n", "sp=(e1*d2)+(f1*e2)+(d2*f2)+(c1*d2)+(b1*c2)+(a1*b2);\n", "\n", "sq=(e2*d1)+(e1*f2)+(f1*g2)+(d1*c2)+(c1*b2)+(b1*a2);\n", "\n", "area1=0.5*(sp-sq)\n", "area1=abs(area1);\n", "print(sp,sq)\n", "print('area =',area1)\n", "\n", "a1=0;a2=3.0;\n", "b1=3.1;b2=5.25;\n", "c1=2.20;c2=3.0;\n", "d1=2;d2=0;\n", "e1=5.25;e2=6;\n", "f1=7.40;f2=8.5;\n", "g1=0;g2=3.0;\n", "print('at station 2')\n", "sp1=(e1*d2)+(f1*e2)+(d2*f2)+(c1*d2)+(b1*c2)+(a1*b2);\n", "\n", "sq1=(d1*e2)+(e1*f2)+(f1*g2)+(d1*c2)+(c1*b2)+(b1*a2);\n", "print(sp1,sq1)\n", "\n", "\n", "area2=0.5*(sp1-sq1)\n", "area2=abs(area2);\n", "print('area =',area2)\n", "\n", "print('volume by average end area rule')\n", "v=50*((area1+area2)/2);\n", "print('volume=',v)\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.11" } }, "nbformat": 4, "nbformat_minor": 0 }