summaryrefslogtreecommitdiff
path: root/260/CH11/EX11.6
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /260/CH11/EX11.6
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 '260/CH11/EX11.6')
-rw-r--r--260/CH11/EX11.6/11_6.sce27
1 files changed, 27 insertions, 0 deletions
diff --git a/260/CH11/EX11.6/11_6.sce b/260/CH11/EX11.6/11_6.sce
new file mode 100644
index 000000000..c7042bb6e
--- /dev/null
+++ b/260/CH11/EX11.6/11_6.sce
@@ -0,0 +1,27 @@
+//Eg-11.6
+//pg-480
+
+// Simplifying, the function to be integrated simplifies , we define an inline function as the same.
+
+clear
+clc
+
+deff('out = func(in)','out = 5.093*10^(-5)*(exp(2*in) * (1+in^2)^(-2))')
+
+a = 0;
+b = 2;
+h = (b-a)/3;
+
+t1 = func(a);
+t2 = func(a+h);
+t3 = func(a+2*h)
+t4 = func(b);
+
+
+//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 = (3*h/8)*(t1 + 3*t2 + 3*t3 + t4);
+I = abs(I); //since integral we have to consider the absolute value
+
+printf('Using simpsons 3/8 rule we get %f\n',I) \ No newline at end of file