在 R 中計算特徵向量
在這個練習中,你會找出一個矩陣的特徵向量,並驗證它們符合課程中討論的性質。
本練習屬於課程
R 的資料科學線性代數
練習說明
- 對於矩陣
A,其在 R 中的輸出如下:
[,1] [,2]
[1,] 1 2
[2,] 1 1
找出對應於兩個特徵值的特徵向量(注意每個特徵值都有無限多個對應向量,但 R 只會回傳各一個代表)。
- 列印兩個特徵向量。
- 針對每一組特徵值/特徵向量,說明 $A\vec{v} = \lambda \vec{v}$。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Find the eigenvectors of A and store them in Lambda
Lambda <- eigen(___)
# Print eigenvectors
print(Lambda$____[, 1])
print(Lambda$vectors[, ___])
# Verify that these eigenvectors & their associated eigenvalues satisfy Av - lambda v = 0
Lambda$values[1]*Lambda$vectors[, ___] - A%*%Lambda$vectors[, 1]
Lambda$values[2]*Lambda$vectors[, 2] - A%*%Lambda$vectors[, ___]