updating week 35

This commit is contained in:
Morten Hjorth-Jensen
2021-09-02 09:41:54 +02:00
parent ed2dca03a8
commit ddda79f449
6 changed files with 30 additions and 30 deletions
+6 -6
View File
@@ -1322,7 +1322,7 @@ As an example, the above defective matrix can be decomposed as
!bt
\[
\bm{X} = \frac{1}{\sqrt{2}}\begin{bmatrix} 1& 1 \\ 1& -1\\ \end{bmatrix} \begin{bmatrix} 4& 0 \\ 0& 0\\ \end{bmatrix} \frac{1}{\sqrt{2}}\begin{bmatrix} 1& -1 \\ 1& 1\\ \end{bmatrix}=\bm{U}\bm{\Sigma}\bm{V}^T,
\bm{X} = \frac{1}{\sqrt{2}}\begin{bmatrix} 1& 1 \\ 1& -1\\ \end{bmatrix} \begin{bmatrix} 2& 0 \\ 0& 0\\ \end{bmatrix} \frac{1}{\sqrt{2}}\begin{bmatrix} 1& -1 \\ 1& 1\\ \end{bmatrix}=\bm{U}\bm{\Sigma}\bm{V}^T,
\]
!et
@@ -1378,7 +1378,7 @@ def SVDinv(A):
SVD is numerically more stable than the inversion algorithms provided by
numpy and scipy.linalg at the cost of being slower.
'''
U, S, VT = np.linalg.svd(A)
U, S, VT = np.linalg.svd(A,full_matrices=True)
print('test U')
print( (np.transpose(U) @ U - U @np.transpose(U)))
print('test VT')
@@ -1394,12 +1394,12 @@ def SVDinv(A):
X = np.array([ [1.0,-1.0], [1.0,-1.0]])
#X = np.array([[1, 2], [3, 4], [5, 6]])
print(X)
A = np.transpose(X) @ X
print(A)
C = SVDinv(A)
C = SVDinv(X)
# Print the difference between the original matrix and the SVD one
print(C-A)
print(C-X)
!ec
The matrix $\bm{X}$ has columns that are linearly dependent. The first