summaryrefslogtreecommitdiff
path: root/413/CH2
diff options
context:
space:
mode:
Diffstat (limited to '413/CH2')
-rw-r--r--413/CH2/EX2.1/Example_2_1.sce16
-rw-r--r--413/CH2/EX2.2/Example_2_2.sce8
-rw-r--r--413/CH2/EX2.3/Example_2_3.sce12
-rw-r--r--413/CH2/EX2.4/Example_2_4.sce24
-rw-r--r--413/CH2/EX2.5/LU_Decomposition.sce13
5 files changed, 73 insertions, 0 deletions
diff --git a/413/CH2/EX2.1/Example_2_1.sce b/413/CH2/EX2.1/Example_2_1.sce
new file mode 100644
index 000000000..33637531c
--- /dev/null
+++ b/413/CH2/EX2.1/Example_2_1.sce
@@ -0,0 +1,16 @@
+//Matrix operations
+clearglobal()
+clc;
+A=[3 -1 4;0 2 -3; 1 1 2]
+printf('Matrix is')
+disp(A)
+printf('Transpose is')
+ disp (A')
+ printf('Trace of Matrix is')
+ disp(trace(A))
+ printf('Determinant of Matrix is')
+ disp(det(A))
+printf('Characteristic equation of Matrix is')
+disp(poly(A,"x"))
+printf('Eigenvalues of Matrix is')
+ disp(spec(A)) \ No newline at end of file
diff --git a/413/CH2/EX2.2/Example_2_2.sce b/413/CH2/EX2.2/Example_2_2.sce
new file mode 100644
index 000000000..81e791613
--- /dev/null
+++ b/413/CH2/EX2.2/Example_2_2.sce
@@ -0,0 +1,8 @@
+//Inverse of A Matrix
+clearglobal()
+clc;
+A=[1 -1 2;3 0 1;1 0 2]
+printf('Matrix is')
+disp(A)
+printf('Inverse is')
+ disp (inv(A)) \ No newline at end of file
diff --git a/413/CH2/EX2.3/Example_2_3.sce b/413/CH2/EX2.3/Example_2_3.sce
new file mode 100644
index 000000000..b3d1a7503
--- /dev/null
+++ b/413/CH2/EX2.3/Example_2_3.sce
@@ -0,0 +1,12 @@
+// Compute 1-, 2-, inf norms of the vector x, if x=[1.25, 0.02, -5.15, 0]
+clearglobal()
+clc;
+x=[1.25 0.02 -5.15 0]
+printf('x is')
+disp(x)
+printf('First Norm of x is')
+disp(norm(x,1))
+printf('Second Norm of x is')
+disp(norm(x,2))
+printf('infinite Norm of x is')
+disp(norm(x,'inf')) \ No newline at end of file
diff --git a/413/CH2/EX2.4/Example_2_4.sce b/413/CH2/EX2.4/Example_2_4.sce
new file mode 100644
index 000000000..c307d1cf2
--- /dev/null
+++ b/413/CH2/EX2.4/Example_2_4.sce
@@ -0,0 +1,24 @@
+ //Compute the Frobenius norms of A, B, C and the infinity norms
+clearglobal()
+clc;
+A=[5 9;-2 1]
+printf('Matrix A is')
+disp(A)
+printf('Frobenius Norm of A is')
+disp(norm(A,'fro'))
+B=[0.1 0;0.2 0.1]
+printf('infinite Norm of A is')
+disp(norm(A,'inf'))
+printf('Matrix B is')
+disp(B)
+printf('Frobenius Norm of B is')
+disp(norm(B,'fro'))
+printf('infinite Norm of B is')
+disp(norm(B,'inf'))
+C=[0.2 0.1;0.1 0]
+printf('Matrix C is')
+disp(C)
+printf('Frobenius Norm of C is')
+disp(norm(C,'fro'))
+printf('infinite Norm of C is')
+disp(norm(C,'inf')) \ No newline at end of file
diff --git a/413/CH2/EX2.5/LU_Decomposition.sce b/413/CH2/EX2.5/LU_Decomposition.sce
new file mode 100644
index 000000000..11afb1bc6
--- /dev/null
+++ b/413/CH2/EX2.5/LU_Decomposition.sce
@@ -0,0 +1,13 @@
+//LU Decomposition
+clearglobal()
+clc;
+A=[0 2 0 1 0; 2 2 3 2 -2; 4 -3 0 1 -7; 6 1 -6 -5 6]
+[L, U, P]=lu(A)
+printf('Matrix is')
+disp(A)
+printf('L=')
+disp(L)
+printf('U=')
+disp(U)
+printf('P=')
+disp(P) \ No newline at end of file