{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 24: Area of plane figures" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.1, Page number 24.10" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of triangle is 150.0 cm**2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "b=15; #base(cm)\n", "h=20; #altitude(cm)\n", "\n", "#Calculation\n", "A=b*h/2; #area of triangle(cm**2)\n", "\n", "#Result\n", "print \"area of triangle is\",A,\"cm**2\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.2, Page number 24.10" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "perpendicular length is 10.0 cm\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "A=205; #area of triangle(cm**2)\n", "s=41; #side(cm)\n", "\n", "#Calculation\n", "p=2*A/s; #perpendicular length(cm)\n", "\n", "#Result\n", "print \"perpendicular length is\",p,\"cm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.3, Page number 24.10" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area is 6 *math.sqrt(6) cm**2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=5;\n", "b=6;\n", "c=7; #sides of triangle(cm)\n", "\n", "#Calculation\n", "s=(a+b+c)/2; #semi perimeter(cm)\n", "A=math.sqrt(s*(s-a)*(s-b)*(s-c)); #base area(cm**2)\n", "\n", "#Result\n", "print \"area is\",int(A/math.sqrt(6)),\"*math.sqrt(6) cm**2\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.4, Page number 24.10" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area is 6.928 cm**2\n", "perimeter is 12 cm\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=4; #side of triangle(cm)\n", "\n", "#Calculation\n", "A=math.sqrt(3)*a**2/4; #area(cm**2)\n", "P=3*a; #perimeter(cm)\n", "\n", "#Result\n", "print \"area is\",round(A,3),\"cm**2\"\n", "print \"perimeter is\",P,\"cm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.5, Page number 24.10" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area is 60.0 cm**2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "b=10; #base(cm)\n", "a=13; #side(cm)\n", "\n", "#Calculation\n", "A=b*math.sqrt((4*a**2)-(b**2))/4; #area(cm**2)\n", "\n", "#Result\n", "print \"area is\",A,\"cm**2\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.6, Page number 24.11" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "length of each side is 32.0 cm\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "P=100; #perimeter(cm)\n", "b=36; #base(cm)\n", "\n", "#Calculation\n", "a=(P-b)/2; #length of each side(cm)\n", "\n", "#Result\n", "print \"length of each side is\",a,\"cm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.7, Page number 24.11" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of triangle is 200.0 cm**2\n", "perimeter of triangle is 68.3 cm\n", "answer given in the book is wrong\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "l=20; #length of one leg(cm)\n", "\n", "#Calculation\n", "A=l**2/2; #area of triangle(cm**2)\n", "P=l*(2+math.sqrt(2)); #perimeter of triangle(cm)\n", "\n", "#Result\n", "print \"area of triangle is\",A,\"cm**2\"\n", "print \"perimeter of triangle is\",round(P,1),\"cm\"\n", "print \"answer given in the book is wrong\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.8, Page number 24.11" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "length of hypotenuse is 13.0 cm\n", "area of triangle is 30.0 cm**2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "l1=12; #length of one leg(cm)\n", "l2=5; #length of another leg(cm)\n", "\n", "#Calculation\n", "h=math.sqrt(l1**2+l2**2); #length of hypotenuse(cm)\n", "A=l1*l2/2; #area of triangle(cm**2)\n", "\n", "#Result\n", "print \"length of hypotenuse is\",h,\"cm\"\n", "print \"area of triangle is\",A,\"cm**2\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.9, Page number 24.11" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of rectangle is 720 cm**2\n", "perimeter of rectangle is 112 cm\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "l=36; #length(cm)\n", "b=20; #breadth(cm)\n", "\n", "#Calculation\n", "A=l*b; #area of rectangle(cm**2)\n", "P=2*(l+b); #perimeter of rectangle(cm)\n", "\n", "#Result\n", "print \"area of rectangle is\",A,\"cm**2\"\n", "print \"perimeter of rectangle is\",P,\"cm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.10, Page number 24.11" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of rectangle is 60.0 cm**2\n", "perimeter of rectangle is 34.0 cm\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "l=12; #length of rectangle(cm)\n", "d=13; #diagonal of rectangle(cm)\n", "\n", "#Calculation\n", "A=l*math.sqrt(d**2-l**2); #area of rectangle(cm**2)\n", "P=2*(l+math.sqrt(d**2-l**2)); #perimeter of rectangle(cm)\n", "\n", "#Result\n", "print \"area of rectangle is\",A,\"cm**2\"\n", "print \"perimeter of rectangle is\",P,\"cm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.11, Page number 24.12" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "diagonal of rectangle is 25.0 cm\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "l=20; #length(cm)\n", "b=15; #breadth(cm)\n", "\n", "#Calculation\n", "d=math.sqrt(l**2+b**2); #diagonal of rectangle(cm)\n", "\n", "#Result\n", "print \"diagonal of rectangle is\",d,\"cm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.12, Page number 24.12" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of rectangle is 12.0 cm**2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "P=14; #perimeter of rectangle(cm)\n", "d=5; #diagonal(cm)\n", "\n", "#Calculation\n", "A=((P**2/4)-(d**2))/2; #area of rectangle(cm**2)\n", "\n", "#Result\n", "print \"area of rectangle is\",A,\"cm**2\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.13, Page number 24.12" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "length of rectangle is 24.0 cm\n", "breadth of rectangle is 10.0 cm\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "P=68; #perimeter of rectangle(cm)\n", "A=240; #area of rectangle(cm**2)\n", "\n", "#Calculation\n", "l=A/10; #length of rectangle(cm)\n", "y=P/2;\n", "b=y-l; #breadth of rectangle(cm)\n", "\n", "#Result\n", "print \"length of rectangle is\",l,\"cm\"\n", "print \"breadth of rectangle is\",b,\"cm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.14, Page number 24.12" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area is 100 cm**2\n", "perimeter is 40 cm\n", "diagonal is 14.14 cm\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=10; #side of square(cm)\n", "\n", "#Calculation\n", "A=a**2; #area(cm**2)\n", "P=4*a; #perimeter(cm)\n", "d=a*math.sqrt(2); #diagonal(cm)\n", "\n", "#Result\n", "print \"area is\",A,\"cm**2\"\n", "print \"perimeter is\",P,\"cm\"\n", "print \"diagonal is\",round(d,2),\"cm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.15, Page number 24.12" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "diagonal is 900 m\n", "perimeter is 120.0 m\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "A=900; #area(m**2)\n", "\n", "#Calculation\n", "d=math.sqrt(2*A); #diagonal(m)\n", "P=math.sqrt(16*A); #perimeter(m) \n", "\n", "#Result\n", "print \"diagonal is\",A,\"m\"\n", "print \"perimeter is\",P,\"m\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.16, Page number 24.13" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area is 200.0 cm**2\n", "perimeter is 56.569 cm\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "d=20; #diagonal(cm)\n", "\n", "#Calculation\n", "A=d**2/2; #area(cm**2)\n", "P=math.sqrt(16*A); #perimeter(cm)\n", "\n", "#Result\n", "print \"area is\",A,\"cm**2\"\n", "print \"perimeter is\",round(P,3),\"cm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.17, Page number 24.13" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area is 600.0 m**2\n", "perimeter is 100.0 m\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "d1=40; #first diagonal(m)\n", "d2=30; #second diagonal(m)\n", "\n", "#Calculation\n", "A=d1*d2/2; #area(m**2)\n", "P2=4*(d1**2+d2**2); \n", "p=math.sqrt(P2); #perimeter(m)\n", "\n", "#Result\n", "print \"area is\",A,\"m**2\"\n", "print \"perimeter is\",p,\"m\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.18, Page number 24.13" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of rhombus is 260 cm**2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=13; #side of rhombus(cm)\n", "h=20; #height of rhombus(cm)\n", "\n", "#Calculation\n", "A=a*h; #area of rhombus(cm**2)\n", "\n", "#Result\n", "print \"area of rhombus is\",A,\"cm**2\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.19, Page number 24.13" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of rhombus is 300.0 m**2\n", "perimeter of rhombus is 100.0 m\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=25; #side of rhombus(m)\n", "h=40; #height of rhombus(m)\n", "\n", "#Calculation\n", "A=d*math.sqrt((a**2)-((h/2)**2)); ##area of rhombus(m**2)\n", "P=4*a; #perimeter of rhombus(m)\n", "\n", "#Result\n", "print \"area of rhombus is\",A,\"m**2\"\n", "print \"perimeter of rhombus is\",p,\"m\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.20, Page number 24.14" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of quadrilateral is 120.0 m**2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "d=12; #diagonal(cm)\n", "p1=13; #length of offset 1(cm)\n", "p2=7; #length of offset 2(cm)\n", "\n", "#Calculation\n", "A=d*(p1+p2)/2; #area of quadrilateral(m**2)\n", "\n", "#Result\n", "print \"area of quadrilateral is\",A,\"m**2\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.21, Page number 24.14" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of parallelogram is 600 m**2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "d=30; #length of diagonal(m)\n", "l=20; #length of perpendicular(m)\n", "\n", "#Calculation\n", "A=d*l; #area of parallelogram(m**2)\n", "\n", "#Result\n", "print \"area of parallelogram is\",A,\"m**2\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.22, Page number 24.14" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of parallelogram is 151.789 m**2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=12; #length of side 1(m)\n", "b=14; #length of side 2(m)\n", "d=22; #length of diagonal(m)\n", "\n", "#Calculation\n", "S=(a+b+d)/2; #semi perimeter(m)\n", "A=2*math.sqrt(S*(S-a)*(S-b)*(S-d)); #area of parallelogram(m**2)\n", "\n", "#Result\n", "print \"area of parallelogram is\",round(A,3),\"m**2\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.23, Page number 24.14" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "length of second diagonal is 18.0 m\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=13; #length of side 1(m)\n", "b=11; #length of side 2(m)\n", "d1=16; #length of diagonal 1(m)\n", "\n", "#Calculation\n", "d22=(2*(a**2+b**2))-(d1**2); \n", "d2=math.sqrt(d22); #length of second diagonal(m)\n", "\n", "#Result\n", "print \"length of second diagonal is\",d2,\"m\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.24, Page number 24.14" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of trapezium is 270.0 m**2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=20; #length of parallel side 1(m)\n", "b=25; #length of parallel side 2(m) \n", "h=12; #distance(m)\n", "\n", "#Calculation\n", "A=(a+b)*h/2; #area of trapezium(m**2)\n", "\n", "#Result\n", "print \"area of trapezium is\",A,\"m**2\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.25, Page number 24.15" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of trapezium is 5673.66 m**2\n", "answer varies due to rounding off errors\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=120; #length of parallel side 1(m)\n", "b=75; #length of parallel side 2(m) \n", "c=105; #length of non parallel side 1(m)\n", "d=72; #length of non parallel side 2(m) \n", "\n", "#Calculation\n", "K=a-b; #difference of parallel sides(m)\n", "S=(K+c+d)/2; #semi perimeter(m)\n", "x=S*(S-K)*(S-c)*(S-d); \n", "A=(a+b)*math.sqrt(x)/K; #area of trapezium(m**2)\n", "\n", "#Result\n", "print \"area of trapezium is\",round(A,2),\"m**2\"\n", "print \"answer varies due to rounding off errors\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.26, Page number 24.15" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of circle is 616.0 m**2\n", "circumference of circle is 88.0 m\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "r=14; #radius(m)\n", "\n", "#Calculation\n", "C=2*math.pi*r; #circumference of circle(m)\n", "A=math.pi*r**2; #area of circle(m**2)\n", "\n", "#Result\n", "print \"area of circle is\",round(A),\"m**2\"\n", "print \"circumference of circle is\",round(C),\"m\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 24.27, Page number 24.15" ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "area of circle is 154.0 m**2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "C=44; #circumference of circle(m)\n", "\n", "#Calculation\n", "A=C**2/(4*math.pi); #area of circle(m**2)\n", "\n", "#Result\n", "print \"area of circle is\",round(A),\"m**2\"" ] } ], "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.9" } }, "nbformat": 4, "nbformat_minor": 0 }