summaryrefslogtreecommitdiff
path: root/260/CH11/EX11.5/11_5.sce
diff options
context:
space:
mode:
Diffstat (limited to '260/CH11/EX11.5/11_5.sce')
-rw-r--r--260/CH11/EX11.5/11_5.sce20
1 files changed, 20 insertions, 0 deletions
diff --git a/260/CH11/EX11.5/11_5.sce b/260/CH11/EX11.5/11_5.sce
new file mode 100644
index 000000000..aab8193ad
--- /dev/null
+++ b/260/CH11/EX11.5/11_5.sce
@@ -0,0 +1,20 @@
+//Eg-11.5
+//pg-477
+
+clear
+clc
+
+//defining an inline function for simplicity and integrating it from x = 0 to 0.9
+
+deff('out = func(in)','out = 0.3 + 1.6*in + 0.027*in^2')
+
+h = (0.9-0)/3; //Stepsize
+b = 0.9;
+a = 0;
+
+//Integrating using the simpsons 1/3rd rule
+
+I = (3*h/8)*(func(a) + 3*func(a+h) + 3*func(a+2*h) + func(b));
+
+printf('The value of the integration is %f\n',I)
+printf(' Since the function to be integrated is a quadratic, the value of the integral is exact') \ No newline at end of file