summaryrefslogtreecommitdiff
path: root/3782/CH7/EX7.3/Ex7_3.sce
blob: d034f8f6b9df8c5173f07473de1cbb5428560956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48



//

//GIVEN


dis=10
a=0,g=0,

b=2.5,c=3.5,d=5,e=4.6,f=3.2,


printf("\n Mid ordinate rule')
//FINDING MID ORDINATES
h1=(a+b)/2
h2=(b+c)/2
h3=(c+d)/2
h4=(d+e)/2
h5=(e+f)/2
h6=(f+g)/2
//find area
area=dis*(h1+h2+h3+h4+h5+h6)

printf("\n required area is %0.3f square meters',area)

printf("\n average ordinate rule')
dis=10//m
p=6//no of divs
bl=dis*p//base length
no=7//no of ordinates


area2=bl*(a+b+c+d+e+f+g)/no

printf("\n required area is %0.3f square meters',area2)

printf("\n trapezoidal rule')


area3=(dis/2)*(2*(a+b+c+d+e+f+g))

printf("\n required area is  %0.3f square meters',area3)
printf("\n simpsons rule')

area4=(dis/3)*(4*(b+d+f)+2*(c+e))
printf("\n required area is  %0.3f square meters',area4)