summaryrefslogtreecommitdiff
path: root/3782/CH7/EX7.5/Ex7_5.sce
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /3782/CH7/EX7.5/Ex7_5.sce
parentb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff)
downloadScilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip
initial commit / add all books
Diffstat (limited to '3782/CH7/EX7.5/Ex7_5.sce')
-rw-r--r--3782/CH7/EX7.5/Ex7_5.sce43
1 files changed, 43 insertions, 0 deletions
diff --git a/3782/CH7/EX7.5/Ex7_5.sce b/3782/CH7/EX7.5/Ex7_5.sce
new file mode 100644
index 000000000..ad7c4ae39
--- /dev/null
+++ b/3782/CH7/EX7.5/Ex7_5.sce
@@ -0,0 +1,43 @@
+
+
+
+//
+
+//offsets
+
+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,
+
+//here intervals are non uniform
+d1=5
+d2=10
+d3=20
+
+
+printf("\n trapezoidal rule')
+
+//area of first section
+del1=(d1/2)*(o1+o5+2*(o2+o3+o4))
+
+//area of second section
+del2=(d2/2)*(o5+o7+2*(o6))
+
+//area of third section
+del3=(d3/2)*(o7+o9+2*(o8))
+
+//total area
+total1=del1+del2+del3
+printf("\n%0.3f %0.3f %0.3f", del1,del2,del3)
+
+printf("\n total area= %0.3f square meters',total1)
+
+printf("\n 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
+printf("\n%0.3f %0.3f %0.3f", de1,de2,de3)
+
+printf("\n total area is %0.3f square meters',total2)