2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-24 13:58:05 +02:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Stephan Gocht 2013-09-19 16:26:55 +02:00
commit 86a3a4f4c1
22 changed files with 788 additions and 55 deletions

View file

@ -97,7 +97,7 @@ Nun gilt: $P A = L R = A^{(1)}$ (Kontrolle mit \href{http://www.wolframalpha.com
\textbf{Vorüberlegung:}
Eine Matrix $A \in \mathbb{R}^{n \times n}$ heißt positiv Definit $\dots$
\begin{align*}
\dots & \Leftrightarrow \forall x \in \mathbb{R}^n: x^T A x > 0\\
\dots & \Leftrightarrow \forall x \in \mathbb{R}^n \setminus \Set{0}: x^T A x > 0\\
& \Leftrightarrow \text{Alle Eigenwerte sind größer als 0}
\end{align*}
@ -124,7 +124,7 @@ Falls $A$ symmetrisch ist, gilt:
l_{11} &= \sqrt{a_{11}} = 3\\
l_{21} &= \frac{a_{21}}{l_{11}} = \frac{4}{3}\\
l_{31} &= \frac{a_{31}}{l_{11}} = \frac{12}{3} = 4\\
l_{22} &= \sqrt{a_{21} - {l_{21}}^2} = \sqrt{\frac{4}{3} - \frac{16}{9}}= \sqrt{-\frac{4}{9}} \notin \mathbb{R}\\
l_{22} &= \sqrt{a_{22} - {l_{21}}^2} = \sqrt{1 - \frac{16}{9}}= \sqrt{-\frac{7}{9}} \notin \mathbb{R}\\
& \Rightarrow \text{Es ex. keine Cholesky-Zerlegung, aber $A$ ist symmetrisch}\\
& \Rightarrow \text{$A$ ist nicht pos. Definit}
& \Rightarrow \text{$A$ ist nicht positiv definit}
\end{align}

View file

@ -1,12 +1,115 @@
\section*{Aufgabe 3}
Die Jacobi-Matrix von $f$ lautet:
\[f' (x,y) = \begin{pmatrix}
3 & \cos y\\
3 x^2 & e^y
\end{pmatrix}\]
Hierfür wurde in in der ersten Spalte nach $x$ abgeleitet und in der
zweiten Spalte nach $y$.
Und jetzt die Berechnung
\subsection*{Lösungsvorschlag 1}
Eine Iteration des Newton-Verfahren ist durch
\begin{align}
x_{k+1}&=x_{k}-f'(x_k)^{-1}\cdot f(x_k)
\end{align}
gegeben (vgl. Skript, S. 35).
\[f'(x, y) \cdot (x_0, y_0) = f(x,y)\]
Zur praktischen Durchführung lösen wir
\[f'(x_0, y_0)\Delta x = -f(x_0,y_0)\]
mit Hilfe der LR Zerlegung nach $\Delta x$ auf:
\begin{align}
%
f'(x_0,y_0) &= L \cdot R \\
\Leftrightarrow f'(-\nicefrac{1}{3}, 0) &= L \cdot R \\
\Leftrightarrow \begin{pmatrix}
3 & 1\\
\frac{1}{3} & 1
\end{pmatrix}
&=
\overbrace{\begin{pmatrix}
1 & 0\\
\frac{1}{9} & 1
\end{pmatrix}}^{=: L} \cdot
\overbrace{\begin{pmatrix}
3 & 1\\
0 & \frac{8}{9}
\end{pmatrix}}^{=: R}\\
%
L \cdot c &= -f(x_0,y_0) \\
\Leftrightarrow
\begin{pmatrix}
1 & 0\\
\frac{1}{9} & 1
\end{pmatrix}
\cdot c
&=
\begin{pmatrix}
-2\\
\frac{26}{27}
\end{pmatrix}\\
\Rightarrow
c &= \begin{pmatrix}
-2\\
\frac{32}{27}
\end{pmatrix}\footnotemark\\
%
R\cdot \Delta x &= c\\
\Leftrightarrow
\begin{pmatrix}
3 & 1\\
0 & \frac{8}{9}
\end{pmatrix}
\cdot \Delta x &=
\begin{pmatrix}
-2\\
\frac{32}{27}
\end{pmatrix}\\
\Rightarrow \Delta x &=
\begin{pmatrix}
-\frac{10}{9}\\
\frac{4}{3}
\end{pmatrix}
\end{align}
\footnotetext{Dieser Schritt wird durch Vorwärtssubsitution berechnet.}
Anschließend berechnen wir
\begin{align}
\begin{pmatrix}
x_1\\
y_1
\end{pmatrix} &=
\begin{pmatrix}
x_0\\
y_0
\end{pmatrix}+\Delta x \\
\Leftrightarrow\begin{pmatrix}
x_1\\
y_1
\end{pmatrix} &=
\begin{pmatrix}
\frac{1}{3}\\
0
\end{pmatrix} +
\begin{pmatrix}
-\frac{10}{9}\\
\frac{4}{3}
\end{pmatrix} \\
\Leftrightarrow\begin{pmatrix}
x_1\\
y_1
\end{pmatrix} &=
\begin{pmatrix}
-\frac{7}{9}\\
\frac{4}{3}
\end{pmatrix}
\end{align}
\subsection*{Lösungsvorschlag 2}
Und jetzt die Berechnung %TODO: Was ist hiermit gemeint?
\[f'(x, y) \cdot (x_0, y_0) = f(x,y)\] %TODO: Was ist hiermit gemeint?
LR-Zerlegung für $f'(x, y)$ kann durch scharfes hinsehen durchgeführt
werden, da es in $L$ nur eine unbekannte (links unten) gibt. Es gilt
@ -59,7 +162,11 @@ also ausführlich:
0 & -x^2 \cdot \cos y + e^y
\end{pmatrix}\\
P &= I_2\\
-f ( \frac{-1}{3}, 0) &= \begin{pmatrix} 2\\ -\frac{26}{27}\end{pmatrix}\\
c &= \begin{pmatrix} 2\\ \frac{82}{27} \end{pmatrix}\\
\end{align}
Es folgt:
\begin{align}
-f ( \nicefrac{-1}{3}, 0) &= \begin{pmatrix} -2\\ -\frac{26}{27}\end{pmatrix}\\
c &= \begin{pmatrix} 2\\ \frac{82}{27} \end{pmatrix}\\ %TODO: Was ist c?
(x_1, y_1) &= \begin{pmatrix} \frac{5}{3}\\ \frac{82}{27}\end{pmatrix}
\end{align}

View file

@ -15,6 +15,7 @@
\usepackage{pifont}% http://ctan.org/pkg/pifont
\usepackage{gauss}
\usepackage{algorithm,algpseudocode}
\usepackage{units}
\usepackage{parskip}
\usepackage{lastpage}
\allowdisplaybreaks

View file

@ -1,43 +1,30 @@
\section*{Aufgabe 2}
\subsection*{Teilaufgabe a)}
Formel: $y_i = \frac{b_i - \sum_{j=1}^{i-1} y_j \cdot l_{ij}}{l_{ii}} $
Anmerkung: $l_{ii}$ kann nicht $0$ sein, da L dann nicht mehr invertierbar wäre.
\textbf{Behauptung:} Für $x \in \mathbb{R}$ gilt, dass $cos(x_k) = x_{k+1}$ gegen den einzigen Fixpunkt $x^{*} = cos(x^{*})$ konvergiert.
Algorithmus:
\textbf{Beweis:}
Sei $ D := [-1, 1]$.\\
Trivial: $D$ ist abgeschlossen.
\begin{algorithm}[H]
\begin{algorithmic}
\For{$i=1$ to $i=n$}
\State $sum \gets 0$
\For{$j = 1$ to $j = i-1$}
\State $sum \gets sum + y_i \cdot l_{ij}$
\EndFor
\State $y_i \gets \frac{b_i - sum}{l_{ii}}$
\EndFor
\end{algorithmic}
\caption{TODO}
\end{algorithm}
Sei $ x \in D$, so gilt:
\begin{align*}
0 < cos(x) \leq 1
\end{align*}
Also: $cos(x) \in D$.\\ Wenn $x \not\in D$, so gilt $y := cos(x)$ und $cos(y) \in D$. D.h. bereits nach einem Iterationschritt wäre $cos(x) \in D$ für $x \in \mathbb{R}$! Dies ist wichtig, da damit gezeigt ist, dass $cos(x_k) = x_{k+1}$ für jedes $x \in \mathbb{R}$ konvergiert! Es kommt nur dieser einzige Iteratationsschritt für $x \not\in \mathbb{R}$ hinzu.
\subsubsection*{(b)}
\begin{algorithm}[H]
\begin{algorithmic}
\Require Matrix $A$, Vektor $b$
\Procedure{LoeseLGS}{$A$, $b$}
\State $P, L, R \gets \Call{LRZer}{A}$
\State $b^* \gets P \cdot b$
\State $c \gets \Call{VorSub}{L, b^*}$
\State $x \gets \Call{RueckSub}{R, c}$
\State \Return $x$
\EndProcedure
\end{algorithmic}
\caption{Löse ein LGS $Ax = b$}
\end{algorithm}
Nun gilt mit $ x, y \in D, x < y, \xi \in (x,y) $ und dem Mittelwert der Differentialrechnung:
\begin{align*}
\frac{cos(x) - cos(y)}{x - y} = cos'(\xi) \\
\Leftrightarrow cos(x) - cos(y) = cos'(\xi) * (x - y) \\
\Leftrightarrow | cos(x) - cos(y) | = | cos'(\xi) * (x - y) | \leq | cos'(\xi) | * | (x - y) |
\end{align*}
Da $ \xi \in (0, 1) $ gilt:
\begin{align*}
0 \leq | cos'(\xi) | = | sin(\xi) | < 1
\end{align*}
Damit ist gezeigt, dass $cos(x) : D \rightarrow D$ Kontraktion auf $D$.
\subsection*{Teilaufgabe c)}
Aufwand:
\begin{itemize}
\item Vorwärts-/Rückwärtssubstitution: jeweils $\frac{1}{2} \cdot n^2$
\item LR-Zerlegung: $\frac{1}{3}n^3$
\item gesamt: $\frac{1}{3}n^3+n^2$
\end{itemize}
Damit sind alle Voraussetzung des Banachschen Fixpunktsatzes erfüllt.
Nach dem Banachschen Fixpunktsatz folgt die Aussage.

View file

@ -1,9 +1,44 @@
\section*{Aufgabe 5}
Es gibt unendlich viele symmetrische QF mit $0=c_1 < c_2 < c_3$ und Ordnung $\geq 4$. Die Knoten müssen nur
folgende Eigenschaft erfüllen:
\[c_i = 1 - c_{s+1-i}\]
Die Gewichte sind durch Vorgabe der Knoten und der Bedingung, dass
die QF die Ordnung von $s \geq 3$ erfüllen soll, nach VL bereits
eindeutig bestimmt.
Anmerkung: Es gilt immer $c_2 = \frac{1}{2}$!
Zunächst ist nach der Familie von Quadraturformeln gefragt, für die gilt: ($p := $ Ordnung der QF)
\begin{align}
s = 3 \\
0 = c_1 < c_2 < c_3 \\
p \ge 4
\end{align}
Nach Satz 29 sind in der Familie genau die QFs, für die gilt: \\
Für alle Polynome $g(x)$ mit Grad $\le 0$ gilt:
\begin{align}
\int_0^1 M(x) \cdot g(x) \mathrm{d}x = 0 \label{a3}
\end{align}
Es gilt $g(x) = c$ für eine Konstante c, da der Grad von $g(x)$ $0$ ist. Also ist \ref{a3} gleichbedeutend mit:
\begin{align}
\int_0^1 M(x) \cdot c \mathrm{d}x &= 0 \\
\Leftrightarrow c \cdot \int_0^1 M(x) \mathrm{d}x &= 0 \\
\Leftrightarrow \int_0^1 M(x) \mathrm{d}x &= 0 \\
\Leftrightarrow \int_0^1 (x-c_1)(x-c_2)(x-c_3) \mathrm{d}x &= 0 \\
\Leftrightarrow \frac{1}{4} - \frac{1}{3} \cdot (c_2 + c_3) + \frac{1}{2} \cdot c_2 \cdot c_3 &= 0 \\
\Leftrightarrow \frac{\frac{1}{4} - \frac{1}{3} \cdot c_3}
{\frac{1}{3} - \frac{1}{2} \cdot c_3} &= c_2
\end{align}
Natürlich müssen auch die Gewichte optimal gewählt werden. Dafür wird Satz 28 genutzt:
Sei $b^T = (b_1, b_2, b_3)$ der Gewichtsvektor. Sei zudem $C :=
\begin{pmatrix}
{c_1}^0 & {c_2}^0 & {c_3}^0 \\
{c_1}^1 & {c_2}^1 & {c_3}^1 \\
{c_1}^2 & {c_2}^2 & {c_3}^2
\end{pmatrix}
$. \\
Dann gilt: $C$ ist invertierbar und $b = C^{-1} \cdot
\begin{pmatrix}
1 \\
\frac{1}{2} \\
\frac{1}{3}
\end{pmatrix}
$.
Es gibt genau eine symmetrische QF in der Familie. Begründung: \\
Aus $c_1 = 0 $ folgt, dass $c_3 = 0$ ist. Außerdem muss $c_2 = \frac{1}{2} $ sein. Also sind die Knoten festgelegt. Da wir die Ordnung $\ge s = 3$ fordern, sind auch die Gewichte eindeutig. \\
Es handelt sich um die aus der Vorlesung bekannte Simpsonregel.

View file

@ -0,0 +1,73 @@
\section*{Aufgabe 1}
\textbf{Gegeben:}
\[
A = \begin{pmatrix}
1 & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\]
\textbf{Aufgabe:} Durch Gauß-Elimination die Cholesky-Zerlegung $A = \overline{L} \overline{L}^T$
berechnen
\textbf{Lösung mit Gauß-Elimination:}
\begin{align*}
A &=
\begin{gmatrix}[p]
1 & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\rowops
\add[\cdot (-2)]{0}{1}
\add[\cdot (-3)]{0}{2}
\end{gmatrix}\\
\leadsto
L^{(1)} &=
\begin{pmatrix}
1 & 0 & 0\\
-2 & 1 & 0\\
-3 & 0 & 1
\end{pmatrix},&
A^{(1)} &=
\begin{gmatrix}[p]
1 & 2 & 3\\
0 & 4 & 8\\
0 & 8 & 25
\rowops
\add[\cdot (-2)]{1}{2}
\end{gmatrix}\\
\leadsto
L^{(2)} &=
\begin{pmatrix}
1 & 0 & 0\\
0 & 1 & 0\\
0 & -2 & 1
\end{pmatrix},&
A^{(2)} &=
\begin{gmatrix}[p]
1 & 2 & 3\\
0 & 4 & 8\\
0 & 0 & 9
\rowops
\add[\cdot (-2)]{1}{2}
\end{gmatrix}\\
\end{align*}
TODO: Und wie gehts weiter?
\textbf{Lösung ohne Gauß-Elimination:}
\[
A =
\underbrace{
\begin{pmatrix}
1 & 0 & 0\\
2 & 2 & 0\\
3 & 4 & 3
\end{pmatrix}}_{=: L} \cdot \underbrace{\begin{pmatrix}
1 & 2 & 3\\
0 & 2 & 4\\
0 & 0 & 3
\end{pmatrix}}_{=: L^T}
\]

View file

@ -0,0 +1,77 @@
\section*{Aufgabe 2}
\subsection*{Teilaufgabe i}
Es gilt:
\begin{align}
2x - e^{-x} &= 0\\
\Leftrightarrow 2x &= e^{-x}\\
\end{align}
Offensichtlich ist $g(x) := 2x$ streng monoton steigend und $h(x) := e^{-x}$ streng
monoton fallend.
Nun gilt: $g(0) = 0 < 1 = e^0 = h(0)$. Das heißt, es gibt keinen
Schnittpunkt für $x \leq 0$.
Außerdem: $g(1) = 2$ und $h(1) = e^{-1} = \frac{1}{e} < 2$.
Das heißt, für $x \geq 1$ haben $g$ und $h$ keinen Schnittpunkt.
Da $g$ und $h$ auf $[0,1]$ stetig sind und $g(0) < h(0)$ sowie $g(1) > h(1)$
gilt, müssen sich $g$ und $h$ im Intervall mindestens ein mal schneiden.
Da beide Funktionen streng monoton sind, schneiden sie sich genau
ein mal.
Ein Schnittpunkt der Funktion $g,h$ ist äquivalent zu einer
Nullstelle der Funktion $f$. Also hat $f$ genau eine Nullstelle
und diese liegt in $[0,1]$.
\subsection*{Teilaufgabe ii}
\begin{align}
2x - e^{-x} &= 0\\
\Leftrightarrow 2x &= e^{-x}\\
\Leftrightarrow x &= \frac{1}{2} \cdot e^{-x} = F_1(x) \label{a2iif1}\\
\stackrel{x \in \mathbb{R}^+}{\Rightarrow} \ln(2x) &= -x\\
\Leftrightarrow x &= - \ln(2x) = F_2(x)\label{a2iif2}
\end{align}
Gleichung \ref{a2iif1} zeigt, dass der Fixpunkt von $F_1$ mit der
Nullstelle von $f$ übereinstimmt.
Gleichung \ref{a2iif2} zeigt, dass der Fixpunkt von $F_1$ mit der
Nullstelle von $f$ übereinstimmt. Da es nur in $[0,1]$ eine Nullstelle
gibt (vgl. Teilaufgabe i), ist die Einschränkung von $x$ auf $\mathbb{R}^+$
irrelevant.
TODO: Ich vermute, man soll die Kontraktionszahlen ermitteln.
Die Funktion mit der niedrigern Kontraktionszahl ist besser, da man
bessere Abschätzungen machen kann.
$F_1$ ist auf $[0,1]$ eine Kontraktion mit Kontraktionszahl $\theta = \frac{1}{2}$:
\begin{align}
\|\frac{1}{2} e^{-x} - \frac{1}{2} e^{-y}\| &\leq \frac{1}{2} \cdot \|x-y\|\\
\Leftrightarrow \frac{1}{2} \cdot \| e^{-x} - e^{-y}\| &\leq \frac{1}{2} \cdot \|x-y\|\\
\Leftrightarrow \| e^{-x} - e^{-y}\| &\leq \|x-y\|\\
\Leftrightarrow \| -e^{-x-y}(e^{x} - e^{y})\| &\leq \|x-y\|\\
\Leftrightarrow \|-e^{-x-y} \| \cdot \|e^{x} - e^{y}\| &\leq \|x-y\|\\
\Leftrightarrow \underbrace{e^{-(x+y)}}_{\leq 1} \cdot \|e^{x} - e^{y}\| &\leq \|x-y\|
\end{align}
TODO: Beweis ist noch nicht fertig
$F_2$ ist auf $(0,1]$ eine Kontraktion mit Kontraktionszahl $\theta$:
\begin{align}
\|- \ln (2x) + \ln(2y) \| &\leq \theta \cdot \|x-y\|\\
\Leftrightarrow \| \ln(\frac{2y}{2x}) \| &\leq \theta \cdot \|x-y\|\\
\Leftrightarrow \| \ln(\frac{y}{x}) \| &\leq \theta \cdot \|x-y\|
\end{align}
TODO: Beweis ist nicht mal wirklich angefangen
Gegen $F_2$ spricht auch, dass $\log$ nur auf $\mathbb{R}^+$ definiert
ist. Das kann bei Rundungsfehlern eventuell zu einem Fehler führen.
(vgl. Python-Skript)
\subsection*{Teilaufgabe iii}
\[x_{k+1} = x_k - \frac{2x_k - e^{-x_k}}{2 + e^{-x_k}}\]
Laut \href{http://www.wolframalpha.com/input/?i=2x-e%5E(-x)%3D0}{Wolfram|Alpha} ist die Lösung etwa 0.35173371124919582602

View file

@ -0,0 +1,37 @@
\section*{Aufgabe 3}
\begin{table}[H]
\begin{tabular}{l|l|l|l|l}
$f_i$ & 8 & 3 & 4 & 8 \\ \hline
$x_i$ & -1 & 0 & 1 & 3 \\
\end{tabular}
\end{table}
\subsection*{Teilaufgabe i}
\begin{align}
p(x) = \sum_{i=0}^3 f_i \cdot L_i(x)
\end{align}
mit
\begin{align}
L_0(x) &= \frac{(x-x_1)(x-x_2)(x-x_3)}{(x_0 - x_1)(x_0-x_2)(x_0-x_3)}
= \ldots = \frac{x^3 - 4x^2 + 3x}{-8} \\
L_1(x) &= \frac{x^3 - 3x^2 - x + 3}{3} \\
L_2(x) &= \frac{x^3 - 2x^2 - 3x}{-4} \\
L_3(x) &= \frac{x^3 - x}{24}
\end{align}
\subsection*{Teilaufgabe ii}
Anordnung der dividierten Differenzen im so genannten Differenzenschema:
\begin{table}[H]
\begin{tabular}{llll}
$f[x_0]=f_0=8$ & ~ & ~ & ~ \\
$f[x_1]= 3$ & $f[x_0,x_1] = \frac{f[x_0] - f[x_1]}{x_0-x_1} = -5$ & ~ & ~ \\
$f[x_2] = 4$ & $1$ & $3$ & ~ \\
$f[x_3] = 8$ & $2$ & $\frac{1}{3}$ & $- \frac{2}{3} $ \\
\end{tabular}
\end{table}
Also:
\begin{align}
p(x) &= f[x_0] + f[x_0,x_1] \cdot (x-x_0) + f[x_0, x_1, x_2] \cdot (x-x_0) \cdot (x-x_1) \\ & + f[x_0, x_1, x_2, x_3] \cdot (x-x_0) \cdot (x-x_1) \cdot (x-x_2) \\
&= 8 - 5 \cdot (x-x_0) + 3 \cdot (x-x_0) \cdot (x-x_1) \\ & - \frac{2}{3} \cdot (x-x_0) \cdot (x-x_1) \cdot (x-x_2)
\end{align}

View file

@ -0,0 +1,6 @@
\section*{Aufgabe 4}
Ein Polynom, das vier Punkte interpoliert, hat maximal Grad 3.
Da wir das Integral über dieses Polynom im Bereich $[x_2, x_3]$
exakt berechnen sollen, muss die Quadraturformel vom Grad $p=4$ sein.
TODO

View file

@ -0,0 +1,7 @@
\section*{Aufgabe 5}
Das \href{https://de.wikipedia.org/wiki/Explizites_Euler-Verfahren}{explizite Euler-Verfahren}
dient der numerischen Lösung eines Anfangswertproblems (Differentialgleichungen).
Wir haben das nicht in der Vorlesung gemacht, also wird das wohl nicht
relevant sein.

Binary file not shown.

View file

@ -0,0 +1,50 @@
\documentclass[a4paper]{scrartcl}
\usepackage{amssymb, amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage{pdfpages} % Signatureinbingung und includepdf
\usepackage{geometry} % [margin=2.5cm]layout
\usepackage[pdftex]{hyperref} % links im text
\usepackage{color}
\usepackage{framed}
\usepackage{enumerate} % for advanced numbering of lists
\usepackage{marvosym} % checkedbox
\usepackage{wasysym}
\usepackage{braket} % for \Set{}
\usepackage{pifont}% http://ctan.org/pkg/pifont
\usepackage{gauss}
\usepackage{algorithm,algpseudocode}
\usepackage{parskip}
\usepackage{lastpage}
\usepackage{gauss}
\usepackage{units}
\allowdisplaybreaks
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\title{Numerik Klausur 6 - Musterlösung}
\makeatletter
\AtBeginDocument{
\hypersetup{
pdfauthor = {Martin Thoma, Peter, Felix},
pdfkeywords = {Numerik, KIT, Klausur},
pdftitle = {\@title}
}
\pagestyle{fancy}
\lhead{\@title}
\rhead{Seite \thepage von \pageref{LastPage}}
}
\makeatother
\usepackage{fancyhdr}
\fancyfoot[C]{}
\begin{document}
\input{Aufgabe1}\clearpage
\input{Aufgabe2}\clearpage
\input{Aufgabe3}
\input{Aufgabe4}
\input{Aufgabe5}
\end{document}

View file

@ -0,0 +1,8 @@
SOURCE = Klausur6
make:
pdflatex -shell-escape $(SOURCE).tex -output-format=pdf
pdflatex -shell-escape $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.out *.pyg

View file

@ -0,0 +1,11 @@
from math import exp, log
def iterate(x):
#return x - (2.0*x - exp(-x))/(2.0+exp(-x)) #Newton
#return 0.5*exp(-x) #F_1
return (-1)*log(2.0*x) #F_2
x = 0.9
for i in range(10):
print (i, x)
x = iterate(x)

View file

@ -0,0 +1,279 @@
\documentclass[aspectratio=169,hyperref={pdfpagelabels=false}]{beamer}
\usepackage{lmodern}
\usepackage[utf8]{inputenc} % this is needed for german umlauts
\usepackage[ngerman]{babel} % this is needed for german umlauts
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage{braket} % needed for \Set
\usepackage{algorithm,algpseudocode}
\usepackage{verbatim}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}
% Define some styles for graphs
\tikzstyle{vertex}=[circle,fill=black!25,minimum size=20pt,inner sep=0pt]
\tikzstyle{selected vertex} = [vertex, fill=red!24]
\tikzstyle{blue vertex} = [vertex, fill=blue!24]
\tikzstyle{edge} = [draw,thick,-]
\tikzstyle{weight} = [font=\small]
\tikzstyle{selected edge} = [draw,line width=5pt,-,red!50]
\tikzstyle{ignored edge} = [draw,line width=5pt,-,black!20]
% see http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
%\usetheme{Frankfurt}
\usefonttheme{professionalfonts}
% disables bottom navigation bar
\beamertemplatenavigationsymbolsempty
% http://tex.stackexchange.com/questions/23727/converting-beamer-slides-to-animated-images
\setbeamertemplate{navigation symbols}{}%
\newcommand{\alertline}{%
\usebeamercolor[fg]{normal text}%
\only{\usebeamercolor[fg]{alerted text}}}
\begin{document}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\newcommand\hlight[1]{\tikz[overlay, remember picture,baseline=-\the\dimexpr\fontdimen22\textfont2\relax]\node[rectangle,fill=blue!50,rounded corners,fill opacity = 0.2,draw,thick,text opacity =1] {$#1$};}
\newcommand\tocalculate[1]{\tikz[overlay, remember picture,baseline=-\the\dimexpr\fontdimen22\textfont2\relax]\node[rectangle,fill=green!50,rounded corners,fill opacity = 0.2,draw,thick,text opacity =1] {$#1$};}
\begin{frame}
\begin{minipage}[b]{0.30\linewidth}
\centering
\begin{align*}
A &= \begin{pmatrix}
1 & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\\
\alertline<1> L &= \alertline<1>\begin{pmatrix}
0 & 0 & 0\\
0 & 0 & 0\\
0 & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.60\linewidth}
\centering
\begin{algorithm}[H]
\begin{algorithmic}
\Function{Cholesky}{$A \in \mathbb{R}^{n \times n}$}
\alertline<1>\State $L = \Set{0} \in \mathbb{R}^{n \times n}$ \Comment{Initialisiere $L$}\\
\alertline<2>\alertline<4>\For{($k=1$; $\;k \leq n$; $\;k$++)}
\alertline<3>\State $L_{k,k} = \sqrt{A_{k,k} - \sum_{i=1}^{k-1} L_{k,i}^2}$
\For{($i=k+1$; $\;i \leq n$; $\;i$++)}
\State $L_{i,k} = \frac{A_{i,k} - \sum_{j=1}^{k-1} L_{i,j} \cdot L_{k,j}}{L_{k,k}}$
\EndFor
\EndFor
\alertline<5>\State \Return $L$
\EndFunction
\end{algorithmic}
\caption{Cholesky-Zerlegung}
\label{alg:seq1}
\end{algorithm}
\end{minipage}
\end{frame}
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
\hlight{1} & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
\tocalculate{0} & 0 & 0\\
0 & 0 & 0\\
0 & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{frame}
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
1 & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
\tocalculate{1} & 0 & 0\\
0 & 0 & 0\\
0 & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Calculate L_2,1
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
1 & 2 & 3\\
\hlight{2} & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
1 & 0 & 0\\
\tocalculate{0} & 0 & 0\\
0 & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{frame}
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
1 & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
\hlight{1} & 0 & 0\\
\tocalculate{2} & 0 & 0\\
0 & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{frame}
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
1 & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
1 & 0 & 0\\
\tocalculate{2} & 0 & 0\\
0 & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Calculate L_3,1
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
1 & 2 & 3\\
2 & 8 & 14\\
\hlight{3} & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
1 & 0 & 0\\
2 & 0 & 0\\
\tocalculate{0} & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{frame}
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
\hlight{1} & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
1 & 0 & 0\\
2 & 0 & 0\\
\tocalculate{3} & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Calculate L_2,2
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
1 & 2 & 3\\
2 & \hlight{8} & 14\\
3 & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
1 & 0 & 0\\
2 & \tocalculate{0} & 0\\
3 & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{frame}
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
1 & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
1 & 0 & 0\\
\hlight{2} & \tocalculate{8} & 0\\
3 & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{frame}
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
1 & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
1 & 0 & 0\\
2 & \tocalculate{8} & 0\\
3 & 0 & 0
\end{pmatrix}\\
tmp &= \hlight{4}
\end{align*}
\end{frame}
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
1 & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
1 & 0 & 0\\
2 & \tocalculate{4} & 0\\
3 & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{frame}
\begin{frame}
\begin{align*}
A &= \begin{pmatrix}
1 & 2 & 3\\
2 & 8 & 14\\
3 & 14 & 34
\end{pmatrix}\\
L &= \begin{pmatrix}
1 & 0 & 0\\
2 & \tocalculate{2} & 0\\
3 & 0 & 0
\end{pmatrix}\\
tmp &= 0
\end{align*}
\end{frame}
\end{document}

View file

@ -0,0 +1,35 @@
SOURCE = Animation
DELAY = 80
DENSITY = 300
WIDTH = 500
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
make
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
rm $(SOURCE)2.svg

View file

@ -0,0 +1,18 @@
def getL(A):
n = len(A)
L = [[0 for i in range(n)] for j in range(n)]
print(L)
print("")
for k in range(n):
L[k][k] = (A[k][k] - sum([L[k][i]**2 for i in range(k)]))**0.5
for i in range(k+1, n):
L[i][k] = (A[i][k]
- sum([L[i][j]*L[k][j] for j in range(k)])) \
/ L[k][k]
print("L_%i%i = A%i%i - sum(L_...)/L_%i%i) = %i" % (i, k, i, k, k, k, L[i][k]))
return L
A = [[1,2,3],[2,8,14],[3,14,34]]
print getL(A)

View file

@ -1,8 +1,8 @@
Wahltag,Wahlbeteiligung,CSU,SPD,FDP,GRÜNE,BP,FW,ÖDP,REP,NPD,KPD,GB/BHE,Sonstige
1946-06-30,72.1,58.3,28.8,2.5,,,,,,,5.3,,WAV 5.1
1946-12-01,75.7,52.3,28.6,5.7,,,,,,,6.1,,WAV 7.4
1950-11-26,79.9,27.4,28.0,7.1,,17.9,,,,,1,9,12.3,WAV 2.8
1954-11-28,82.4,38.0,28.1,7.2,,13.2,,,,,2,1,10.2,
1950-11-26,79.9,27.4,28.0,7.1,,17.9,,,,,1.9,12.3,WAV 2.8
1954-11-28,82.4,38.0,28.1,7.2,,13.2,,,,,2.1,10.2,
1958-11-23,76.6,45.6,30.8,5.6,,8.1,,,,,,8.6,
1962-11-25,76.5,47.5,35.3,5.9,,4.8,,,,,,GDP 5.1,
1966-11-20,80.6,48.1,35.8,5.1,,3.4,,,,7.4,,,

1 Wahltag,Wahlbeteiligung,CSU,SPD,FDP,GRÜNE,BP,FW,ÖDP,REP,NPD,KPD,GB/BHE,Sonstige Wahltag Wahlbeteiligung CSU SPD FDP GRÜNE BP FW ÖDP REP NPD KPD GB/BHE Sonstige
2 1946-06-30,72.1,58.3,28.8,2.5,,,,,,,5.3,,WAV 5.1 1946-06-30 72.1 58.3 28.8 2.5 5.3 WAV 5.1
3 1946-12-01,75.7,52.3,28.6,5.7,,,,,,,6.1,,WAV 7.4 1946-12-01 75.7 52.3 28.6 5.7 6.1 WAV 7.4
4 1950-11-26,79.9,27.4,28.0,7.1,,17.9,,,,,1,9,12.3,WAV 2.8 1950-11-26 79.9 27.4 28.0 7.1 17.9 1.9 12.3 WAV 2.8
5 1954-11-28,82.4,38.0,28.1,7.2,,13.2,,,,,2,1,10.2, 1954-11-28 82.4 38.0 28.1 7.2 13.2 2.1 10.2
6 1958-11-23,76.6,45.6,30.8,5.6,,8.1,,,,,,8.6, 1958-11-23 76.6 45.6 30.8 5.6 8.1 8.6
7 1962-11-25,76.5,47.5,35.3,5.9,,4.8,,,,,,GDP 5.1, 1962-11-25 76.5 47.5 35.3 5.9 4.8 GDP 5.1
8 1966-11-20,80.6,48.1,35.8,5.1,,3.4,,,,7.4,,, 1966-11-20 80.6 48.1 35.8 5.1 3.4 7.4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Before After
Before After

View file

@ -30,9 +30,11 @@
\addplot[blue, dashed, mark=triangle*] table [x=Wahltag, y=Wahlbeteiligung, col sep=comma] {landtagswahlen-in-bayern.csv};
\addplot[black,mark=square*] table [x=Wahltag, y=CSU, col sep=comma] {landtagswahlen-in-bayern.csv};
\addplot[red,mark=square*] table [x=Wahltag, y=SPD, col sep=comma] {landtagswahlen-in-bayern.csv};
\addplot[green,mark=square*] table [x=Wahltag, y=GRÜNE, col sep=comma] {landtagswahlen-in-bayern.csv};
\addplot[yellow,mark=square*] table [x=Wahltag, y=FDP, col sep=comma] {landtagswahlen-in-bayern.csv};
\legend{Wahlbeteiligung,CSU,SPD,Grüne,FDP}
\addplot[green,mark=x] table [x=Wahltag, y=GRÜNE, col sep=comma] {landtagswahlen-in-bayern.csv};
\addplot[yellow,mark=x] table [x=Wahltag, y=FDP, col sep=comma] {landtagswahlen-in-bayern.csv};
\addplot[blue,mark=x] table [x=Wahltag, y=BP, col sep=comma] {landtagswahlen-in-bayern.csv};
\addplot[orange,mark=x] table [x=Wahltag, y=FW, col sep=comma] {landtagswahlen-in-bayern.csv};
\legend{Wahlbeteiligung,CSU,SPD,Grüne,FDP,BP,FW}
\end{axis}
\end{tikzpicture}
\end{document}