summaryrefslogtreecommitdiff
path: root/50/CH5/EX5.26/ex_5_26.sce
diff options
context:
space:
mode:
Diffstat (limited to '50/CH5/EX5.26/ex_5_26.sce')
-rwxr-xr-x50/CH5/EX5.26/ex_5_26.sce42
1 files changed, 42 insertions, 0 deletions
diff --git a/50/CH5/EX5.26/ex_5_26.sce b/50/CH5/EX5.26/ex_5_26.sce
new file mode 100755
index 000000000..402f55cb0
--- /dev/null
+++ b/50/CH5/EX5.26/ex_5_26.sce
@@ -0,0 +1,42 @@
+// Example 5.26
+// caption: 1) composite trapizoidal rule, 2) composite simpsons rule with 2,4 ,8 equal sub-intervals,
+
+// I=integral 1/(1+x) in the range [0,1]
+
+deff('[y]=f(x)','y=1/(1+x)')
+
+// when N=2;
+// 1)composite trapizoidal rule
+h=1/2;
+x=0:h:1;
+
+ IT=comptrapezoidal(x,h,f)
+
+ // 2)composite simpsons rule
+
+ [I] = simpson13(x,h,f)
+
+
+ // when N=4
+ // 1)composite trapizoidal rule
+h=1/4;
+x=0:h:1;
+
+ IT=comptrapezoidal(x,h,f)
+
+ // 2)composite simpsons rule
+
+ [I] = simpson13(x,h,f)
+
+
+
+ // when N=8
+ // 1)composite trapizoidal rule
+h=1/8;
+x=0:h:1;
+
+ IT=comptrapezoidal(x,h,f)
+
+ // 2)composite simpsons rule
+
+ [I] = simpson13(x,h,f) \ No newline at end of file