diff --git a/doc/pub/week35/html/week35-reveal.html b/doc/pub/week35/html/week35-reveal.html index 72dba7a8b..d048589fb 100644 --- a/doc/pub/week35/html/week35-reveal.html +++ b/doc/pub/week35/html/week35-reveal.html @@ -1719,7 +1719,7 @@ As an example, the above defective matrix can be decomposed as

 
$$ -\boldsymbol{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}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T, +\boldsymbol{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}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T, $$

 
@@ -1788,7 +1788,7 @@ In general the economy-size SVD leads to less FLOPS and still conserving the des 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') @@ -1804,12 +1804,12 @@ In general the economy-size SVD leads to less FLOPS and still conserving the des 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)

The matrix \( \boldsymbol{X} \) has columns that are linearly dependent. The first diff --git a/doc/pub/week35/html/week35-solarized.html b/doc/pub/week35/html/week35-solarized.html index 7f77448c1..ea56572cd 100644 --- a/doc/pub/week35/html/week35-solarized.html +++ b/doc/pub/week35/html/week35-solarized.html @@ -1794,7 +1794,7 @@ $$ As an example, the above defective matrix can be decomposed as $$ -\boldsymbol{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}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T, +\boldsymbol{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}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T, $$

@@ -1862,7 +1862,7 @@ In general the economy-size SVD leads to less FLOPS and still conserving the des 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') @@ -1878,12 +1878,12 @@ In general the economy-size SVD leads to less FLOPS and still conserving the des 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)

The matrix \( \boldsymbol{X} \) has columns that are linearly dependent. The first diff --git a/doc/pub/week35/html/week35.html b/doc/pub/week35/html/week35.html index 5b00624c0..10114f03e 100644 --- a/doc/pub/week35/html/week35.html +++ b/doc/pub/week35/html/week35.html @@ -1799,7 +1799,7 @@ $$ As an example, the above defective matrix can be decomposed as $$ -\boldsymbol{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}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T, +\boldsymbol{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}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T, $$

@@ -1867,7 +1867,7 @@ In general the economy-size SVD leads to less FLOPS and still conserving the des 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') @@ -1883,12 +1883,12 @@ In general the economy-size SVD leads to less FLOPS and still conserving the des 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)

The matrix \( \boldsymbol{X} \) has columns that are linearly dependent. The first diff --git a/doc/pub/week35/ipynb/ipynb-week35-src.tar.gz b/doc/pub/week35/ipynb/ipynb-week35-src.tar.gz index 6fef7343b..8af419c5e 100644 Binary files a/doc/pub/week35/ipynb/ipynb-week35-src.tar.gz and b/doc/pub/week35/ipynb/ipynb-week35-src.tar.gz differ diff --git a/doc/pub/week35/ipynb/week35.ipynb b/doc/pub/week35/ipynb/week35.ipynb index 97f67e309..8de0757f5 100644 --- a/doc/pub/week35/ipynb/week35.ipynb +++ b/doc/pub/week35/ipynb/week35.ipynb @@ -2118,7 +2118,7 @@ "metadata": {}, "source": [ "$$\n", - "\\boldsymbol{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}=\\boldsymbol{U}\\boldsymbol{\\Sigma}\\boldsymbol{V}^T,\n", + "\\boldsymbol{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}=\\boldsymbol{U}\\boldsymbol{\\Sigma}\\boldsymbol{V}^T,\n", "$$" ] }, @@ -2185,7 +2185,7 @@ " SVD is numerically more stable than the inversion algorithms provided by\n", " numpy and scipy.linalg at the cost of being slower.\n", " '''\n", - " U, S, VT = np.linalg.svd(A)\n", + " U, S, VT = np.linalg.svd(A,full_matrices=True)\n", " print('test U')\n", " print( (np.transpose(U) @ U - U @np.transpose(U)))\n", " print('test VT')\n", @@ -2201,12 +2201,12 @@ "\n", "\n", "X = np.array([ [1.0,-1.0], [1.0,-1.0]])\n", + "#X = np.array([[1, 2], [3, 4], [5, 6]])\n", + "\n", "print(X)\n", - "A = np.transpose(X) @ X\n", - "print(A)\n", - "C = SVDinv(A)\n", + "C = SVDinv(X)\n", "# Print the difference between the original matrix and the SVD one\n", - "print(C-A)" + "print(C-X)" ] }, { diff --git a/doc/src/week35/week35.do.txt b/doc/src/week35/week35.do.txt index 4c3c5815c..bc398b0eb 100644 --- a/doc/src/week35/week35.do.txt +++ b/doc/src/week35/week35.do.txt @@ -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