Skip to content
Snippets Groups Projects
Commit c9345e63 authored by Gabriel Alexander Dogadov's avatar Gabriel Alexander Dogadov
Browse files

Update 01_GKZ/tutorial_1_numbers.ipynb, 01_GKZ/tutorial_1_numbers2.ipynb,...

Update 01_GKZ/tutorial_1_numbers.ipynb, 01_GKZ/tutorial_1_numbers2.ipynb, 02_LGS/tutorial_2_ausgleichsrechnung.ipynb, 02_LGS/tutorial_2_lgs.ipynb, 02_LGS/tutorial_2_beispiel_aufgaben.ipynb, 02_LGS/imgs/anz3.png, 02_LGS/imgs/anz2.png, 02_LGS/imgs/anz1.png, 02_LGS/imgs/int.png, 02_LGS/imgs/int1.png, 02_LGS/imgs/lr.png, 02_LGS/imgs/lr_solution.png, 02_LGS/imgs/ols.png, 02_LGS/imgs/tls.png, 02_LGS/imgs/sq_vs_abs3.png, 02_LGS/imgs/sq_vs_abs2.png, 02_LGS/imgs/sq_vs_abs.png, 02_LGS/imgs/int2.png, 02_LGS/imgs/tomograph2.png, 02_LGS/imgs/tomograph1.png
parent e0ab91a8
No related branches found
No related tags found
No related merge requests found
Showing
with 4920 additions and 0 deletions
%% Cell type:markdown id: tags:
## Archimedean Circumference
Das wohl älteste bekannte Verfahren zur Bestimmung des Kreisumfanges geht auf Archimedes zurück (ca. 250 v.Chr) und approximiert den Kreisumfang mittels einbeschriebener regelmäßiger Polygone. Durch Verdopplung der Kanten wird die Approximation sukzessiv verbessert. In dieser Aufgabe wollen wir untersuchen, ob sich das Verfahren geeignet auf auf einem Computer implementieren lässt.
![](imgs/pi_approx.png)
%% Cell type:markdown id: tags:
**1)** Wie lautet die Formel für den Umfang eines Kreises mit Radius $r$? Welchen Umfang hat der Einheitskreis?
___
**2)** Gegeben sei der Einheitskreis und ein einbeschriebenes Quadrat (siehe Abbildung (a)). Berechnen Sie die Seitenlänge und den Umfang des einbeschriebenen Quadrates.
___
**3)** Durch Verdopplung der Kanten erhält man aus dem Viereck ein Achteck dann ein Sechzehneck, usw (siehe Abbildung (b)). Leiten Sie eine Formel her, welche aus der Seitenlänge $s_n$ des $2^n$-Eck die Seitenlänge $s_{n+1}$ des $2^{n+1}$-Eck berechnet.
Hinweis: Überlegen Sie, wo sich in der Abbildung (c) rechte Winkel befinden und nutzen Sie den Satz des Pythagoras.
___
**4)** Schreiben Sie ein Python Programm, welches unter Verwendung der hergeleiteten Formel den Kreisumfang möglichst genau approximiert. Geben Sie die jeweilige Approximation und den Fehler auf der Konsole für aufsteigende $n$ aus. Erzeugen Sie außerdem unter Verwendung von *matplotlib* einen Graph des Fehlers in Abhängigkeit von $n$. Welche Genauigkeit lässt sich maximal erreichen?
___
**5)** Lässt sich Genauigkeit der Approximation noch verbessern?
%% Cell type:markdown id: tags:
#### Lösungen
**1)** $U = 2\pi r$. Der Umfang des Einheitskreises ist also: $2\pi$
___
**2)** Nach dem Satz von Pythagoras gilt: $s_2^2 = r^2 + r^2 = 1 + 1 = 2 \quad \Longrightarrow \quad s_2 = \sqrt{2}$
Für den Umfang des Quadrates erhalten wir: $U = 2^2 \sqrt{2} = 4\sqrt{2} \approx 5.656854$
___
**3)** Da wir den Einheitskreis betrachten gilt: $\overline{BA}=\overline{BC}=\overline{BD}=r=1$. Um $s_{n+1}$ aus $s_n$ zu erhalten, schauen wir uns Abbildung (c) an. Mit Hilfe des Satzes von Pythagoras folgt:
$\left( \frac{s_n}{2} \right)^{\!\!2} + \overline{BE}^{\,2} = \overline{BA}^{\,2} = 1$
Außerdem gilt: $\overline{ED} = \overline{BD} - \overline{BE} = 1 - \overline{BE}$
Erneute Anwendung des Satzes von Pythagoras ergibt dann:
$$s_{n+1}^2 = \overline{ED}^{\,2} + \bigg( \frac{s_n}{2} \bigg)^{\!\!2}
= \Big( 1 - \overline{BE} \Big)^{\,2} + \bigg( \frac{s_n}{2} \bigg)^{\!\!2}\\
= \left( 1 - \sqrt{1-\bigg( \frac{s_n}{2} \bigg)^{\!\!2}} \;\right)^{\!\!2} + \bigg( \frac{s_n}{2} \bigg)^{\!\!2}\\
= 1 - 2\sqrt{1-\bigg( \frac{s_n}{2} \bigg)^{\!\!2}} + 1 - \bigg(\frac{s_n}{2} \bigg)^{\!\!2} + \bigg( \frac{s_n}{2} \bigg)^{\!\!2}\\
= 2 - 2\sqrt{1-\bigg( \frac{s_n}{2} \bigg)^{\!\!2}}
= 2 - \sqrt{4 - s_n^2}$$
Für $s_{n+1}$ erhalten wir also: $s_{n+1} =\sqrt{2-\sqrt{4-s_n^2}}$
___
**4)** Das folgende Python Programm approximiert den Kreisumfang. Dabei kommt es zu Auslöschung.
%% Cell type:code id: tags:
``` python
from math import sqrt, fabs, pi
import matplotlib.pyplot as plt
N = 30
err = []
sn = sqrt(2)
for n in range(2, N):
pn = (2 ** n) * sn
en = fabs(pn - 2.0 * pi)
err.append(en)
#print("{0:2d}\t{1:1.20f}\t{2:1.20e}".format(n, pn, en))
sn = sqrt(2.0 - sqrt(4.0 - sn ** 2))
plt.figure(figsize=(6.0, 4.0))
plt.semilogy(range(2, N), err, "rx")
plt.xlim(2, N - 1)
plt.ylim(1e-16, 10)
plt.show()
```
%% Cell type:markdown id: tags:
Für $n \le 15$ verbessert sich die Approximation sukzessive. Für $n > 15$ vergrößert sich der Fehler wieder. Gemessen an der Maschinengenauigkeit von $2^{-53}$ ist dies aus numerischer Sicht ein unzureichendes Ergebnis. Problematisch in der Gleichung für $s_{n+1}$ ist die Subtraktion unter der ersten Wurzel. Für kleine $s_n$ wird hier die Differenz von zwei fast gleich großen Zahlen gebildet. Um zu verstehen warum dies zu Problemen führt untersuchen wir im folgenden den relativen Fehler bei der Subtraktion.
Es bezeichne $\mathrm{rd} \colon \mathbb{R} \to \mathbb{M}$ die Rundungsfunktion welche einer reellen Zahl eine Gleitkommazahl in der gewählten Darstellung zuordnet. Der relative Fehler, welcher bei der Rundung entsteht, lässt sich dann angeben als:
$\bar{\varepsilon}_x = \vert \varepsilon_x \vert = \left\vert \frac{\mathrm{rd}(x) - x}{x} \right\vert
\quad\text{bzw.}\quad
\mathrm{rd}(x) = x(1+\varepsilon_x)$
Für den relativen Fehler der Subtraktion zweier Gleitkommazahlen $x$ und $y$ ergibt sich dann:
$$\varepsilon_{x-y}
=\frac{\mathrm{rd}\big(\mathrm{rd}(x) - \mathrm{rd}(y)\big) - (x - y)}{x - y} \\
=\frac{\big(x(1+\varepsilon_x) - y(1+\varepsilon_y)\big)(1+\varepsilon_-) - (x - y)}{x - y}\\
\approx \frac{x}{x - y}\varepsilon_x - \frac{y}{x - y} \varepsilon_y + \varepsilon_-
$$
Ist also $x \approx y$, dann sind $|\tfrac{x}{x - y}|,|\tfrac{y}{x - y}| > 1$ und es tritt eine Verstärkung des relativen Fehlers auf, welche als Auslöschung bezeichnet wird.
___
**5)** Um die Auslöschung zu vermeiden erweitern wir die Gleichung für $s_{n+1}$ wie folgt:
$$ s_{n+1}
= \sqrt{2-\sqrt{4-s_n^2}}
\\
= \sqrt{2-\sqrt{4-s_n^2}} \cdot \frac{\sqrt{2+\sqrt{4-s_n^2}}}{\sqrt{2+\sqrt{4-s_n^2}}}
\\
= \frac{\sqrt{2^2 - \sqrt{4-s_n^2}^2}}{\sqrt{2+\sqrt{4-s_n^2}}}
\\
= \frac{|s_n|}{\sqrt{2+\sqrt{4-s_n^2}}}
$$
Das folgende Programm zeigt den Effekt der Erweiterung.
%% Cell type:code id: tags:
``` python
from math import sqrt, fabs, pi
import matplotlib.pyplot as plt
N = 40
err = []
sn = sqrt(2)
for n in range(2, N):
pn = 2 ** n * sn
en = fabs(pn - 2.0 * pi)
err.append(en)
#print("{0:2d}\t{1:1.20f}\t{2:1.20e}".format(n, pn, en))
sn = sn / sqrt(2 + sqrt(4 - sn ** 2))
plt.figure(figsize=(6.0, 4.0))
plt.semilogy(range(2, N), err, "bx")
plt.xlim(2, N - 1)
plt.ylim(1e-16, 10)
plt.show()
```
%% Cell type:markdown id: tags:
## Machine precision
%% Cell type:code id: tags:
``` python
import numpy as np
# Machine precision epsilon
print(np.finfo(np.float32).eps)
print(np.finfo(np.float64).eps)
```
%% Cell type:code id: tags:
``` python
# Smallest and largest fp number
print(np.finfo(np.float32).min, np.finfo(np.float32).max)
print(np.finfo(np.float64).min, np.finfo(np.float64).max)
```
%% Cell type:code id: tags:
``` python
# Absolute smallest fp number
print(np.finfo(np.float32).tiny)
print(np.finfo(np.float64).tiny)
```
%% Cell type:markdown id: tags:
## Catastrophic Cancellation
%% Cell type:code id: tags:
``` python
import decimal
from decimal import Decimal
decimal.getcontext().prec = 3
A = 1.22
B = 3.34
C = 2.28
X = B * B - 4.0 * A * C
a = Decimal(A)
b = Decimal(B)
c = Decimal(C)
x = b * b - 4 * a *c
print(type(X), X)
print(type(x), x)
```
%% Cell type:markdown id: tags:
## Darstellung von Zahlen
%% Cell type:markdown id: tags:
### Summe von Potenzen einer Basis
$x = c_0 \cdot b^0 + c_1 \cdot b^1 + \dots + c_n \cdot b^n$
-----
Beispiele: $128$ und $11,57$
%% Cell type:markdown id: tags:
$128_{10} = 1 \cdot 10^2 + 2 \cdot 10^1 + 8 \cdot 10^0$
>$= 1 \cdot 2^7 + 0 \cdot 2^6 + \ldots + 0 \cdot 2^0$
%% Cell type:markdown id: tags:
$11,57_{10} = 1 \cdot 10^1 + 1 \cdot 10^0 + 5 \cdot 10^{-1} + 7 \cdot 10^{-2}$
>$= 1 \cdot 2^3 + 0 \cdot 2^2 + 1 \cdot 2^1 + 1 \cdot 2^0 + 1 \cdot 2^{-1} +...$
>$=8 + 0 + 2 + 1 + 0.5 + \ldots$
%% Cell type:markdown id: tags:
### Zahlen in Python
Python numeric built-in types:
* int
* float
* complex
https://docs.python.org/3.4/library/stdtypes.html#numeric-types-int-float-complex
NumPy:
* int \<x>
* uint \<x>
* float \<x>
* complex \<x>
https://numpy.org/devdocs/user/basics.types.html
%% Cell type:code id: tags:
``` python
import numpy as np
numbers = [14, 2.3792, 3+7j,
np.int32(-11), np.uint32(5), np.float64(8.23)]
for num in numbers:
print("{:10}:\t{}".format(num, type(num)))
```
%% Output
14: <class 'int'>
2.3792: <class 'float'>
(3+7j): <class 'complex'>
-11: <class 'numpy.int32'>
5: <class 'numpy.uint32'>
8.23: <class 'numpy.float64'>
%% Cell type:markdown id: tags:
### Beispiele
* $\sqrt{2} \cdot \sqrt{2} \stackrel{?}{=} 2$
* $\sin(\pi) \stackrel{?}{=} 0$
%% Cell type:code id: tags:
``` python
x = np.sqrt(2)
print(x*x == 2)
```
%% Output
False
%% Cell type:code id: tags:
``` python
print("x = {}".format(x))
print("x*x = {}".format(x*x))
```
%% Output
x = 1.4142135623730951
x*x = 2.0000000000000004
%% Cell type:code id: tags:
``` python
y = np.sin(np.pi)
print(y == 0)
```
%% Output
False
%% Cell type:code id: tags:
``` python
print("y = {}".format(y))
print(np.isclose(y,0))
```
%% Output
y = 1.2246467991473532e-16
True
%% Cell type:markdown id: tags:
## Gleitkommazahlen
%% Cell type:markdown id: tags:
### Motivation
Festkommazahl: $x = \pm m_1 m_2 \dots m_n \cdot 10^e$ für feste $n$ und $e$
z.B. mit $n = 3$ und $e = -2$
* $0,01 = 1 \cdot 10^{-2}$
* $3,47 = 347 \cdot 10^{-2}$
* $9,99 = 999 \cdot 10^{-2}$
Darstellbare Zahlen haben gleichen Abstand aber Zahlenbereich eingeschränkt auf [0,00 - 9,99].
%% Cell type:markdown id: tags:
Gleitkommazahl: $x = \pm m_1, m_2 \dots m_n \cdot 10^e$ für feste $n$ und "beliebige" $e$
* $0,001 = 1 \cdot 10^{-3}$
* $0,105 = 105 \cdot 10^{-3}$
* $3,47 = 347 \cdot 10^{-2}$
* $105.000 = 105 \cdot 10^{3}$
Praktisch uneingeschränkter Zahlenbereich... Abstand zwischen darstellbaren Zahlen aber __nicht__ gleich.
z.B. $106.000 - 105.000 = 1.000 \neq 0,001 = 0,106 - 0,105$
Kompromiss zwischen Umfang und Genauigkeit.
%% Cell type:markdown id: tags:
<img src="imgs/GKZ_Strahl.png">
%% Cell type:markdown id: tags:
### Definition
$\hat{x} = \pm m_1, m_2 \dots m_n \times b^{e_1\dots e_k} \in \mathbb{G}(b, n)$
%% Cell type:markdown id: tags:
IEEE 754 bestimmt $b$, $n$ und $k$:
* 32bit float: 1bit Vorzeichen, 8bit Exponent (k), 23bit Mantisse (n).
* 64bit float: 1bit Vorzeichen, 11bit Exponent (k), 52bit Mantisse (n).
* Basis ist typischerweise 2.
%% Cell type:code id: tags:
``` python
# Smallest and largest fp number
print(np.finfo(np.float32).min, np.finfo(np.float32).max)
print(np.finfo(np.float64).min, np.finfo(np.float64).max)
```
%% Output
-3.4028235e+38 3.4028235e+38
-1.7976931348623157e+308 1.7976931348623157e+308
%% Cell type:code id: tags:
``` python
# Absolute smallest fp number
print(np.finfo(np.float32).tiny)
print(np.finfo(np.float64).tiny)
```
%% Output
1.1754944e-38
2.2250738585072014e-308
%% Cell type:code id: tags:
``` python
x = 2**23
y = np.float32(x+3)
print(x+3)
print(y)
```
%% Output
8388611
8388611.0
%% Cell type:markdown id: tags:
$G: \mathbb{R} \rightarrow \mathbb{G}: rd(x) = \hat{x}$
$E_{rd}(x) = \left|x - \hat{x}\right| = \left|x-rd(x)\right|$}
Im Allgemeinen wird zum nächsten Wert gerundet. Der Fehler ist also maximal, wenn $x$ in der Mitte zweier benachbarten Gleitkommazahlen liegt.
%% Cell type:markdown id: tags:
<img src="imgs/G_fkt.jpg">
%% Cell type:markdown id: tags:
### Abstand zwischen zwei Gleitkommazahlen
$m_1, m_2 \dots m_n + 1 \times b^e - m_1, m_2 \dots m_n \times b^e = 0, 0 \dots 1 \times b^e$
> $\Delta\mathbb{G} = 1,0 \dots 0 \times b^{e - (n-1)}$
Der Abstand ist nicht konstant, sondern abhängig von der Größe der Zahlen. Dies ist beabsichtigt, damit der relative Fehler konstant bleibt.
%% Cell type:markdown id: tags:
<img src="imgs/Exakt_darstellbare_Gleitkommazahlen.png">
%% Cell type:markdown id: tags:
### Absoluter vs. relativer Fehler
Absoluter Fehler: $E_a = |x_a - x|$
z.B.
* $1 + 1 = 3,\quad E_a = \left| 3 - 2 \right| = 1$
* $10000 + 10000 = 200001,\quad E_a = \left|20001 - 20000\right| = 1$
%% Cell type:markdown id: tags:
Relativer Fehler: $E_r = \frac{E_a}{|x|} = \frac{|x_a - x|}{|x|}$
$E_r = \frac{| 3 - 2 |}{2} = 0,5, \quad E_r = \frac{|20001 - 20000|}{20000} = 0,000005$
%% Cell type:markdown id: tags:
Relativer Fehler zwischen zwei benachbarten Gleitkommazahlen.
z. B.
$E_r = \frac{|106.000-105.500|}{105.500} = \frac{500}{105.000} =~ 0,0048$
$E_r = \frac{|0,106 - 0,1055|}{0,1055} = \frac{0,0005}{0,1055} =~ 0,0047$
%% Cell type:markdown id: tags:
## Maschinengenauigkeit
* maximaler relativer Approximationsfehler bei Verwendung der Gleitkommazahlen $\mathbb{G}(b,n_m)$
$$\epsilon = \underset{x \in \mathbb{Q}^+}{\text{max}} \frac{x-G(x)}{x} \leq \frac{b^{e-n_m+1}}{b^e} = b^{-n_m+1}$$
* alternative Definition
$$\epsilon = \underset{x \in \mathbb{Q}}{\text{arg min}} \ G(1+x) > 1$$
* Maschinengenauigkeit: $\epsilon = b^{-n_m+1}$
- Basis
- Mantissenlänge
%% Cell type:markdown id: tags:
## Genauigkeit bei Elementaroperationen
* Gleitkommazahlen $\mathbb{G}$ gegenüber $ \ +, \ $ $ -, \ $ $\cdot, \ $ $ / \ $ **nicht abgeschlossen**
![](figures/zahlenstrahl2.png)
$$ x \ast y \neq G(x \ast y) \neq G(x) \ast G(y) \neq G(G(x) \ast G(y))$$
* $G(G(x) \ast G(y))$ entspricht dem, was Computer berechnet
* Relativer Fehler für $ \ +, \ $ $\cdot, \ $ $/, \ $ in Größenordnung von Maschinengenauigkeit $\epsilon$
* Relativer Fehler für $ \ - \ $ unbegrenzt
%% Cell type:markdown id: tags:
## Auslöschung...
* ... führender Stellen, Darstellung des Ergebnisses nur mit kleinem Teil der Mantisse
* Bei Subtraktion kann **relativer Fehler beliebig groß** werden
* Tritt auf bei Bildung der **Differenz zweier ähnlich großer Zahlen**
**Achtung:** auch Addition einer positiven und einer negativen Zahl
%% Cell type:code id: tags:
``` python
```
02_LGS/imgs/anz1.png

