# Chapter 8: Computation of volume¶

### cha-8 page-241 pb-1¶

In [1]:
from __future__ import division

import math

h1=0.90;h2=1.25;h3=2.15;h4=2.50;h5=1.85;h6=1.35;h7=0.85;

b=10;
sh=1.5;

h=40;

d1=(b+(sh*h1))*h1;
d2=(b+(sh*h2))*h2;
d3=(b+(sh*h3))*h3;
d4=(b+(sh*h4))*h4;
d5=(b+(sh*h5))*h5;
d6=(b+(sh*h6))*h6;
d7=(b+(sh*h7))*h7;

print(d1,d2,d3,d4,d5,d6,d7)
print('by trapezoidal rule');
v=(h/2)*(d1+d7+2*(d2+d3+d4+d5+d6));
print('V=',v,'meter cube');

print('by prismoidal rule');

v1=(h/3)*(d1+d7+4*(d2+d4+d6)+2*(d3+d5));

print('V=',v1,'meter cube');

(10.215, 14.84375, 28.433749999999996, 34.375, 23.633750000000003, 16.23375, 9.58375)
by trapezoidal rule
('V=', 5096.775, 'meter cube')
by prismoidal rule
('V=', 5143.25, 'meter cube')


### cha-8 page-241,242 pb-2¶

In [2]:
from __future__ import division

import math

h1=0.75;h2=1.15;h3=0.80;h4=1.30;h5=1.5;h6=0.75
b=8;sh=2;

x1=(50*h1)/(h1+h2);
x2=(50*h2)/(h2+h3);
x3=(50*h3)/(h4+h3);
x4=(50*h4)/(h4+h5);
print(x1,x2,x3,x4);

a1=(b+(sh*h1))*h1;
a2=(b+(sh*h2))*h2;
a3=(b+(sh*h3))*h3;
a4=(b+(sh*h4))*h4;
a5=(b+(sh*h5))*h5;
a6=(b+(sh*h6))*h6;
print(a1,a2,a3,a4,a5,a6)

print('from chainage 0 to 50');
c1=(a1/2)*(x1);
f1=(a2/2)*(x2+0.79);
print(c1,f1);

print('from chainage 50 to 100');
f2=(a2/2)*(x2);
c2=(a3/2)*(x3+1.46);
print(c2,f2);

print('from chainage 100 to 150');
c3=(a3/2)*(x3);
f3=(a4/2)*(30.95);
print(c3,f3);

print('from chainage 150 to 200');
f4=(a4/2)*(x4);
c4=(a5/2)*(x4+3.59);
print(c4,f4);

print('from chainage 200 to 250');
c5=((a1+a5)/2)*50;

print(c5);

tc=c1+c2+c3+c4+c5;
tf=f1+f2+f3+f4;

print('total cutting =',tc);
print('total fitting=',tf);

(19.736842105263158, 29.487179487179485, 19.047619047619047, 23.214285714285715)
(7.125, 11.845, 7.68, 13.78, 16.5, 7.125)
from chainage 0 to 50
(70.3125, 179.3165955128205)
from chainage 50 to 100
(78.74925714285715, 174.63782051282053)
from chainage 100 to 150
(73.14285714285714, 213.2455)
from chainage 150 to 200
(221.13535714285715, 159.94642857142858)
from chainage 200 to 250
590.625
('total cutting =', 1033.9649714285715)
('total fitting=', 727.1463445970695)


### cha-8 page-244 pb-3¶

In [3]:
from __future__ import division

import math
h=50;
h1=2.50;h2=1.25;h3=0.95;h4=1.65;h5=2.20;h6=2.85;h7=0.75;
b=8;sh=1;

a1=(b+(sh*h1))*h1;
a2=(b+(sh*h2))*h2;
a3=(b+(sh*h3))*h3;
a4=(b+(sh*h4))*h4;
a5=(b+(sh*h5))*h5;
a6=(b+(sh*h6))*h6;
a7=(b+(sh*h7))*h7;

print(a1,a2,a3,a4,a5,a6,a7);

v=(h/3)*(a1+a7+4*(a2+a4+a6)+2*(a3+a5));

print('volume=',v);

(26.25, 11.5625, 8.5025, 15.9225, 22.44, 30.9225, 6.5625)
('volume=', 5472.125)


### cha-8 page-245 pb-4¶

In [4]:
from __future__ import division

import math

a1=2050;a2=8400;a3=16300;a4=24600;a5=31500;

h=5;

print('according to trapezoidal rule')

v1=(h/2)*(a1+a5+2*(a2+a3+a4));

print('volume =',v1);

print('according to prismoidal rule')

v2=(h/3)*(a1+a5+4*(a2+a4)+2*(a3));

print('volume =',v2)

according to trapezoidal rule
('volume =', 330375.0)
according to prismoidal rule
('volume =', 330250.0)


### cha-8 page-245,246 pb-5¶

In [5]:
from __future__ import division

import math

print('bottom section')
L=40;
B=30;
a1=L*B;
print('area A1=',a1)

print('mid section')
b=40;
sh=2.5;

l=L+2*2*sh;
b=B+2*2*sh;
a2=l*b;
print('area A2=',a2);

print('top section')
sh=5;

l1=L+2*sh;
b1=B*2*2*sh;
a3=l1*b1;
print('area A3=',a3)

bottom section
('area A1=', 1200)
mid section
('area A2=', 2000.0)
top section
('area A3=', 30000)


### cha-8 page-246,247 pb-6¶

In [6]:
from __future__ import division

import math

b=8;
h=2;
n=10;
s=1;

print('first section');
b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));
b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));

a1=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));
print(b1,b2)

print('area A1=',a1);

