summaryrefslogtreecommitdiff
path: root/3293/CH8
diff options
context:
space:
mode:
Diffstat (limited to '3293/CH8')
-rwxr-xr-x3293/CH8/EX8.1/Ex8_1.sce13
-rwxr-xr-x3293/CH8/EX8.12/Ex8_12.sce35
-rwxr-xr-x3293/CH8/EX8.13/Ex8_13.sce24
-rwxr-xr-x3293/CH8/EX8.14/Ex8_14.sce17
-rwxr-xr-x3293/CH8/EX8.15/Ex8_15.sce13
-rwxr-xr-x3293/CH8/EX8.17/Ex8_17.sce42
-rwxr-xr-x3293/CH8/EX8.2/Ex8_2.sce16
-rwxr-xr-x3293/CH8/EX8.28/Ex8_28.sce26
-rwxr-xr-x3293/CH8/EX8.9/Ex8_9.sce34
9 files changed, 220 insertions, 0 deletions
diff --git a/3293/CH8/EX8.1/Ex8_1.sce b/3293/CH8/EX8.1/Ex8_1.sce
new file mode 100755
index 000000000..c7248ff67
--- /dev/null
+++ b/3293/CH8/EX8.1/Ex8_1.sce
@@ -0,0 +1,13 @@
+//page 271
+//Example 8.1
+clc;
+clear;
+close;
+n = round(rand() * 10 + 2);
+a = round(rand(1,n) * 10)
+b = round(rand(1,n) * 10)
+disp(n,'n = ');
+disp(a,'a = ');
+disp(b,'b = ');
+disp(a*b','Then, (a|b) = ');
+//end
diff --git a/3293/CH8/EX8.12/Ex8_12.sce b/3293/CH8/EX8.12/Ex8_12.sce
new file mode 100755
index 000000000..e1e52f24e
--- /dev/null
+++ b/3293/CH8/EX8.12/Ex8_12.sce
@@ -0,0 +1,35 @@
+//page 282
+//Example 8.12
+clc;
+clear;
+close;
+b1 = [3 0 4];
+b2 = [-1 0 7];
+b3 = [2 9 11];
+disp(b1,'b1 = ');
+disp(b2,'b2 = ');
+disp(b3,'b3 = ');
+disp('Applying the Gram-Schmidt process to b1,b2,b3:');
+a1 = b1;
+disp(a1,'a1 = ');
+a2 = b2-((b2*b1')'/25*b1);
+disp(a2,'a2 = ');
+a3 = b3-((b3*b1')'/25*b1) - ((b3*a2')'/25*a2);
+disp(a3,'a3 = ');
+disp('{a1,a2,a3} are mutually orthogonal and hence forms orthogonal basis for R^3');
+disp('Any arbitrary vector {x1,x2,x3} in R^3 can be expressed as:');
+disp('y = {x1,x2,x3} = (3*x1 + 4*x3)/25*a1 + (-4*x1 + 3*x3)/25*a2 + x2/9*a3');
+x1 = 1;
+x2 = 2;
+x3 = 3;
+y = (3*x1 + 4*x3)/25*a1 + (-4*x1 + 3*x3)/25*a2 + x2/9*a3;
+disp(x1,'x1 = ');
+disp(x2,'x2 = ');
+disp(x3,'x3 = ');
+disp(y,'y = ');
+disp('i.e. y = [x1 x2 x3], according to above equation.');
+disp('Hence, we get the orthonormal basis as:');
+disp(',',1/5*a1);
+disp(',',1/5*a2);
+disp(1/9*a3);
+//end
diff --git a/3293/CH8/EX8.13/Ex8_13.sce b/3293/CH8/EX8.13/Ex8_13.sce
new file mode 100755
index 000000000..82928c493
--- /dev/null
+++ b/3293/CH8/EX8.13/Ex8_13.sce
@@ -0,0 +1,24 @@
+//page 283
+//Example 8.13
+clc;
+clear;
+close;
+A = rand(2,2);
+A(1,:) = A(1,:) + 1; //so b1 is not equal to zero
+a = A(1,1);
+b = A(1,2);
+c = A(2,1);
+d = A(2,2);
+b1 = A(1,:);
+b2 = A(2,:);
+disp(A,'A = ');
+disp(b1,'b1 = ');
+disp(b2,'b2 = ');
+disp('Applying the orthogonalization process to b1,b2:');
+a1 = [a b];
+a2 = (det(A)/(a^2 + b^2))*[-b' a'];
+disp(a1,'a1 = ');
+disp(a2,'a2 = ');
+disp('a2 is not equal to zero if and only if b1 and b2 are linearly independent.');
+disp('That is, if determinant of A is non-zero.');
+//end
diff --git a/3293/CH8/EX8.14/Ex8_14.sce b/3293/CH8/EX8.14/Ex8_14.sce
new file mode 100755
index 000000000..876816869
--- /dev/null
+++ b/3293/CH8/EX8.14/Ex8_14.sce
@@ -0,0 +1,17 @@
+//page 286
+//Example 8.14
+clc;
+clear;
+close;
+v = [-10 2 8];
+u = [3 12 -1]
+disp(v,'v = ');
+disp(u,'v = ');
+disp('Orthogonal projection of v1 on subspace W spanned by v2 is given by:');
+a = ((u*v')')/(u(1)^2 + u(2)^2 + u(3)^2) * u;
+disp(a);
+disp('Orthogonal projection of R^3 on W is the linear transformation E given by:');
+printf('(x1,x2,x3) -> (3*x1 + 12*x2 - x3)/%d * (3 12 -1)',(u(1)^2 + u(2)^2 + u(3)^2));
+disp('Rank(E) = 1');
+disp('Nullity(E) = 2');
+//end
diff --git a/3293/CH8/EX8.15/Ex8_15.sce b/3293/CH8/EX8.15/Ex8_15.sce
new file mode 100755
index 000000000..32e9df600
--- /dev/null
+++ b/3293/CH8/EX8.15/Ex8_15.sce
@@ -0,0 +1,13 @@
+//page 288
+//Example 8.15
+clc;
+clear;
+close;
+//part c
+disp('f = (sqrt(2)*cos(2*pi*t) + sqrt(2)*sin(4*pi*t))^2');
+disp('Integration (f dt) in limits 0 to 1 = ');
+x0 = 0;
+x1 = 1;
+X = integrate('(sqrt(2)*cos(2*%pi*t) + sqrt(2)*sin(4*%pi*t))^2','t',x0,x1);
+disp(X);
+//end
diff --git a/3293/CH8/EX8.17/Ex8_17.sce b/3293/CH8/EX8.17/Ex8_17.sce
new file mode 100755
index 000000000..94cde9613
--- /dev/null
+++ b/3293/CH8/EX8.17/Ex8_17.sce
@@ -0,0 +1,42 @@
+//page 294
+//Example 8.17
+//Equation given in example 14 is used.
+clc;
+clear;
+close;
+function [m] = transform(x,y,z)
+ x1 = 3*x;
+ x2 = 12*y;
+ x3 = -z;
+ m = [x1 x2 x3];
+endfunction
+
+disp('Matrix of projection E in orthonormal basis is:');
+t1 = transform(3,3,3);
+t2 = transform(12,12,12);
+t3 = transform(-1,-1,-1);
+A = [t1; t2; t3];
+disp(A,'A = 1/154 * ');
+A1 = (conj(A))';
+disp(A1,'A* = ');
+disp('Since, E = E* and A = A*, then A is also the matrix of E*');
+a1 = [154 0 0];
+a2 = [145 -36 3];
+a3 = [-36 10 12];
+disp(a1,'a1 = ');
+disp(a2,'a2 = ');
+disp(a3,'a3 = ');
+disp('{a1,a2,a3} is the basis.');
+Ea1 = [9 36 -3];
+Ea2 = [0 0 0];
+Ea3 = [0 0 0];
+disp(Ea1,'Ea1 = ');
+disp(Ea2,'Ea2 = ');
+disp(Ea3,'Ea3 = ');
+B = [-1 0 0;-1 0 0;0 0 0];
+disp('Matrix B of E in the basis is:');
+disp(B,'B = ');
+B1 = (conj(B))';
+disp(B1,'B* = ');
+disp('Since, B is not equal to B*, B is not the matrix of E*');
+//end
diff --git a/3293/CH8/EX8.2/Ex8_2.sce b/3293/CH8/EX8.2/Ex8_2.sce
new file mode 100755
index 000000000..314c7f30d
--- /dev/null
+++ b/3293/CH8/EX8.2/Ex8_2.sce
@@ -0,0 +1,16 @@
+//page 271
+//Example 8.2
+clc;
+clear;
+close;
+a = round(rand(1,2) * 10)
+b = round(rand(1,2) * 10)
+disp(a,'a = ');
+disp(b,'b = ');
+x1 = a(1);
+x2 = a(2);
+y1 = b(1);
+y2 = b(2);
+t = x1*y1 - x2*y1 - x1*y2 + 4*x2*y2;
+disp(t,'Then, a|b = ');
+//end
diff --git a/3293/CH8/EX8.28/Ex8_28.sce b/3293/CH8/EX8.28/Ex8_28.sce
new file mode 100755
index 000000000..f9d076267
--- /dev/null
+++ b/3293/CH8/EX8.28/Ex8_28.sce
@@ -0,0 +1,26 @@
+//page 307
+//Example 8.28
+clc;
+clear;
+close;
+disp('x1 and x2 are two real nos. i.e., x1^2 + x2^2 = 1');
+x1 = rand();
+x2 = sqrt(1 - x1^2);
+disp(x1,'x1 = ');
+disp(x2,'x2 = ');
+B = [x1 x2 0;0 1 0;0 0 1];
+disp(B,'B = ');
+disp('Applying Gram-Schmidt process to B:')
+a1 = [x1 x2 0];
+a2 = [0 1 0] - x2 * [x1 x2 0];
+a3 = [0 0 1];
+disp(a1,'a1 = ');
+disp(a2,'a2 = ');
+disp(a3,'a3 = ');
+U = [a1;a2/x1;a3];
+disp(U,'U = ');
+M = [1 0 0;-x2/x1 1/x1 0;0 0 1];
+disp(M,'M = ')
+disp(inv(M) * U,'inverse(M) * U = ');
+disp('So, B = inverse(M) * U');
+//end
diff --git a/3293/CH8/EX8.9/Ex8_9.sce b/3293/CH8/EX8.9/Ex8_9.sce
new file mode 100755
index 000000000..b3f53a518
--- /dev/null
+++ b/3293/CH8/EX8.9/Ex8_9.sce
@@ -0,0 +1,34 @@
+//page 278
+//Example 8.9
+clc;
+clear;
+close;
+a = round(rand(1,2) * 10);
+x = a(1);
+y = a(2);
+b = [-y x];
+disp(a,'(x,y) = ');
+disp(b,'(-y,x) = ');
+disp('Inner product of these vectors is:');
+t = -x*y + y*x;
+disp(t,'(x,y)|(-y,x) = ');
+disp('So, these are orthogonal.');
+disp('------------------------------------------');
+disp('If inner product is defined as:');
+disp('(x1,x2)|(y1,y2) = x1y1- x2y1 - x1y2 + 4x2y2');
+disp('Then, (x,y)|(-y,x) = -x*y+y^2-x^2+4*x*y = 0 if,');
+disp('y = 1/2(-3 + sqrt(13))*x');
+disp('or');
+disp('y = 1/2(-3 - sqrt(13))*x');
+disp('Hence,');
+if y == 1/2*(-3 + sqrt(13))*x | y == 1/2*(-3 - sqrt(13))*x then
+disp(a);
+disp('is orthogonal to');
+disp(b);
+else
+disp(a);
+disp('is not orthogonal to');
+disp(b);
+end
+//end
+