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');
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);
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);
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)
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)
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);
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);
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);
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)
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)