print('second section');
b=8;h=3;n=10;s=1;

b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));
b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));

a2=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));
print(b1,b2)

print('area A2=',a2);

print('third section');
b=8;h=4;n=10;s=1;

b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));
b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));

a3=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));
print(b1,b2)

print('area A3=',a3);

first section
(6.666666666666666, 5.454545454545455)
('area A1=', 20.36363636363636)
second section
(7.777777777777778, 6.363636363636363)
('area A2=', 33.494949494949495)
third section
(8.88888888888889, 7.2727272727272725)
('area A3=', 48.64646464646465)


### cha-8 page-247,248 pb-7¶

In [7]:
from __future__ import division

import math

b=10;
h=1;
n=10;
s=1;

print('first section');
b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));
b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));

a1=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));
print(b1,b2)

print('area A1=',a1);

print('second section');
b=10;h=2;n=5;s=1;

b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));
b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));

a2=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));
print(b1,b2)

print('area A2=',a2);

print('third section');
b=10;h=1.5;n=8;s=1;

b1=(b/2)+((n*s)/(n-s))*(h+(b/(2*n)));
b2=(b/2)+((n*s)/(n+s))*(h-(b/(2*n)));

a3=0.5*((((b/(2*s))+h))*(b1+b2)-((b*b)/(2*s)));
print(b1,b2)

print('area A3=',a3);

first section
(6.666666666666667, 5.454545454545454)
('area A1=', 11.36363636363636)
second section
(8.75, 5.833333333333333)
('area A2=', 26.041666666666664)
third section
(7.428571428571429, 5.777777777777778)
('area A3=', 17.920634920634917)


### cha-8 page-248 pb-8¶

In [8]:
from __future__ import division

import math

print('at station 1');
h=1;h1=2.55;h2=0.95;b=9;b1=7.5;b2=5.25;
w1=b1+b2
a=(((h/2)*(b1+b2))+((b/4)*(h1+h2)));
print('area=',a)

print('at station 2');
h=1.5;h1=2.8;h2=1.35;b=9;b1=8.1;b2=4.75;

a1=(((h/2)*(b1+b2))+((b/4)*(h1+h2)));
d=50;
k=10.01;
v=(d/2)*(a+a1);
w2=b1+b2
print('area=',a1)
h2=1;
h1=1.5;
cp=(d/12)*(h1-h2)*(w2-w1);

cv=v-cp;
print('v=',v,'cp=',cp)
print('correct volume =',cv);

at station 1
('area=', 14.25)
at station 2
('area=', 18.975)
('v=', 830.625, 'cp=', 0.20833333333333262)
('correct volume =', 830.4166666666666)


### cha-8 page-249 pb-9¶

In [9]:
from __future__ import division

import math

print('section 1')
b=10;n=5;s=1;s1=2;
d=50;h1=0.5;h2=0.7;

ac=0.5*(((0.5*b+n*h1)*(0.5*b+n*h1))/(n-s));

af=0.5*(((0.5*b-n*h1)*(0.5*b-n*h1))/(n-s1));

print(ac,af)

print('section 2')

ac1=0.5*(((0.5*b+n*h2)*(0.5*b+n*h2))/(n-s));

af1=0.5*(((0.5*b-n*h2)*(0.5*b-n*h2))/(n-s1));
D=50;
print(ac1,af1)
vc=((ac+ac1)/2)*D;
vf=((af+af1)/2)*D;

print('vc=',vc,'vf=',vf);

D=50;
pcc=(D/(12*(n-s)))*(n*n*(h1-h2)*(h1-h2));

pcf=(D/(12*(n-s1)))*(n*n*(h1-h2)*(h1-h2));

cvc=vc-pcc;
cvf=vf-pcf;

print('corrected volume (in cutting)=',cvc);

print('corrected volume(in filling)',cvf)

section 1
(7.03125, 1.0416666666666667)
section 2
(9.03125, 0.375)
('vc=', 401.5625, 'vf=', 35.41666666666667)
('corrected volume (in cutting)=', 400.5208333333333)
('corrected volume(in filling)', 34.027777777777786)


### cha-8 page-251 pb-10¶

In [10]:
from __future__ import division

import math

a1=0;a2=3.0;
b1=2.20;b2=5.50;
c1=1.75;c2=3.0;
d1=1.5;d2=0;
e1=4.75;e2=5.25;
f1=6.40;f2=7.30;
g1=0;g2=3.0;

print('at station 1')
sp=(e1*d2)+(f1*e2)+(d2*f2)+(c1*d2)+(b1*c2)+(a1*b2);

sq=(e2*d1)+(e1*f2)+(f1*g2)+(d1*c2)+(c1*b2)+(b1*a2);

area1=0.5*(sp-sq)
area1=abs(area1);
print(sp,sq)
print('area =',area1)

a1=0;a2=3.0;
b1=3.1;b2=5.25;
c1=2.20;c2=3.0;
d1=2;d2=0;
e1=5.25;e2=6;
f1=7.40;f2=8.5;
g1=0;g2=3.0;
print('at station 2')
sp1=(e1*d2)+(f1*e2)+(d2*f2)+(c1*d2)+(b1*c2)+(a1*b2);

sq1=(d1*e2)+(e1*f2)+(f1*g2)+(d1*c2)+(c1*b2)+(b1*a2);
print(sp1,sq1)

area2=0.5*(sp1-sq1)
area2=abs(area2);
print('area =',area2)

print('volume by average end area rule')
v=50*((area1+area2)/2);
print('volume=',v)

at station 1
(40.2, 82.475)
('area =', 21.137499999999996)
at station 2
(53.7, 105.675)
('area =', 25.987499999999997)
volume by average end area rule
('volume=', 1178.1249999999998)