24: Area of plane figures

Example number 24.1, Page number 24.10

In [1]:
#importing modules
import math
from __future__ import division

#Variable declaration
b=15;     #base(cm)
h=20;     #altitude(cm)

#Calculation
A=b*h/2;    #area of triangle(cm**2)

#Result
print "area of triangle is",A,"cm**2"
area of triangle is 150.0 cm**2

Example number 24.2, Page number 24.10

In [2]:
#importing modules
import math
from __future__ import division

#Variable declaration
A=205;    #area of triangle(cm**2)
s=41;     #side(cm)

#Calculation
p=2*A/s;    #perpendicular length(cm)

#Result
print "perpendicular length is",p,"cm"
perpendicular length is 10.0 cm

Example number 24.3, Page number 24.10

In [6]:
#importing modules
import math
from __future__ import division

#Variable declaration
a=5;
b=6;
c=7;       #sides of triangle(cm)

#Calculation
s=(a+b+c)/2;     #semi perimeter(cm)
A=math.sqrt(s*(s-a)*(s-b)*(s-c));    #base area(cm**2)

#Result
print "area is",int(A/math.sqrt(6)),"*math.sqrt(6) cm**2"
area is 6 *math.sqrt(6) cm**2

Example number 24.4, Page number 24.10

In [7]:
#importing modules
import math
from __future__ import division

#Variable declaration
a=4;     #side of triangle(cm)

#Calculation
A=math.sqrt(3)*a**2/4;    #area(cm**2)
P=3*a;      #perimeter(cm)

#Result
print "area is",round(A,3),"cm**2"
print "perimeter is",P,"cm"
area is 6.928 cm**2
perimeter is 12 cm

Example number 24.5, Page number 24.10

In [8]:
#importing modules
import math
from __future__ import division

#Variable declaration
b=10;    #base(cm)
a=13;    #side(cm)

#Calculation
A=b*math.sqrt((4*a**2)-(b**2))/4;    #area(cm**2)

#Result
print "area is",A,"cm**2"
area is 60.0 cm**2

Example number 24.6, Page number 24.11

In [9]:
#importing modules
import math
from __future__ import division

#Variable declaration
P=100;    #perimeter(cm)
b=36;     #base(cm)

#Calculation
a=(P-b)/2;       #length of each side(cm)

#Result
print "length of each side is",a,"cm"
length of each side is 32.0 cm

Example number 24.7, Page number 24.11

In [10]:
#importing modules
import math
from __future__ import division

#Variable declaration
l=20;      #length of one leg(cm)

#Calculation
A=l**2/2;     #area of triangle(cm**2)
P=l*(2+math.sqrt(2));     #perimeter of triangle(cm)

#Result
print "area of triangle is",A,"cm**2"
print "perimeter of triangle is",round(P,1),"cm"
print "answer given in the book is wrong"
area of triangle is 200.0 cm**2
perimeter of triangle is 68.3 cm
answer given in the book is wrong

Example number 24.8, Page number 24.11

In [11]:
#importing modules
import math
from __future__ import division

#Variable declaration
l1=12;     #length of one leg(cm)
l2=5;      #length of another leg(cm)

#Calculation
h=math.sqrt(l1**2+l2**2);     #length of hypotenuse(cm)
A=l1*l2/2;      #area of triangle(cm**2)

#Result
print "length of hypotenuse is",h,"cm"
print "area of triangle is",A,"cm**2"
length of hypotenuse is 13.0 cm
area of triangle is 30.0 cm**2

Example number 24.9, Page number 24.11

In [12]:
#importing modules
import math
from __future__ import division

#Variable declaration
l=36;     #length(cm)
b=20;     #breadth(cm)

#Calculation
A=l*b;     #area of rectangle(cm**2)
P=2*(l+b);    #perimeter of rectangle(cm)

#Result
print "area of rectangle is",A,"cm**2"
print "perimeter of rectangle is",P,"cm"
area of rectangle is 720 cm**2
perimeter of rectangle is 112 cm

Example number 24.10, Page number 24.11

In [15]:
#importing modules
import math
from __future__ import division

#Variable declaration
l=12;      #length of rectangle(cm)
d=13;      #diagonal of rectangle(cm)

