summaryrefslogtreecommitdiff
path: root/191/CH4/EX4.8
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /191/CH4/EX4.8
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '191/CH4/EX4.8')
-rwxr-xr-x191/CH4/EX4.8/Example4_8.sce60
-rwxr-xr-x191/CH4/EX4.8/Result4_8.txt38
2 files changed, 98 insertions, 0 deletions
diff --git a/191/CH4/EX4.8/Example4_8.sce b/191/CH4/EX4.8/Example4_8.sce
new file mode 100755
index 000000000..ac5bef847
--- /dev/null
+++ b/191/CH4/EX4.8/Example4_8.sce
@@ -0,0 +1,60 @@
+//Gerschgorin's first theorem
+clc;
+clear;
+close();
+//find the eigen values lying [0,4] with an error of 0.25
+//taking p at mid point of the interval
+C=[2,-1,0;-1,2,-1;0,-1,1];
+p=2;
+
+f(1)=1;
+f(2)=C(1,1)-p;
+count = 0;
+if f(1)*f(2)>0 then
+ count = 1;
+end
+for r=3:4
+ br=C(r-2,r-1);
+ f(r)=-br^2*f(r-2)+(C(r-1,r-1)-p)*f(r-1);
+ if f(r)*f(r-1)>0 then
+ count = count+1;
+// elseif f(r-1)==0 && f(r-1)* ?????? check for sign when f(r)=zero
+ end
+end
+disp(f,'Sturm sequences')
+disp(count,'Number of eigen values strickly greater than 2 : ')
+
+p=1;
+f(1)=1;
+f(2)=C(1,1)-p;
+count1 = 0;
+if f(1)*f(2)>0 then
+ count1 = 1;
+end
+for r=3:4
+ br=C(r-2,r-1);
+ f(r)=-br^2*f(r-2)+(C(r-1,r-1)-p)*f(r-1);
+ if f(r)*f(r-1)>0 then
+ count1 = count1+1;
+ end
+end
+disp(f,'Sturm sequences')
+disp(count1,'Number of eigen values strickly greater than 1 : ')
+
+p=1.5;
+f(1)=1;
+f(2)=C(1,1)-p;
+count2 = 0;
+if f(1)*f(2)>0 then
+ count2 = 1;
+end
+for r=3:4
+ br=C(r-2,r-1);
+ f(r)=-br^2*f(r-2)+(C(r-1,r-1)-p)*f(r-1);
+ if f(r)*f(r-1)>0 then
+ count2 = count2+1;
+ end
+end
+disp(f,'Sturm sequences')
+disp(count2,'Number of eigen values strickly greater than 1.5 : ')
+disp(p+0.25,'Eigen value lying between [1.5,2] ie with an error of 0.25 is : ') \ No newline at end of file
diff --git a/191/CH4/EX4.8/Result4_8.txt b/191/CH4/EX4.8/Result4_8.txt
new file mode 100755
index 000000000..6e0a72ea0
--- /dev/null
+++ b/191/CH4/EX4.8/Result4_8.txt
@@ -0,0 +1,38 @@
+
+ Sturm sequences
+
+ 1.
+ 0.
+ - 1.
+ 1.
+
+ Number of eigen values strickly greater than 2 :
+
+ 0.
+
+ Sturm sequences
+
+ 1.
+ 1.
+ 0.
+ - 1.
+
+ Number of eigen values strickly greater than 1 :
+
+ 1.
+
+ Sturm sequences
+
+ 1.
+ 0.5
+ - 0.75
+ - 0.125
+
+ Number of eigen values strickly greater than 1.5 :
+
+ 2.
+
+ Eigen value lying between [1.5,2] ie with an error of 0.25
+ is :
+
+ 1.75 \ No newline at end of file