Linear Algebra with Sage
<Projection Matrix>
Made by SKKU Linear Algebra Lab (2011)
Find the standard matrix for the orthogonal projection of @@R^3@@ onto space @@\{ \textbf{a}_1@@, @@\textbf{a}_2 \}@@,
where @@\textbf{a}_1 = (1, -2, 5)@@, @@\textbf{a}_2 = (4, -2, 3)@@
(orthogonal projection에 대응하는 행렬을 찾자)
Define a matrix @@M@@. (주어진 벡터를 가지고 full rank 행렬 @@M@@을 생성한다.)
(Full rank 행렬이 아니면 일차종속인 열은 제거하여 full rank 행렬을 만든다.)
M = matrix([[1,4],[-2,-2],[5,3]]); M |
[ 1 4]
[-2 -2]
[ 5 3]
Find @@M^T@@. (@@M^T@@를 구한다.)
Mt = M.transpose(); Mt |
[ 1 -2 5]
[ 4 -2 3]
Find the standard matrix @@P=M(M^T M)^{-1} M^T@@ for the orthogonal projection.
(표준행렬 @@P=M(M^T M)^{-1} M^T@@를 구한다.)
P = M * (Mt * M)^(-1) * Mt; P |
[ 325/341 -68/341 -24/341]
[ -68/341 52/341 -102/341]
[ -24/341 -102/341 305/341]