#Calculation
A=l*math.sqrt(d**2-l**2);     #area of rectangle(cm**2)
P=2*(l+math.sqrt(d**2-l**2));    #perimeter of rectangle(cm)

#Result
print "area of rectangle is",A,"cm**2"
print "perimeter of rectangle is",P,"cm"
area of rectangle is 60.0 cm**2
perimeter of rectangle is 34.0 cm

Example number 24.11, Page number 24.12

In [16]:
#importing modules
import math
from __future__ import division

#Variable declaration
l=20;     #length(cm)
b=15;     #breadth(cm)

#Calculation
d=math.sqrt(l**2+b**2);      #diagonal of rectangle(cm)

#Result
print "diagonal of rectangle is",d,"cm"
diagonal of rectangle is 25.0 cm

Example number 24.12, Page number 24.12

In [17]:
#importing modules
import math
from __future__ import division

#Variable declaration
P=14;      #perimeter of rectangle(cm)
d=5;       #diagonal(cm)

#Calculation
A=((P**2/4)-(d**2))/2;     #area of rectangle(cm**2)

#Result
print "area of rectangle is",A,"cm**2"
area of rectangle is 12.0 cm**2

Example number 24.13, Page number 24.12

In [18]:
#importing modules
import math
from __future__ import division

#Variable declaration
P=68;      #perimeter of rectangle(cm)
A=240;     #area of rectangle(cm**2)

#Calculation
l=A/10;     #length of rectangle(cm)
y=P/2;
b=y-l;      #breadth of rectangle(cm)

#Result
print "length of rectangle is",l,"cm"
print "breadth of rectangle is",b,"cm"
length of rectangle is 24.0 cm
breadth of rectangle is 10.0 cm

Example number 24.14, Page number 24.12

In [19]:
#importing modules
import math
from __future__ import division

#Variable declaration
a=10;     #side of square(cm)

#Calculation
A=a**2;     #area(cm**2)
P=4*a;      #perimeter(cm)
d=a*math.sqrt(2);     #diagonal(cm)

#Result
print "area is",A,"cm**2"
print "perimeter is",P,"cm"
print "diagonal is",round(d,2),"cm"
area is 100 cm**2
perimeter is 40 cm
diagonal is 14.14 cm

Example number 24.15, Page number 24.12

In [20]:
#importing modules
import math
from __future__ import division

#Variable declaration
A=900;     #area(m**2)

#Calculation
d=math.sqrt(2*A);     #diagonal(m)
P=math.sqrt(16*A);    #perimeter(m) 

#Result
print "diagonal is",A,"m"
print "perimeter is",P,"m"
diagonal is 900 m
perimeter is 120.0 m

Example number 24.16, Page number 24.13

In [21]:
#importing modules
import math
from __future__ import division

#Variable declaration
d=20;     #diagonal(cm)

#Calculation
A=d**2/2;     #area(cm**2)
P=math.sqrt(16*A);    #perimeter(cm)

#Result
print "area is",A,"cm**2"
print "perimeter is",round(P,3),"cm"
area is 200.0 cm**2
perimeter is 56.569 cm

Example number 24.17, Page number 24.13

In [22]:
#importing modules
import math
from __future__ import division

#Variable declaration
d1=40;      #first diagonal(m)
d2=30;      #second diagonal(m)

#Calculation
A=d1*d2/2;     #area(m**2)
P2=4*(d1**2+d2**2);    
p=math.sqrt(P2);    #perimeter(m)

#Result
print "area is",A,"m**2"
print "perimeter is",p,"m"
area is 600.0 m**2
perimeter is 100.0 m

Example number 24.18, Page number 24.13

In [23]:
#importing modules
import math
from __future__ import division

#Variable declaration
a=13;      #side of rhombus(cm)
h=20;      #height of rhombus(cm)

#Calculation
A=a*h;    #area of rhombus(cm**2)

#Result
print "area of rhombus is",A,"cm**2"
area of rhombus is 260 cm**2

Example number 24.19, Page number 24.13

In [24]:
#importing modules
import math
from __future__ import division

#Variable declaration
a=25;      #side of rhombus(m)
h=40;      #height of rhombus(m)

