{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# Chapter 7: Computation of Area" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "### ch-7 page 207 pb-1" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "chainage 0 and 20\n", "('area=', 420.0)\n", "chainage 20 and 65\n", "('area=', 2250.0)\n", "chainage 65 and 110\n", "('area=', 1305.0)\n", "chainage 90 and 110\n", "('area=', 600.0)\n", "chainage 40 and 90\n", "('area=', 2000.0)\n", "chainage 0 and 40\n", "('area=', 400.0)\n", "('area of field =', 6975.0)\n" ] } ], "source": [ "from __future__ import division\n", "\n", "import math\n", "\n", "\n", "print('chainage 0 and 20')\n", "a1=0;b1=20;\n", "\n", "base=b1-a1;\n", "o1=0;o2=42;\n", "mo1=(o2+o1)/2;\n", "\n", "ae1=base*mo1;\n", "print('area=',ae1);\n", "\n", "print('chainage 20 and 65')\n", "a1=20;b1=65;\n", "\n", "base=b1-a1;\n", "o1=58;o2=42;\n", "mo2=(o2+o1)/2;\n", "\n", "ae2=base*mo2;\n", "print('area=',ae2);\n", "\n", "\n", "print('chainage 65 and 110')\n", "a1=65;b1=110;\n", "\n", "base=b1-a1;\n", "o1=0;o2=58;\n", "mo3=(o2+o1)/2;\n", "\n", "ae3=base*mo3;\n", "print('area=',ae3);\n", "\n", "\n", "print('chainage 90 and 110')\n", "a1=90;b1=110;\n", "\n", "base=b1-a1;\n", "o1=0;o2=60;\n", "mo4=(o2+o1)/2;\n", "\n", "ae4=base*mo4;\n", "print('area=',ae4);\n", "\n", "print('chainage 40 and 90')\n", "\n", "a1=40;b1=90;\n", "\n", "base=b1-a1;\n", "o1=60;o2=20;\n", "mo5=(o2+o1)/2;\n", "\n", "ae5=base*mo5;\n", "print('area=',ae5);\n", "\n", "print('chainage 0 and 40')\n", "a1=0;b1=40;\n", "\n", "base=b1-a1;\n", "o1=20;o2=0;\n", "mo6=(o2+o1)/2;\n", "\n", "ae6=base*mo6\n", "print('area=',ae6);\n", "\n", "\n", "area=ae1+ae2+ae3+ae4+ae5+ae6;\n", "\n", "print('area of field =',area);\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "### ch-7 page 209,210 pb-2" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "chainage 15.5 and 27.5\n", "('area=', 135.0)\n", "chainage 15.5 and 50\n", "('area=', 905.625)\n", "chainage 50 and 75.5\n", "('area=', 835.125)\n", "chainage 75.5 and 86.7\n", "('area=', 198.80000000000004)\n", "chainage 86.7 and 90\n", "('area=', 17.324999999999985)\n", "chainage 60 and 90\n", "('area=', 532.5)\n", "chainage 35.5 and 60\n", "('area=', 490.0)\n", "chainage 27.5 and 35.5\n", "('area=', 60.0)\n", "('ap,ae=', 3022.05, 152.325)\n", "('total area of field =', 2869.7250000000004)\n" ] } ], "source": [ "from __future__ import division\n", "\n", "import math\n", "\n", "\n", "print('chainage 15.5 and 27.5')\n", "a1=15.5;b1=27.5;\n", "\n", "base=b1-a1;\n", "o1=0;o2=22.5;\n", "mo1=(o2+o1)/2;\n", "\n", "ae1=base*mo1;\n", "ap1=0;\n", "an1=ae1;\n", "print('area=',ae1);\n", "\n", "print('chainage 15.5 and 50')\n", "a1=15.5;b1=50;\n", "\n", "base=b1-a1;\n", "o1=22.5;o2=30;\n", "mo2=(o2+o1)/2;\n", "\n", "ae2=base*mo2;\n", "ap2=ae2;\n", "an2=0;\n", "print('area=',ae2);\n", "\n", "\n", "print('chainage 50 and 75.5')\n", "a1=50;b1=75.5;\n", "\n", "base=b1-a1;\n", "o1=30;o2=35.5;\n", "mo3=(o2+o1)/2;\n", "\n", "ae3=base*mo3;\n", "ap3=ae3;\n", "an3=0;\n", "print('area=',ae3);\n", "\n", "\n", "print('chainage 75.5 and 86.7')\n", "a1=75.5;b1=86.7;\n", "\n", "base=b1-a1;\n", "o1=35.5;o2=0;\n", "mo4=(o2+o1)/2;\n", "\n", "ae4=base*mo4;\n", "ap4=ae4;\n", "an4=0;\n", "print('area=',ae4);\n", "\n", "print('chainage 86.7 and 90')\n", "\n", "a1=86.7;b1=90;\n", "\n", "base=b1-a1;\n", "o1=0;o2=10.5;\n", "mo5=(o2+o1)/2;\n", "\n", "ae5=base*mo5;\n", "ap5=0;\n", "an5=ae5;\n", "print('area=',ae5);\n", "\n", "print('chainage 60 and 90')\n", "a1=60;b1=90;\n", "\n", "base=b1-a1;\n", "o1=10.5;o2=25.0;\n", "mo6=(o2+o1)/2;\n", "\n", "ae6=base*mo6\n", "ap6=ae6;\n", "an6=0;\n", "print('area=',ae6);\n", "\n", "print('chainage 35.5 and 60')\n", "a1=35.5;b1=60;\n", "\n", "base=b1-a1;\n", "o1=25;o2=15;\n", "mo7=(o2+o1)/2;\n", "\n", "ae7=base*mo7\n", "ap7=ae7;\n", "an7=0;\n", "print('area=',ae7);\n", "\n", "print('chainage 27.5 and 35.5')\n", "a1=27.5;b1=35.5;\n", "\n", "base=b1-a1;\n", "o1=15;o2=0;\n", "mo8=(o2+o1)/2;\n", "\n", "ae8=base*mo8\n", "ap8=ae8;\n", "an8=0\n", "print('area=',ae8);\n", "\n", "an=an1+an2+an3+an4+an5+an6+an7+an8;\n", "ap=ap1+ap2+ap3+ap4+ap5+ap6+ap7+ap8;\n", "\n", "area=ap-an;\n", "print('ap,ae=',ap,an)\n", "print('total area of field =',area);\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### ch-7 page 214 pb-1" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Mid ordinate rule\n", "('required area is', 188.0, 'square meters')\n", "average ordinate rule\n", "('required area is', 161.14285714285714, 'sqare meters')\n", "trapezoidal rule\n", "('required area is ', 188.0, 'square meters')\n", "simpsons rule\n", "('required area is ', 196.66666666666669, 'square meters')\n" ] } ], "source": [ "from __future__ import division\n", "\n", "import math\n", "\n", "\n", "dis=10;\n", "a=0;g=0;\n", "b=2.5;c=3.5;d=5;e=4.6;f=3.2;\n", "\n", "print('Mid ordinate rule');\n", "\n", "h1=(a+b)/2;\n", "h2=(b+c)/2;\n", "h3=(c+d)/2;\n", "h4=(d+e)/2;\n", "h5=(e+f)/2;\n", "h6=(f+g)/2;\n", "area=dis*(h1+h2+h3+h4+h5+h6);\n", "\n", "print('required area is',area,'square meters');\n", "\n", "print('average ordinate rule');\n", "dis=10;\n", "p=6;\n", "bl=dis*p;\n", "no=7;\n", "\n", "\n", "area2=bl*(a+b+c+d+e+f+g)/no;\n", "\n", "print('required area is',area2,'sqare meters');\n", "\n", "print('trapezoidal rule');\n", "\n", "\n", "area3=(dis/2)*(2*(a+b+c+d+e+f+g));\n", "\n", "print('required area is ',area3,'square meters');\n", "print('simpsons rule');\n", "\n", "area4=(dis/3)*(4*(b+d+f)+2*(c+e));\n", "print('required area is ',area4,'square meters');\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### ch-7 page 216 pb-2" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "trapezoidal rule\n", "('required area is ', 820.125, 'square meters')\n", "simpsons rule\n", "(756.0, 57.375)\n", "('required area is ', 813.375, 'square meters')\n" ] } ], "source": [ "#ch-7 page 216 pb-2\n", "from __future__ import division\n", "\n", "import math\n", "\n", "print('trapezoidal rule');\n", "\n", "o1=3.5;o2=4.3;o3=6.75;o4=5.25;o5=7.5;o6=8.8;o7=7.9;\n", "o8=6.4;o9=4.4;o10=3.25;\n", "\n", "dis=15;\n", "\n", "area1=(dis/2)*(o1+o10+(2*(o2+o3+o4+o5+o6+o7+o8+o9)));\n", "\n", "print('required area is ',area1,'square meters');\n", "\n", "print('simpsons rule')\n", "\n", "A1=dis/3*(o1+o9+4*(o2+o4+o6+o8)+2*(o3+o5+o7));\n", "\n", "A2=dis/2*(o10+o9);\n", "\n", "area2=A1+A2;\n", "print(A1,A2)\n", "\n", "print('required area is ',area2,'square meters');\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "### cha 7 page -216 pb-3" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "trapezoidal rule\n", "(89.5, 106.49999999999999, 158.0)\n", "('total area=', 354.0, 'meters')\n", "simpsons rule\n", "(89.66666666666667, 102.33333333333333, 157.33333333333334)\n", "('total area is ', 349.33333333333337, 'meters')\n" ] } ], "source": [ "from __future__ import division\n", "\n", "import math\n", "\n", "o1=2.5;o2=3.8;o3=4.6;o4=5.2;o5=6.1;o6=4.7;o7=5.8;o8=3.9;o9=2.20;\n", "\n", "d1=5;\n", "d2=10;\n", "d3=20;\n", "\n", "\n", "print('trapezoidal rule')\n", "\n", "del1=(d1/2)*(o1+o5+2*(o2+o3+o4));\n", "del2=(d2/2)*(o5+o7+2*(o6));\n", "del3=(d3/2)*(o7+o9+2*(o8));\n", "\n", "total1=del1+del2+del3;\n", "print(del1,del2,del3)\n", "\n", "print('total area=',total1,'meters');\n", "\n", "print('simpsons rule')\n", "\n", "de1=(d1/3)*(o1+o5+4*(o2+o4)+2*(o3));\n", "de2=(d2/3)*(o5+o7+4*(o6));\n", "de3=(d3/3)*(o7+o9+4*(o8));\n", "\n", "\n", "total2=de1+de2+de3;\n", "print(de1,de2,de3)\n", "\n", "print('total area is ',total2,'meters')\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha 7 page -225 pb-1" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "('A=', 748.0)\n", "('required area is', 748.0, 'meters')\n" ] } ], "source": [ "#cha 7 page -225 ;pb-1\n", "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "ir=9.377;\n", "fr=3.336;\n", "m=100;\n", "c=23.521;\n", "\n", "n=1;\n", "\n", "a1=m*(fr-ir+10*(n)+c);\n", "\n", "a2=m*(fr-ir-10*(n)+c);\n", "\n", "print('A=',a2);\n", "print('required area is',a2,'meters');\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha 7 page -225,226 pb-2" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "('A=', 81460.00000000001)\n", "('required area is', 81460.00000000001, 'meters')\n" ] } ], "source": [ "from __future__ import division\n", "\n", "import math\n", "\n", "ir=8.652;\n", "fr=6.798;\n", "c=20;\n", "m=100;\n", "n=1;\n", "\n", "sc=100;\n", "\n", "a2=m*(fr-ir-10*(n)+c);\n", "\n", "a2=a2*sc;\n", "\n", "print('A=',a2);\n", "print('required area is',a2,'meters');\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha 7 page -226 pb-3" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "('required area is', 9747.499999999998, 'meters')\n" ] } ], "source": [ "from __future__ import division\n", "\n", "import math\n", "\n", "ir=4.855;\n", "fr=8.754;\n", "m=100;\n", "\n", "n=0;\n", "c=0;\n", "sc=25\n", "a=m*(fr-ir)\n", "a=a*sc;\n", "print('required area is',a,'meters');\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-7 page-226 pb-4" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "case 1\n", "('A=', 100.0)\n", "('M=', 100.0)\n", "case 2\n", "('required area is', 1347.0)\n", "('area of zero circle is', 2122.0)\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "print('case 1')\n", "\n", "ir=3.415;\n", "fr=4.415;\n", "n=0;\n", "c=0;\n", "sc=16; #1cm^2=16m^2;\n", "h=10000;\n", "ag=0.16*h;\n", "\n", "am=ag/sc;\n", "print('A=',am);\n", "\n", "m=am/(fr-ir);\n", "\n", "print('M=',m);\n", "\n", "print('case 2');\n", "\n", "fr_ir=2.25;\n", "c=21.22;\n", "n=1\n", "\n", "a1=m*(fr_ir-10+c);\n", "print('required area is',a1);\n", "\n", "area=m*c;\n", "\n", "print('area of zero circle is',area);\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "### cha-7 page-227 pb-5" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "('area of zero circle is', 1221.0, 'square centimeters')\n" ] } ], "source": [ "from __future__ import division\n", "\n", "import math\n", "\n", "l=10;b=15;\n", "a1=l*b;\n", "\n", "ir=0.686;\n", "fr=9.976;\n", "n=2;\n", "m=100;\n", "\n", "marea=150;\n", "\n", "c=(marea/100)+10.710;\n", "\n", "area=m*c;\n", "print('area of zero circle is',area,'square centimeters');\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### cha-7 page-228 pb-6" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "case 1\n", "('area of figure is', 705.0, 'square cm')\n", "case 2\n", "('area of figure is', -1357.0, 'sq cm')\n", "('C=', 20.62)\n", "('area of zero circle is', 2062.0, 'square cm')\n" ] } ], "source": [ "\n", "from __future__ import division\n", "\n", "import math\n", "\n", "print('case 1')\n", "n=1;\n", "c=0;\n", "m=100;\n", "fr=4.825;\n", "ir=7.775;\n", "area1=m*(fr-ir+10*n)\n", "\n", "print('area of figure is',area1,'square cm');\n", "\n", "print('case 2')\n", "fr=8.755;\n", "ir=2.325;\n", "m=100;\n", "n=2;\n", "area2=m*(fr-ir-10*n+c)\n", "\n", "print('area of figure is',area2,'sq cm')\n", "c=(area1/m)+13.570;\n", "print('C=',c)\n", "\n", "areac=m*c;\n", "print('area of zero circle is',areac,'square cm');\n", "\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 }