ex7-19_2

564 days ago by maxroot123

v1 = vector([0, 0, 1, 0]) v2 = vector([1, 0, 1, 1]) v3 = vector([1, 1, 2, 1]) A1 = matrix(QQ, 3, 4, [v1, v2, v3]) print('problem (1)') x1 = v1 print('x1 = v1') print(x1) x2 = v2 - ( (x1*v2)/(x1*x1)*x1 ) print('x2 = y2 - proj_(x1)y2') print(x2) M0 = matrix(QQ, 2, 4, [x1, x2]) M = M0.transpose() x3 = v3 - (M*(M.transpose()*M)^-1*M.transpose())*v3 print('x3 = v3 - (M*(M.transpose()*M)^-1*M.transpose())*v3') print(x3) print('정규직교화 결과') print(x1, x2/sqrt(x2*x2), x3) v1 = vector([1, 1, 1, 1]) v2 = vector([-1, 4, 4, -1]) v3 = vector([4, -2, 2, 0]) print('\nproblem (2)') x1 = v1 print('x1 = v1') print(x1) x2 = v2 - ( (x1*v2)/(x1*x1)*x1 ) print('x2 = y2 - proj_(x1)y2') print(x2) M0 = matrix(QQ, 2, 4, [x1, x2]) M = M0.transpose() x3 = v3 - (M*(M.transpose()*M)^-1*M.transpose())*v3 print('x3 = v3 - (M*(M.transpose()*M)^-1*M.transpose())*v3') print(x3) print('정규직교화 결과') print(x1/sqrt(x1*x1), x2/sqrt(x2*x2), x3/sqrt(x3*x3)) 
       
problem (1)
x1 = v1
(0, 0, 1, 0)
x2 = y2 - proj_(x1)y2
(1, 0, 0, 1)
x3 = v3 - (M*(M.transpose()*M)^-1*M.transpose())*v3
(0, 1, 0, 0)
정규직교화 결과
((0, 0, 1, 0), (1/2*sqrt(2), 0, 0, 1/2*sqrt(2)), (0, 1, 0, 0))

problem (2)
x1 = v1
(1, 1, 1, 1)
x2 = y2 - proj_(x1)y2
(-5/2, 5/2, 5/2, -5/2)
x3 = v3 - (M*(M.transpose()*M)^-1*M.transpose())*v3
(2, -2, 2, -2)
정규직교화 결과
((1/2, 1/2, 1/2, 1/2), (-1/2, 1/2, 1/2, -1/2), (1/2, -1/2, 1/2, -1/2))
problem (1)
x1 = v1
(0, 0, 1, 0)
x2 = y2 - proj_(x1)y2
(1, 0, 0, 1)
x3 = v3 - (M*(M.transpose()*M)^-1*M.transpose())*v3
(0, 1, 0, 0)
정규직교화 결과
((0, 0, 1, 0), (1/2*sqrt(2), 0, 0, 1/2*sqrt(2)), (0, 1, 0, 0))

problem (2)
x1 = v1
(1, 1, 1, 1)
x2 = y2 - proj_(x1)y2
(-5/2, 5/2, 5/2, -5/2)
x3 = v3 - (M*(M.transpose()*M)^-1*M.transpose())*v3
(2, -2, 2, -2)
정규직교화 결과
((1/2, 1/2, 1/2, 1/2), (-1/2, 1/2, 1/2, -1/2), (1/2, -1/2, 1/2, -1/2))