diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /191/CH4/EX4.8/Example4_8.sce | |
download | Scilab-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/Example4_8.sce')
-rwxr-xr-x | 191/CH4/EX4.8/Example4_8.sce | 60 |
1 files changed, 60 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 |