summaryrefslogtreecommitdiff
path: root/3293/CH8/EX8.28/Ex8_28.sce
blob: f9d076267600f862815c447c4e23c3adac62d788 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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