Matrix Norm, Kondition

Matrix aus dem Beispiel 2.2

[1]:
import numpy as np
[2]:
A=np.array([[3.3,1.2],[6.9,2.5]])
A
[2]:
array([[3.3, 1.2],
       [6.9, 2.5]])

Die Inverse von

\[\begin{split}A = \begin{pmatrix}a & b\\c & d\end{pmatrix}\end{split}\]

ist im Allgemeinen gegeben durch (mit Hilfe der Cramerschen Regel)

\[\begin{split}A^{-1} = \frac{1}{a\,d-b\,c}\begin{pmatrix}d & -b\\-c & a\end{pmatrix}\end{split}\]
[3]:
invA = 1/np.linalg.det(A)*np.array([[2.5,-1.2],[-6.9,3.3]])
invA
[3]:
array([[ -83.33333333,   40.        ],
       [ 230.        , -110.        ]])
[4]:
invA@A
[4]:
array([[ 1.00000000e+00, -7.10542736e-15],
       [ 3.33955086e-14,  1.00000000e+00]])

Matrix Norm \(\|\cdot\|_\infty\)

\[\|A\|_\infty = \max_{i=1,\ldots, n} \sum_{j=1}^n |A_{i,j}|\]
[5]:
max([sum(abs(A[0,:])),sum(abs(A[1,:]))])
[5]:
9.4

In python direkt:

[6]:
np.linalg.norm(A,np.inf)
[6]:
9.4

Für die relative Kondition folgt somit

[7]:
max([sum(abs(A[0,:])),sum(abs(A[1,:]))])*max([sum(abs(invA[0,:])),sum(abs(invA[1,:]))])
[7]:
3196.0000000000173

Matrix Norm \(\|\cdot\|_1\)

\[\|A\|_1 = \max_{j=1,\ldots, n} \sum_{i=1}^n |A_{i,j}|\]
[8]:
max([sum(abs(A[:,0])),sum(abs(A[:,1]))])
[8]:
10.2

In python direkt:

[9]:
np.linalg.norm(A,1)
[9]:
10.2

Für die relative Kondition folgt somit

[10]:
max([sum(abs(A[:,0])),sum(abs(A[:,1]))])*max([sum(abs(invA[:,0])),sum(abs(invA[:,1]))])
[10]:
3196.000000000017

Matrix Norm \(\|\cdot\|_2\)

\[\|A\|_2 = \sqrt{\lambda_\max(A^T\cdot A)}\]
[11]:
np.sqrt(np.max(np.linalg.eigvals(A.T@A)))
[11]:
8.135722856807321

In python direkt:

[12]:
[np.linalg.norm(A,2), np.linalg.norm(A)]
[12]:
[8.135722856807321, 8.13572369245662]

Für die relative Kondition folgt somit

[13]:
np.linalg.norm(A)*np.linalg.norm(invA)
[13]:
2206.3333333333453

Für die Norm von \(A^{-1}\) gilt

[14]:
1/np.sqrt(np.min(np.linalg.eigvals(A.T@A)))
[14]:
271.190761899856
[15]:
np.linalg.norm(invA)
[15]:
271.1907897485555