from __future__ import division
import math
print('chainage 0 and 20')
a1=0;b1=20;
base=b1-a1;
o1=0;o2=42;
mo1=(o2+o1)/2;
ae1=base*mo1;
print('area=',ae1);
print('chainage 20 and 65')
a1=20;b1=65;
base=b1-a1;
o1=58;o2=42;
mo2=(o2+o1)/2;
ae2=base*mo2;
print('area=',ae2);
print('chainage 65 and 110')
a1=65;b1=110;
base=b1-a1;
o1=0;o2=58;
mo3=(o2+o1)/2;
ae3=base*mo3;
print('area=',ae3);
print('chainage 90 and 110')
a1=90;b1=110;
base=b1-a1;
o1=0;o2=60;
mo4=(o2+o1)/2;
ae4=base*mo4;
print('area=',ae4);
print('chainage 40 and 90')
a1=40;b1=90;
base=b1-a1;
o1=60;o2=20;
mo5=(o2+o1)/2;
ae5=base*mo5;
print('area=',ae5);
print('chainage 0 and 40')
a1=0;b1=40;
base=b1-a1;
o1=20;o2=0;
mo6=(o2+o1)/2;
ae6=base*mo6
print('area=',ae6);
area=ae1+ae2+ae3+ae4+ae5+ae6;
print('area of field =',area);
from __future__ import division
import math
print('chainage 15.5 and 27.5')
a1=15.5;b1=27.5;
base=b1-a1;
o1=0;o2=22.5;
mo1=(o2+o1)/2;
ae1=base*mo1;
ap1=0;
an1=ae1;
print('area=',ae1);
print('chainage 15.5 and 50')
a1=15.5;b1=50;
base=b1-a1;
o1=22.5;o2=30;
mo2=(o2+o1)/2;
ae2=base*mo2;
ap2=ae2;
an2=0;
print('area=',ae2);
print('chainage 50 and 75.5')
a1=50;b1=75.5;
base=b1-a1;
o1=30;o2=35.5;
mo3=(o2+o1)/2;
ae3=base*mo3;
ap3=ae3;
an3=0;
print('area=',ae3);
print('chainage 75.5 and 86.7')
a1=75.5;b1=86.7;
base=b1-a1;
o1=35.5;o2=0;
mo4=(o2+o1)/2;
ae4=base*mo4;
ap4=ae4;
an4=0;
print('area=',ae4);
print('chainage 86.7 and 90')
a1=86.7;b1=90;
base=b1-a1;
o1=0;o2=10.5;
mo5=(o2+o1)/2;
ae5=base*mo5;
ap5=0;
an5=ae5;
print('area=',ae5);
print('chainage 60 and 90')
a1=60;b1=90;
base=b1-a1;
o1=10.5;o2=25.0;
mo6=(o2+o1)/2;
ae6=base*mo6
ap6=ae6;
an6=0;
print('area=',ae6);
print('chainage 35.5 and 60')
a1=35.5;b1=60;
base=b1-a1;
o1=25;o2=15;
mo7=(o2+o1)/2;
ae7=base*mo7
ap7=ae7;
an7=0;
print('area=',ae7);
print('chainage 27.5 and 35.5')
a1=27.5;b1=35.5;
base=b1-a1;
o1=15;o2=0;
mo8=(o2+o1)/2;
ae8=base*mo8
ap8=ae8;
an8=0
print('area=',ae8);
an=an1+an2+an3+an4+an5+an6+an7+an8;
ap=ap1+ap2+ap3+ap4+ap5+ap6+ap7+ap8;
area=ap-an;
print('ap,ae=',ap,an)
print('total area of field =',area);
from __future__ import division
import math
dis=10;
a=0;g=0;
b=2.5;c=3.5;d=5;e=4.6;f=3.2;
print('Mid ordinate rule');
h1=(a+b)/2;
h2=(b+c)/2;
h3=(c+d)/2;
h4=(d+e)/2;
h5=(e+f)/2;
h6=(f+g)/2;
area=dis*(h1+h2+h3+h4+h5+h6);
print('required area is',area,'square meters');
print('average ordinate rule');
dis=10;
p=6;
bl=dis*p;
no=7;
area2=bl*(a+b+c+d+e+f+g)/no;
print('required area is',area2,'sqare meters');
print('trapezoidal rule');
area3=(dis/2)*(2*(a+b+c+d+e+f+g));
print('required area is ',area3,'square meters');
print('simpsons rule');
area4=(dis/3)*(4*(b+d+f)+2*(c+e));
print('required area is ',area4,'square meters');
#ch-7 page 216 pb-2
from __future__ import division
import math
print('trapezoidal rule');
o1=3.5;o2=4.3;o3=6.75;o4=5.25;o5=7.5;o6=8.8;o7=7.9;
o8=6.4;o9=4.4;o10=3.25;
dis=15;
area1=(dis/2)*(o1+o10+(2*(o2+o3+o4+o5+o6+o7+o8+o9)));
print('required area is ',area1,'square meters');
print('simpsons rule')
A1=dis/3*(o1+o9+4*(o2+o4+o6+o8)+2*(o3+o5+o7));
A2=dis/2*(o10+o9);
area2=A1+A2;
print(A1,A2)
print('required area is ',area2,'square meters');
from __future__ import division
import math
o1=2.5;o2=3.8;o3=4.6;o4=5.2;o5=6.1;o6=4.7;o7=5.8;o8=3.9;o9=2.20;
d1=5;
d2=10;
d3=20;
print('trapezoidal rule')
del1=(d1/2)*(o1+o5+2*(o2+o3+o4));
del2=(d2/2)*(o5+o7+2*(o6));
del3=(d3/2)*(o7+o9+2*(o8));
total1=del1+del2+del3;
print(del1,del2,del3)
print('total area=',total1,'meters');
print('simpsons rule')
de1=(d1/3)*(o1+o5+4*(o2+o4)+2*(o3));
de2=(d2/3)*(o5+o7+4*(o6));
de3=(d3/3)*(o7+o9+4*(o8));
total2=de1+de2+de3;
print(de1,de2,de3)
print('total area is ',total2,'meters')
#cha 7 page -225 ;pb-1
from __future__ import division
import math
ir=9.377;
fr=3.336;
m=100;
c=23.521;
n=1;
a1=m*(fr-ir+10*(n)+c);
a2=m*(fr-ir-10*(n)+c);
print('A=',a2);
print('required area is',a2,'meters');
from __future__ import division
import math
ir=8.652;
fr=6.798;
c=20;
m=100;
n=1;
sc=100;
a2=m*(fr-ir-10*(n)+c);
a2=a2*sc;
print('A=',a2);
print('required area is',a2,'meters');
from __future__ import division
import math
ir=4.855;
fr=8.754;
m=100;
n=0;
c=0;
sc=25
a=m*(fr-ir)
a=a*sc;
print('required area is',a,'meters');
from __future__ import division
import math
print('case 1')
ir=3.415;
fr=4.415;
n=0;
c=0;
sc=16; #1cm^2=16m^2;
h=10000;
ag=0.16*h;
am=ag/sc;
print('A=',am);
m=am/(fr-ir);
print('M=',m);
print('case 2');
fr_ir=2.25;
c=21.22;
n=1
a1=m*(fr_ir-10+c);
print('required area is',a1);
area=m*c;
print('area of zero circle is',area);
from __future__ import division
import math
l=10;b=15;
a1=l*b;
ir=0.686;
fr=9.976;
n=2;
m=100;
marea=150;
c=(marea/100)+10.710;
area=m*c;
print('area of zero circle is',area,'square centimeters');
from __future__ import division
import math
print('case 1')
n=1;
c=0;
m=100;
fr=4.825;
ir=7.775;
area1=m*(fr-ir+10*n)
print('area of figure is',area1,'square cm');
print('case 2')
fr=8.755;
ir=2.325;
m=100;
n=2;
area2=m*(fr-ir-10*n+c)
print('area of figure is',area2,'sq cm')
c=(area1/m)+13.570;
print('C=',c)
areac=m*c;
print('area of zero circle is',areac,'square cm');