summaryrefslogtreecommitdiff
path: root/260/CH11/EX11.3/11_3.sce
diff options
context:
space:
mode:
Diffstat (limited to '260/CH11/EX11.3/11_3.sce')
-rw-r--r--260/CH11/EX11.3/11_3.sce24
1 files changed, 24 insertions, 0 deletions
diff --git a/260/CH11/EX11.3/11_3.sce b/260/CH11/EX11.3/11_3.sce
new file mode 100644
index 000000000..63b56ff55
--- /dev/null
+++ b/260/CH11/EX11.3/11_3.sce
@@ -0,0 +1,24 @@
+//Eg-11.3
+//pg-473
+
+clc
+clear
+
+Cf = 10^(-6);
+Ci = 10^(-5);
+h = (Cf-Ci)/2;
+
+deff('out = func(in)','out = -100/in')
+
+t1 = func(Ci);
+t2 = func(Ci+h);
+t3 = func(Cf);
+
+//Now the integration using the simpson's 1/3 rule I = (h/3)[f(a)+4f(a+h)+f(b)]
+//h = (b-a)/2
+
+I = (h/3)*(t1 + 4*t2 + t3);
+I = abs(I); //since integral we have to consider the absolute value
+
+printf('The calculated value of the integral is %f\n',I)
+printf(' The exact value of the integral is 230.3') \ No newline at end of file