# 25: Volume and area of solid figures¶

## Example number 25.1, Page number 25.8¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
l=20;     #length of cuboid(m)
h=8;      #height of cuboid(m)

#Calculation
d=math.sqrt(l**2+b**2+h**2);     #length of diagonal(m)
S=2*((l*b)+(b*h)+(l*h));         #surface area(m**2)
V=l*b*h;      #volume(m**3)

#Result
print "length of diagonal is",round(d,2),"m"
print "surface area is",S,"m**2"
print "volume is",V,"m**3"

length of diagonal is 23.75 m
surface area is 880 m**2
volume is 1600 m**3


## Example number 25.2, Page number 25.8¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
e=12;     #edge(m)

#Calculation
d=e*math.sqrt(3);     #length of diagonal(m)
S=6*(e**2);         #surface area(m**2)
V=e**3;      #volume(m**3)

#Result
print "length of diagonal is",round(d,2),"m"
print "surface area is",S,"m**2"
print "volume is",V,"m**3"

length of diagonal is 20.78 m
surface area is 864 m**2
volume is 1728 m**3


## Example number 25.3, Page number 25.8¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
S=726;      #surface area(m**2)

#Calculation
V=(math.sqrt(S/6))**3;      #volume(m**3)

#Result
print "volume is",V,"m**3"

volume is 1331.0 m**3


## Example number 25.4, Page number 25.8¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
d=34.64;       #length of diagonal(m)

#Calculation
V=(d/math.sqrt(3))**3;      #volume(m**3)

#Result
print "volume is",round(V),"m**3"
print "answer varies due to rounding off errors"

volume is 7999.0 m**3
answer varies due to rounding off errors


## Example number 25.5, Page number 25.8¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
l=115;     #length of box(cm)
h=35;      #height of box(cm)
t=2.5;     #thickness(cm)

#Calculation
IV=l*b*h;      #internal volume(cm**3)
EV=(l+(2*t))*(b+(2*t))*(h+(2*t));      #external volume(cm**3)
V=EV-IV;       #volume of wood(cm**3)

#Result
print "volume of wood is",V,"cm**3"

volume of wood is 82125.0 cm**3


## Example number 25.6, Page number 25.9¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
V=1;      #volume(m**3)
A=10000;   #area(m**2)

#Calculation
x=V*100/A;    #thickness(cm)

#Result
print "thickness is",x,"cm"

thickness is 0.01 cm


## Example number 25.7, Page number 25.9¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
V=54*44*10;     #volume of reservoir(m**3)
r=20;     #empty rate(m)

#Calculation
A=math.pi*R**2;    #area of pipe(m**2)
t=V/(A*r);      #time to empty(sec)

#Result
print "time to empty is",round(t/3600,2),"hours"
print "answer varies due to rounding off errors"

time to empty is 116.71 hours
answer varies due to rounding off errors


## Example number 25.8, Page number 25.9¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
V=3000;      #volume of water(m**3)
A=500*300;   #surface area(m**2)

#Calculation
x=V*100/A;    #depth of rain(cm)

#Result
print "depth of rain is",x,"cm"

depth of rain is 2.0 cm


## Example number 25.9, Page number 25.9¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
a=3;
b=4;
c=5;     #sides of a triangle(m)
h=10;    #height of prism(m)

#Calculation
s=(a+b+c)/2;     #semi perimeter(m)
A=math.sqrt(s*(s-a)*(s-b)*(s-c));    #base area(m**2)
V=A*h;      #volume(m**3)

#Result
print "base area is",A,"m**2"
print "volume is",V,"m**3"

base area is 6.0 m**2
volume is 60.0 m**3


## Example number 25.10, Page number 25.9¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
a=7;     #base of triangle(m)
h=24;    #height(m)

#Calculation
A=math.sqrt(3)*(a**2)/4;     #base area(m**2)
V=A*h;    #volume(m**3)

#Result
print "volume is",int(V),"m**3"

volume is 509 m**3


## Example number 25.11, Page number 25.10¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
h=300*10**3;      #height(m)
d=1/9*10**-2;     #diameter(m)
w=270;     #weight of copper wire(kg)
v=0.027;   #per m**3

#Calculation
A=math.pi*(d**2)/4;    #area(m**2)
V=A*h;      #volume of wire(m**3)
W=V*w/v;    #weight of wire(kg)

#Result
print "weight of wire is",round(W),"kg"
print "answer varies due to rounding off errors"

weight of wire is 2909.0 kg
answer varies due to rounding off errors


## Example number 25.12, Page number 25.10¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
h=1;    #assume

#Calculation
V1=math.pi*r1**2*h;    #volume of water in supply pipe(cm**3)
V2=math.pi*r2**2*h;    #volume of water in discharge pipe(cm**3)
N=V1/V2;     #number of discharge pipes

#Result
print "number of discharge pipes is",N

number of discharge pipes is 4.0


## Example number 25.13, Page number 25.10¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
di=10/100;     #internal diameter(m)
de=12/100;     #external diameter(m)
l=4;    #length(m)
w=7800;    #weight of iron(kg)

#Calculation
V=math.pi*l*(de**2-di**2)/4;    #volume of iron(m**3)
W=V*w;      #weight of iron(kg)

#Result
print "weight of iron is",round(W),"kg"

weight of iron is 108.0 kg


## Example number 25.14, Page number 25.10¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
h=10;    #height of pyramid(m)
d=10;    #length of diagonal(m)

#Calculation
A=d**2/2;    #base area(m**2)
V=A*h/3;     #volume of pyramid(m**3)
a=d/math.sqrt(2);    #side of square(m)
p=4*a;    #base perimeter(m)
x=(h**2)+(a/2)**2;
l=math.sqrt(x);   #slant height(m)
Ls=p*l/2;   #lateral surface(m**2)

#Result
print "volume of pyramid is",round(V,2),"m**3"
print "lateral surface is",Ls,"m**2"

volume of pyramid is 166.67 m**3
lateral surface is 150.0 m**2