diff --git a/sose2020/num/uebungen/daten.dat b/sose2020/num/uebungen/daten.dat new file mode 100644 index 0000000..56360ff --- /dev/null +++ b/sose2020/num/uebungen/daten.dat @@ -0,0 +1,101 @@ +0.01401 +0.02802 +0.05604 +0.11208 +0.22416 +0.44832 +0.89664 +0.20672 +0.41344 +0.82688 +0.34624 +0.69248 +0.61504 +0.76992 +0.460159 +0.920319 +0.159363 +0.318726 +0.637451 +0.725098 +0.549805 +0.900391 +0.199219 +0.398438 +0.796875 +0.40625 +0.8125 +0.375 +0.75 +0.5 +1 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/sose2020/num/uebungen/num2.pdf b/sose2020/num/uebungen/num2.pdf new file mode 100644 index 0000000..181631e Binary files /dev/null and b/sose2020/num/uebungen/num2.pdf differ diff --git a/sose2020/num/uebungen/num2.tex b/sose2020/num/uebungen/num2.tex new file mode 100644 index 0000000..0bcf2ec --- /dev/null +++ b/sose2020/num/uebungen/num2.tex @@ -0,0 +1,151 @@ +\documentclass[uebung]{../../../lecture} + +\begin{document} + +\title{Einführung in die Numerik: Übungsblatt 2} +\author{Leon Burgard, Christian Merten} + +\punkte + +\begin{aufgabe} + Die relativen Konditionszahlen sind gegeben durch + \[ + \frac{\partial F_i}{\partial x_j}(x) \frac{x_j}{F_i(x)} + .\] + \begin{itemize} + \item $F(x, y) = x \cdot y$: + \[ + \frac{\partial F}{\partial x} = y \qquad \frac{\partial F}{\partial y } = x + .\] Damit folgt + \[ + k_{11} = y \cdot \frac{x}{x \cdot y} = 1 \qquad k_{12} = x \cdot \frac{y}{x \cdot y} = 1 + .\] Die Multiplikation ist also gut konditioniert. + \item $F(x, y) = \frac{x}{y}$: + \begin{align*} + \frac{\partial F}{\partial x} = \frac{1}{y} &\qquad \frac{\partial F}{\partial y} = - \frac{x}{y^2} + \intertext{Damit folgt} + k_{11} = \frac{1}{y} \cdot \frac{x}{\frac{x}{y}} = \frac{x}{y} \frac{y}{x} = 1 + &\qquad + k_{12} = -\frac{x}{y^2} \cdot \frac{y}{\frac{x}{y}} = - \frac{x}{y^2} \frac{y^2}{x} = -1 + .\end{align*} + Die Division ist also auch gut konditioniert. + \item $F(x) = \sqrt{x} $ + \begin{align*} + \frac{\d F}{\d x} &= \frac{1}{2\sqrt{x} } + \intertext{Damit folgt} + k_{11} &= \frac{1}{2\sqrt{x} } \frac{x}{\sqrt{x} } = \frac{1}{2} + .\end{align*} + Wurzelziehen ist also ebenfalls gut konditioniert. + \end{itemize} +\end{aufgabe} + +\begin{aufgabe} + \begin{itemize} + \item Sei $p \in \N$. + \begin{align*} + f(h) &= (ph^2 + h^2)^2 - p^2h^{4} \\ + &= h^{2} \left(2ph + 1\right) + \intertext{Es ist $2ph + 1 \le 2p + 1$ für $h \le 1$. Also folgt mit $c = 2p + 1$} + f(h) &= \mathcal{O}(h^2) + .\end{align*} + \item Es gilt für $0 < h \le \frac{1}{e}\colon |\ln(h)| \ge 1$. Also folgt + \[ + |f(h)| = \left|-\frac{h^2}{\ln(h)}\right| + \le h^2 \implies f(h) = \mathcal{O}(h^2) + .\] + \item Es gilt + \begin{align*} + \lim_{h \to 0} |f(h)| &= \lim_{h \to 0} \left| \frac{\sin(x + h) - 2 \sin(x) + \sin(x-h)}{h^2} + \sin(x) \right| \\ + &\stackrel{\text{de l'Hospital}}{=} + \qquad \lim_{h \to 0} \left| \frac{\cos(x+h) - \cos(x - h)}{2h}\right| = \infty + .\end{align*} + Sei nun $m \in \N$ beliebig. Dann gilt stets $h^{m} \xrightarrow{h \to 0} 0$. Also + existiert kein $m \in \N$ mit $f(h) = \mathcal{O}(h^{m})$. + \end{itemize} + \begin{figure}[h!] + \begin{tikzpicture} + \begin{axis} + \addplot[domain=0:1, samples=50, smooth, green] {3*x^2 + x)^2 - 3^2*x^4}; + \addplot[domain=0:1, samples=50, smooth, red] {x^2 * (2*3 + 1)}; + \legend{$(ph^2 + h)^2 - p^2h^{4}$, $(2p + 1) h^2$} + \end{axis} + \end{tikzpicture} + \begin{tikzpicture} + \begin{axis} + \addplot[domain=0:0.5, samples=50, smooth, green] {- (x^2)/(ln(x))}; + \addplot[domain=0:0.5, samples=50, smooth, red] {x^2}; + \legend{$- \frac{h^2}{\ln h}$, $h^2$} + \end{axis} + \end{tikzpicture} + \caption{Links: $f_1(h)$ für $p = 1$ und $c = 7$, Rechts: $f_2(h)$ mit $c = 1$} + \end{figure} +\end{aufgabe} + +\begin{aufgabe} + Quadratische Ergänzung führt auf die Lösungsformel + \begin{align*} + x_{1/2} &= \pm \sqrt{p^2 - 1} + p + \intertext{Also folgt} + \frac{\partial F_{1/2}}{\partial p} &= \pm \frac{p}{\sqrt{p^2 - 1} } + 1 + \intertext{Damit ergibt sich} + k_{11} &= \frac{1 + \sqrt{1 - \frac{1}{p^2}} }{1 - \frac{1}{p^2} + \sqrt{1 - \frac{1}{p^2}} } \\ + k_{21} &= \frac{- 1 + \sqrt{1 - \frac{1}{p^2}} }{-1 + \frac{1}{p^2} + \sqrt{1 - \frac{1}{p^2}} } + .\end{align*} + Aus der Lösungsformel folgt zudem $F(p) \in \R^{2} \iff |p| \ge 1 $ + + Das alternativ parametrisierte Problem führt auf die Lösungsformel + \begin{align*} + x_{1 / 2} &= \pm \sqrt{\frac{(t^2 + 1)^2}{4t^2} - 1} + \frac{t^2 + 1}{2t} + .\end{align*} + Hier wird analog der Verstärkungsfaktor berechnet. Im ersten Fall wird das Problem + schlecht konditioniert, wenn $|p| < 1$ wird, allerdings hat dann die Gleichung keine + reellen Lösungen mehr. +\end{aufgabe} + +\begin{aufgabe} + Es sei $I := [0,1]$ und + \[ + f\colon I \to I, \quad f(x) := \begin{cases} + 2x & \text{falls } x \in [0, 0.5) \\ + 2 - 2x & \text{falls } x \in [0.5, 1] + \end{cases} + .\] Die Folge $(x_i)_{i\in\N}$ sei für ein $x_0 \in I$ definiert als + \[ + x_i = f(x_{i-1}) + .\] + \begin{enumerate}[a)] + \item siehe \textit{zeltabbildung.cpp} + \item Beh.: Sei $x_0 = (0.m_1 \ldots m_r)_{2} \in [0,1]$ eine Festkommazahl der Binärdarstellung + mit höchstens $r$ Nachkommastellen ungleich $0$. Dann gilt $x_{r+1} = 0$. + \begin{proof} + Beweis per Induktion nach $r$. + + Für $r = 0$: trivial $f(0) = 0 \implies x_1 = 0$. + + Sei Beh. gegeben für ein $r \in \N_0$. Dann sei + \[ + x_0 = (0.m_1\ldots m_{r+1})_2 \in [0,1] + .\] mit $m_{r+1} \neq 0$ (sonst bereits gezeigt). + + Falls $x_0 \in [0, 0.5)$. Dann ist $m_1 = 0$ und + \[ + x_1 = f(x_0) = 2x_0 = 2 \sum_{i=1}^{r+1} m_i 2^{-i} + = \sum_{i=1}^{r+1} m_i 2^{-i+1} + = (0.\widetilde{m}_{1}\ldots\widetilde{m}_{r+1})_2 + .\] Da $m_{r+1} = 1_{2} \implies \widetilde{m}_{r+1} = 0_{2}$. Also + hat $x_1$ höchstens $r$ Stellen ungleich $0$. Wende I.V. auf $x_1$ an. Damit folgt + $x_{r+1} = 0$. + + Falls $x_0 \in [0.5, 1]$. Dann ist $m_1 = 1_{2}$ und + \[ + x_1 = f(x_0) = 2 - 2x_0 = 2 - 2 \sum_{i=1}^{n} m_i 2^{-i} + = 2 - \sum_{i=1}^{n} m_i 2^{-i + 1} = (0.\widetilde{m}_{1}\ldots\widetilde{m}_{r+1})_2 + .\] Da $m_{r+1} = 1_{2} \implies \widetilde{m}_{r+1} = 0_{2}$. Also + hat $x_1$ höchstens $r$ Stellen ungleich $0$. Wende I.V. auf $x_1$ an. Damit folgt + $x_{r+1} = 0$. + \end{proof} + \item siehe \textit{zeltabbildung.cpp} + \end{enumerate} +\end{aufgabe} + +\end{document} diff --git a/sose2020/num/uebungen/zeltabbildung.cpp b/sose2020/num/uebungen/zeltabbildung.cpp new file mode 100644 index 0000000..be97107 --- /dev/null +++ b/sose2020/num/uebungen/zeltabbildung.cpp @@ -0,0 +1,20 @@ +#include + +float f(float x) { + if(x >= 0 && x < 0.5) return 2*x; + else return 2 * (1 - x); +} + +float f_chaos(float x) { + if(x >= 0 && x < 0.5) return 1.999999*x; + else return 1.999999 * (1 - x); +} + +int main() { + float x = 0.01401; + std::cout << x << std::endl; + for (int i = 1; i <= 100; i++) { + x = f(x); + std::cout << x << std::endl; + } +}