#Calculation
A=d*math.sqrt((a**2)-((h/2)**2));      ##area of rhombus(m**2)
P=4*a;      #perimeter of rhombus(m)

#Result
print "area of rhombus is",A,"m**2"
print "perimeter of rhombus is",p,"m"
area of rhombus is 300.0 m**2
perimeter of rhombus is 100.0 m

Example number 24.20, Page number 24.14

In [25]:
#importing modules
import math
from __future__ import division

#Variable declaration
d=12;      #diagonal(cm)
p1=13;     #length of offset 1(cm)
p2=7;      #length of offset 2(cm)

#Calculation
A=d*(p1+p2)/2;    #area of quadrilateral(m**2)

#Result
print "area of quadrilateral is",A,"m**2"
area of quadrilateral is 120.0 m**2

Example number 24.21, Page number 24.14

In [26]:
#importing modules
import math
from __future__ import division

#Variable declaration
d=30;      #length of diagonal(m)
l=20;      #length of perpendicular(m)

#Calculation
A=d*l;    #area of parallelogram(m**2)

#Result
print "area of parallelogram is",A,"m**2"
area of parallelogram is 600 m**2

Example number 24.22, Page number 24.14

In [27]:
#importing modules
import math
from __future__ import division

#Variable declaration
a=12;     #length of side 1(m)
b=14;     #length of side 2(m)
d=22;     #length of diagonal(m)

#Calculation
S=(a+b+d)/2;    #semi perimeter(m)
A=2*math.sqrt(S*(S-a)*(S-b)*(S-d));     #area of parallelogram(m**2)

#Result
print "area of parallelogram is",round(A,3),"m**2"
area of parallelogram is 151.789 m**2

Example number 24.23, Page number 24.14

In [28]:
#importing modules
import math
from __future__ import division

#Variable declaration
a=13;     #length of side 1(m)
b=11;     #length of side 2(m)
d1=16;     #length of diagonal 1(m)

#Calculation
d22=(2*(a**2+b**2))-(d1**2);    
d2=math.sqrt(d22);      #length of second diagonal(m)

#Result
print "length of second diagonal is",d2,"m"
length of second diagonal is 18.0 m

Example number 24.24, Page number 24.14

In [29]:
#importing modules
import math
from __future__ import division

#Variable declaration
a=20;     #length of parallel side 1(m)
b=25;     #length of parallel side 2(m) 
h=12;     #distance(m)

#Calculation
A=(a+b)*h/2;   #area of trapezium(m**2)

#Result
print "area of trapezium is",A,"m**2"
area of trapezium is 270.0 m**2

Example number 24.25, Page number 24.15

In [30]:
#importing modules
import math
from __future__ import division

#Variable declaration
a=120;     #length of parallel side 1(m)
b=75;     #length of parallel side 2(m) 
c=105;     #length of non parallel side 1(m)
d=72;     #length of non parallel side 2(m) 

#Calculation
K=a-b;    #difference of parallel sides(m)
S=(K+c+d)/2;    #semi perimeter(m)
x=S*(S-K)*(S-c)*(S-d);    
A=(a+b)*math.sqrt(x)/K;    #area of trapezium(m**2)

#Result
print "area of trapezium is",round(A,2),"m**2"
print "answer varies due to rounding off errors"
area of trapezium is 5673.66 m**2
answer varies due to rounding off errors

Example number 24.26, Page number 24.15

In [31]:
#importing modules
import math
from __future__ import division

#Variable declaration
r=14;     #radius(m)

#Calculation
C=2*math.pi*r;     #circumference of circle(m)
A=math.pi*r**2;    #area of circle(m**2)

#Result
print "area of circle is",round(A),"m**2"
print "circumference of circle is",round(C),"m"
area of circle is 616.0 m**2
circumference of circle is 88.0 m

Example number 24.27, Page number 24.15

In [32]:
#importing modules
import math
from __future__ import division

#Variable declaration
C=44;     #circumference of circle(m)

#Calculation
A=C**2/(4*math.pi);    #area of circle(m**2)

#Result
print "area of circle is",round(A),"m**2"
area of circle is 154.0 m**2