summaryrefslogtreecommitdiff
path: root/413/CH8/EX8.3/Example_8_3.sce
diff options
context:
space:
mode:
Diffstat (limited to '413/CH8/EX8.3/Example_8_3.sce')
-rw-r--r--413/CH8/EX8.3/Example_8_3.sce20
1 files changed, 20 insertions, 0 deletions
diff --git a/413/CH8/EX8.3/Example_8_3.sce b/413/CH8/EX8.3/Example_8_3.sce
new file mode 100644
index 000000000..e8f933a6a
--- /dev/null
+++ b/413/CH8/EX8.3/Example_8_3.sce
@@ -0,0 +1,20 @@
+clc
+clear
+A=[6 -2 1; -2 7 2; 1 2 5]
+b=[11 5 -1]
+D=[6 0 0; 0 7 0; 0 0 -5]
+L=[0 0 0; -2 0 0; 1 2 0]
+U=[0 -2 1; 0 0 2; 0 0 0]
+DI=inv(D)
+printf('For Jacobi method, we need to compute the eigen value of this matrix')
+B=DI*(L+U)
+disp(B)
+T=spec(B)
+disp(T)
+printf(' Magnitude of Largest eigenvaue is %f',abs(T(2,1)))
+printf('\n\nFor Gauss-Seidel method, we need to compute the eigen value of this matrix')
+B=inv(L+D)*U
+disp(B)
+T=spec(B)
+disp(T)
+printf(' Magnitude of Largest eigenvaue is %f',abs(T(2,1))) \ No newline at end of file