29.3 KiB

02_LGS/imgs/anz2.png

28.9 KiB

02_LGS/imgs/anz3.png

26.5 KiB

02_LGS/imgs/int.png

33.2 KiB

02_LGS/imgs/int1.png

55.6 KiB

02_LGS/imgs/int2.png

84.8 KiB

02_LGS/imgs/lr.png

30.7 KiB

02_LGS/imgs/lr_solution.png

31.1 KiB

02_LGS/imgs/ols.png

36.4 KiB

02_LGS/imgs/sq_vs_abs.png

36.7 KiB

02_LGS/imgs/sq_vs_abs2.png

32.8 KiB

02_LGS/imgs/sq_vs_abs3.png

33.6 KiB

02_LGS/imgs/tls.png

39 KiB

02_LGS/imgs/tomograph1.png

84.7 KiB

02_LGS/imgs/tomograph2.png

79.8 KiB

This diff is collapsed.
%% Cell type:markdown id: tags:
<h2>Aufgabe 1: Lineare Regression</h2>
Gegeben sind drei Messpunkte $(x_i, y_i)$ mit den konkreten Messwerten:
<ul>
<li>(1,1)</li>
<li>(2,2)</li>
<li>(3,2)</li>
</ul>
Gesucht sind zwei Funktionen $f$ und $g$, welche die drei Messpunkte approximieren. Dabei soll $f$ eine Gerade und $g$ ein quadratische Funktion sein.
%% Cell type:markdown id: tags:
Das heißt:
$$
f(x) = ax + b\\
g(x) = ax^2 + bx + c
$$
%% Cell type:markdown id: tags:
<h3>Aufgaben: </h3>
<ol>
<li>Stell für beide Funktionen das zu lösende LGS auf!</li>
<li>Löse die LGS und gib die Funktionen $f$ und $g$ konkret an!</li>
</ol>
%% Cell type:markdown id: tags:
Für eine Gerade sieht eine mögliche allgemeine Systemmatrix wie folgt aus:
$$
\begin{bmatrix}
1 & x_1\\
1 & x_2\\
\vdots & \vdots\\
1 & x_n
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
Für eine quadratische Funktion sieht eine mögliche allgemeine Systemmatrix wie folgt aus:
$$
\begin{bmatrix}
1 & x_1 & x_1^2\\
1 & x_2 & x_2^2\\
\vdots & \vdots & \vdots\\
1 & x_n & x_n^2
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
Für die Gerade sieht ein mögliches LGS so aus:
$$
\begin{bmatrix}
1 & 1\\
1 & 2\\
1 & 3\\
\end{bmatrix}
\begin{bmatrix} b \\ a \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \\ 2\end{bmatrix}
$$
%% Cell type:markdown id: tags:
Lösen mit der Normalengleichung:
$$
\begin{bmatrix}
1 & 1 & 1\\
1 & 2 & 3\\
\end{bmatrix}
\begin{bmatrix}
1 & 1\\
1 & 2\\
1 & 3\\
\end{bmatrix}
\begin{bmatrix} b \\ a \end{bmatrix} =
\begin{bmatrix}
1 & 1 & 1\\
1 & 2 & 3\\
\end{bmatrix}
\begin{bmatrix} 1 \\ 2 \\ 2\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
\begin{bmatrix}
3 & 6\\
6 & 14\\
\end{bmatrix}
\begin{bmatrix} b \\ a \end{bmatrix} =
\begin{bmatrix} 5 \\ 11\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
\begin{bmatrix} b \\ a \end{bmatrix} = \begin{bmatrix} \frac{2}{3} \\ \frac{1}{2} \end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
f(x) = \frac{1}{2}x + \frac{2}{3}
$$
%% Cell type:markdown id: tags:
<img src="imgs/aufg1.png" style="margin:auto;" width="40%" />
%% Cell type:markdown id: tags:
Für die quadratische Funktion sieht ein möglich LGS so aus:
$$
\begin{bmatrix}
1 & 1 & 1\\
1 & 2 & 4\\
1 & 3 & 9\\
\end{bmatrix}
\begin{bmatrix} c \\ b \\ a \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \\ 2\end{bmatrix}
$$
%% Cell type:markdown id: tags:
Dieses LGS hat eine Lösung!
$$
\begin{bmatrix} c \\ b \\ a \end{bmatrix} = \begin{bmatrix} -1 \\ 2.5 \\ -0.5 \end{bmatrix}
$$
%% Cell type:markdown id: tags:
Und mit der Normalengleichung?
$$
\begin{bmatrix}
1 & 1 & 1\\
1 & 2 & 3\\
1 & 4 & 9\\
\end{bmatrix}
\begin{bmatrix}
1 & 1 & 1\\
1 & 2 & 4\\
1 & 3 & 9\\
\end{bmatrix}
\begin{bmatrix} c \\ b \\ a \end{bmatrix} = \begin{bmatrix}
1 & 1 & 1\\
1 & 2 & 3\\
1 & 4 & 9\\
\end{bmatrix}
\begin{bmatrix} 1 \\ 2 \\ 2\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
\begin{bmatrix}
3 & 6 & 14\\
6 & 14 & 36\\
14 & 36 & 98\\
\end{bmatrix}
\begin{bmatrix} c \\ b \\ a \end{bmatrix} =
\begin{bmatrix} 5 \\ 11 \\ 27 \end{bmatrix}
$$
%% Cell type:markdown id: tags:
Gleiche Lösung!
$$
\begin{bmatrix} c \\ b \\ a \end{bmatrix} = \begin{bmatrix} -1 \\ 2.5 \\ -0.5 \end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
g(x) = -0.5x^2 + 2.5x - 1
$$
%% Cell type:markdown id: tags:
<div class="text-center">
<b>Das ist eine Interpolation!</b>
<img src="imgs/aufg2.png" style="margin:auto;" width="40%" />
</div>
%% Cell type:markdown id: tags:
<h2>Aufgabe 2: Cholesky-Zerlegung</h2>
%% Cell type:markdown id: tags:
Berechne die Cholesky-Zerlegung folgender Matrizen:
$$ A =
\begin{bmatrix}
4 & 0 & 0 & 0\\
0 & 9 & 0 & 0\\
0 & 0 & 36 & 0\\
0 & 0 & 0 & 16\\
\end{bmatrix} \quad
B = \begin{bmatrix}
4 & 2 & 2 & 8 \\
2 & 10 & 10 & 7 \\
2 & 10 & 11 & 9 \\
8 & 7 & 9 & 22
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
Für A:
$$
L =
\begin{bmatrix}
2 & 0 & 0 & 0\\
0 & 3 & 0 & 0\\
0 & 0 & 6 & 0\\
0 & 0 & 0 & 4\\
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
Für Diagonalmatrizen einfach die Wurzeln der Diagonalterme bilden
%% Cell type:markdown id: tags:
Für B:
%% Cell type:markdown id: tags:
$$
l_{1,1} = \sqrt{\color{red}4} = \color{blue}2
$$
$$
B = \begin{bmatrix}
\color{red}4 & 2 & 2 & 8 \\
2 & 10 & 10 & 7 \\
2 & 10 & 11 & 9 \\
8 & 7 & 9 & 22
\end{bmatrix}
\quad
L = \begin{bmatrix}
\color{blue}2 & 0 & 0 & 0\\
? & ? & 0 & 0\\
? & ? & ? & 0\\
? & ? & ? & ?\\
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
l_{2,1} = \frac{1}{\color{green}2} \color{red}2 = \color{blue}1
$$
$$
B = \begin{bmatrix}
4 & 2 & 2 & 8 \\
\color{red}2 & 10 & 10 & 7 \\
2 & 10 & 11 & 9 \\
8 & 7 & 9 & 22
\end{bmatrix}
\quad
L = \begin{bmatrix}
\color{green}2 & 0 & 0 & 0\\
\color{blue}1 & ? & 0 & 0\\
? & ? & ? & 0\\
? & ? & ? & ?\\
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
l_{2,2} = \sqrt{\color{red}{10} - \color{green}1^2} = \color{blue}3
$$
$$
B = \begin{bmatrix}
4 & 2 & 2 & 8 \\
2 & \color{red}{10} & 10 & 7 \\
2 & 10 & 11 & 9 \\
8 & 7 & 9 & 22
\end{bmatrix}
\quad
L = \begin{bmatrix}
2 & 0 & 0 & 0\\
\color{green}1 & \color{blue}3 & 0 & 0\\
? & ? & ? & 0\\
? & ? & ? & ?\\
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
l_{3,1} = \frac{1}{\color{green}2} \color{red}2 = \color{blue} 1
$$
$$
B = \begin{bmatrix}
4 & 2 & 2 & 8 \\
2 & 10 & 10 & 7 \\
\color{red}2 & 10 & 11 & 9 \\
8 & 7 & 9 & 22
\end{bmatrix}
\quad
L = \begin{bmatrix}
\color{green}2 & 0 & 0 & 0\\
1 & 3 & 0 & 0\\
\color{blue}1 & ? & ? & 0\\
? & ? & ? & ?\\
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
l_{3,2} = \frac{1}{\color{green}3} (\color{red}{10} - \color{orange}1 \cdot \color{orange}1) = \color{blue} 3
$$
$$
B = \begin{bmatrix}
4 & 2 & 2 & 8 \\
2 & 10 & 10 & 7 \\
2 & \color{red}{10} & 11 & 9 \\
8 & 7 & 9 & 22
\end{bmatrix}
\quad
L = \begin{bmatrix}
2 & 0 & 0 & 0\\
\color{orange}1 & \color{green}3 & 0 & 0\\
\color{orange}1 & \color{blue}3 & ? & 0\\
? & ? & ? & ?\\
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
l_{3,3} = \sqrt{\color{red} {11} - \color{green} 3^2 - \color{green} 1^2} = \color{blue}1
$$
$$
B = \begin{bmatrix}
4 & 2 & 2 & 8 \\
2 & 10 & 10 & 7 \\
2 & 10 & \color{red}{11} & 9 \\
8 & 7 & 9 & 22
\end{bmatrix}
\quad
L = \begin{bmatrix}
2 & 0 & 0 & 0\\
1 & 3 & 0 & 0\\
\color{green}1 & \color{green}3 & \color{blue}1 & 0\\
? & ? & ? & ?\\
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
l_{4,1} = \frac{1}{\color{green}2} \color{red} 8 = \color{blue}4
$$
$$
B = \begin{bmatrix}
4 & 2 & 2 & 8 \\
2 & 10 & 10 & 7 \\
2 & 10 & 11 & 9 \\
\color{red}8 & 7 & 9 & 22
\end{bmatrix}
\quad
L = \begin{bmatrix}
\color{green}2 & 0 & 0 & 0\\
1 & 3 & 0 & 0\\
1 & 3 & 1 & 0\\
\color{blue}4 & ? & ? & ?\\
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
l_{4,2} = \frac{1}{\color{green}3} \color{red} (\color{red}7 - \color{orange}4 \cdot \color{orange}1) = \color{blue}1
$$
$$
B = \begin{bmatrix}
4 & 2 & 2 & 8 \\
2 & 10 & 10 & 7 \\
2 & 10 & 11 & 9 \\
8 & \color{red}7 & 9 & 22
\end{bmatrix}
\quad
L = \begin{bmatrix}
2 & 0 & 0 & 0\\
\color{orange}1 & \color{green}3 & 0 & 0\\
1 & 3 & 1 & 0\\
\color{orange}4 & \color{blue}1 & ? & ?\\
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
l_{4,3} = \frac{1}{\color{green}1} \color{red} (\color{red}9 - \color{orange}4 \cdot \color{orange}1 - \color{purple} 1 \cdot \color{purple} 3) = \color{blue}2
$$
$$
B = \begin{bmatrix}
4 & 2 & 2 & 8 \\
2 & 10 & 10 & 7 \\
2 & 10 & 11 & 9 \\
8 & 7 & \color{red}9 & 22
\end{bmatrix}
\quad
L = \begin{bmatrix}
2 & 0 & 0 & 0\\
1 & 3 & 0 & 0\\
\color{orange}1 & \color{purple}3 & \color{green}1 & 0\\
\color{orange}4 & \color{purple}1 & \color{blue}2 & ?\\
\end{bmatrix}
$$
%% Cell type:markdown id: tags:
$$
l_{4,4} = \sqrt{\color{red}{22} - \color{green}4^2 - \color{green}1^2 - \color{green}2^2} = \color{blue}1
$$
$$
B = \begin{bmatrix}
4 & 2 & 2 & 8 \\
2 & 10 & 10 & 7 \\
2 & 10 & 11 & 9 \\
8 & 7 & 9 & \color{red}{22}
\end{bmatrix}
\quad
L = \begin{bmatrix}
2 & 0 & 0 & 0\\
1 & 3 & 0 & 0\\
1 & 3 & 1 & 0\\
\color{green}4 & \color{green}1 & \color{green}2 & \color{blue}1\\
\end{bmatrix}
$$
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment