summaryrefslogtreecommitdiff
path: root/1670/CH4/EX4.5/4_5.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /1670/CH4/EX4.5/4_5.sce
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 '1670/CH4/EX4.5/4_5.sce')
-rwxr-xr-x1670/CH4/EX4.5/4_5.sce37
1 files changed, 37 insertions, 0 deletions
diff --git a/1670/CH4/EX4.5/4_5.sce b/1670/CH4/EX4.5/4_5.sce
new file mode 100755
index 000000000..34a049b36
--- /dev/null
+++ b/1670/CH4/EX4.5/4_5.sce
@@ -0,0 +1,37 @@
+//Example 4.5
+//Jacobi Method
+//Page no. 95
+clc;close;clear;
+
+A=[10,7,8,7;7,5,6,5;8,6,10,9;7,5,9,10];
+n=4;
+for k=1:14
+ max1=0
+for i=1:n
+ for j=1:n
+ if A(i,j)>max1 & i~=j then
+ max1=A(i,j)
+ i1=i;j1=j;
+ end
+ end
+end
+fi=(atan((2*A(i1,j1))/(A(i1,i1)-A(j1,j1)+10^-20)))/2
+disp(fi,'fi = ')
+O1=eye(n,n)
+O1(i1,j1)=-sin(fi)
+O1(j1,i1)=sin(fi)
+O1(i1,i1)=cos(fi)
+O1(j1,j1)=cos(fi)
+disp(O1,'O1 = ')
+A=inv(O1)*A*O1
+disp(A,'A1 = ')
+end
+printf('\n\n The eigenvalues are : \n\n')
+for i=1:n
+ printf('\tl%i = %g\t',i,A(i,i))
+end
+printf('\n\n')
+l=poly(0,'lb')
+A=A-l*eye(n,n)
+disp(det(A),'Characteristic Equation = ')
+printf("\n\n\n\n\nNote : Computation Errors in some parts in calculation performed in book") \ No newline at end of file