Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4c6c9e0fa | ||
|
|
04bdda2272 |
@@ -47,6 +47,7 @@
|
||||
Falls $m =n$ definiert $A\in K^{n\times n}$ eine lineare Abbildung in $\K^n$.
|
||||
\end{bem}
|
||||
\begin{lemma}[Lineare Abbildungen in $\K^n$]
|
||||
\label{lemma:linabb}
|
||||
Sei $A = (a_{ij})_{i,j=1}^n \in \K^{n\times n}$. Dann sind die folgenden Aussagen äquivalent.
|
||||
\begin{enumerate}
|
||||
\item $A$ ist regulär
|
||||
@@ -134,9 +135,53 @@ Weitere Begriffe und Eigenschaften
|
||||
$$\norm{A}_2 = \max \left\{\sqrt{|\lambda|}, \lambda \in \sigma(\bar{A}^TA)\right\}$$
|
||||
Sei $A$ hermitesch, bzw. symmetrisch, dann gilt $\norm{A}_2 = \max\{\sqrt{|\lambda|}, \lambda\in \sigma(A)\}$
|
||||
\end{lemma}
|
||||
|
||||
\begin{proof}
|
||||
später
|
||||
\begin{enumerate}[1)]
|
||||
\item $\bar{A}^{T}A$ hermitesch, denn
|
||||
\[
|
||||
\overline{\left( \bar{A}^{T}A \right)^{T}}
|
||||
= \left( A^{T}\bar{A} \right)^{T} = \bar{A}^{T}A
|
||||
.\] $\bar{A}^{T}A$ positiv semidefinit, denn
|
||||
\[
|
||||
(\bar{A}^{T}Ax, x)_2 = (Ax, Ax)_2 = \Vert A x \Vert_2^{2} \ge 0 \qquad
|
||||
\forall x \in \mathbb{K}^{n}
|
||||
.\]
|
||||
\item Es ist nach Definition
|
||||
\[
|
||||
\Vert A \Vert_2^2 = \sup_{\Vert x \Vert_{2} = 1} \Vert A x \Vert_2^{2}
|
||||
= \sup_{\Vert x \Vert_2 = 1} (Ax, Ax)_2
|
||||
= \sup_{\Vert x \Vert_2 = 1} (x, \bar{A}^{T}Ax)_2
|
||||
.\] Wegen (1) ist $\bar{A}^{T}A$ hermitesch und positiv
|
||||
semidefinit, d.h. es ex. $U \in \mathbb{K}^{n \times n}$
|
||||
mit $U$ unitär und $U^{T}\bar{A}^{T}AU = D$, wobei
|
||||
$D = \text{diag}(\lambda_1, \ldots, \lambda_n)$, $\lambda \in \sigma(\bar{A}^{T}A)$ und
|
||||
$\lambda_i \ge 0$ reell.
|
||||
|
||||
Sei $y = \bar{U}^{T}x = U^{-1}x \implies x = Uy$. Damit folgt
|
||||
mit $|\lambda_{max}| := \max \{ |\lambda_i| \mid \lambda_i \in \sigma(\bar{A}^{T}A)\} $
|
||||
\begin{align*}
|
||||
\Vert A \Vert_2^2 &= \sup_{\Vert x \Vert_2 = 1} (x, \bar{A}^{T}Ax)_2 \\
|
||||
&= \sup_{\Vert Uy \Vert_2 = 1} (\underbrace{Uy}_{= x}, \bar{A}^{T}A\underbrace{Uy}_{= x})_2 \\
|
||||
&= \sup_{\Vert y \Vert_2 = 1} (y, \underbrace{\bar{U}^{T}\bar{A}^{T}AU}_{= D}y)_2 \\
|
||||
&= \sup_{\Vert y \Vert_2 = 1} (y, Dy)_2 \\
|
||||
&= \sup_{\Vert y \Vert_2 = 1}
|
||||
(\underbrace{\lambda_1 |y_1|^2 + \ldots + \lambda_n |y_n|^2}
|
||||
_{= \sum_{i=1}^{n} \lambda_i |y_i|^2}) \\
|
||||
&\le \sup_{\Vert y \Vert_2 = 1} \sum_{i=1}^{n} |\lambda_{max}| |y_i|^2 \\
|
||||
&= |\lambda_{max}| \sup_{\Vert y \Vert_2 = 1} \Vert y \Vert_2^2 \\
|
||||
&= |\lambda_{max}|
|
||||
.\end{align*}
|
||||
Sei $y$ Eigenvektor zu $\lambda_{max}$ und $\Vert y \Vert_2 = 1$. Dann gilt
|
||||
$Dy = \lambda_{max}y$, also $(y, Dy)_2 = \lambda_{max}\underbrace{(y,y)_2}_{= 1}$. Damit
|
||||
existiert ein $y$, s.d. $(y, Dy)_2 = \lambda_{max}$. % ????
|
||||
Also folgt
|
||||
$\displaystyle \sup_{\Vert y \Vert_2 = 1}(y, Dy)_2 = \lambda_{max}$. Damit folgt die
|
||||
Behauptung für $A \in \mathbb{K}^{n \times n}$. Behauptung
|
||||
für $A$ hermitesch analog. % ???????
|
||||
\end{enumerate}
|
||||
\end{proof}
|
||||
|
||||
\begin{definition}[orthonormale/unitäre Matrizen]
|
||||
Eine Matrix $Q\in \K^{m\times n}$ heißt \textbf{orthonormal}, wenn ihre Spaltenvektoren ein Orthonormalsystem im $\K^m$ bilden, d.h.
|
||||
$$Q = (q_1, \dots, q_n)\qquad q_j \in \K^m$$
|
||||
|
||||
@@ -0,0 +1,257 @@
|
||||
\documentclass{lecture}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\begin{lemma}[Störungssatz]
|
||||
Sei $\Vert \cdot \Vert$ beliebige natürliche Matrixnorm
|
||||
auf $\mathbb{K}^{n \times n}$. Die Störungsmatrix
|
||||
$B \in \mathbb{K}^{n \times n}$ hat $\Vert B \Vert < 1$. Dann ist
|
||||
die Matrix $\mathbb{I} + B$ regulär und es gilt
|
||||
\[
|
||||
\Vert (\mathbb{I} + B)^{-1} \Vert \le \frac{1}{1 - \Vert B \Vert}
|
||||
.\]
|
||||
\label{lemma:stoerung}
|
||||
\end{lemma}
|
||||
|
||||
\begin{proof}
|
||||
Sei $x \in \mathbb{K}^{n}$. Dann ist
|
||||
\begin{salign}
|
||||
\Vert (\mathbb{I} + B) x \Vert
|
||||
&= \Vert x + B x\Vert \\
|
||||
&\stackrel{\text{Dreiecksungl.}}{\ge } \Vert x \Vert - \Vert Bx \Vert \\
|
||||
&\stackrel{\Vert Bx \Vert \le \Vert B \Vert \Vert x \Vert}{\ge }
|
||||
\Vert x \Vert - \Vert B \Vert \cdot \Vert x \Vert \\
|
||||
&= ( \underbrace{1 - \Vert B \Vert}_{> 0}) \Vert x \Vert
|
||||
.\end{salign}
|
||||
Also hat die Gleichung $(\mathbb{I} + B) x = 0$ nur die Lösung $x = 0$, also
|
||||
ist $(\mathbb{I} + B)$ injektiv und mit \ref{lemma:linabb} regulär.
|
||||
|
||||
Bleibt zu zeigen: $\Vert (\mathbb{I} + B)^{-1} \Vert \le \frac{1}{1 - \Vert B \Vert}$.
|
||||
Es gilt
|
||||
\begin{salign}
|
||||
1 &= \Vert \mathbb{I}\Vert \\
|
||||
&= \Vert (\mathbb{I} + B) (\mathbb{I} + B)^{-1} \Vert \\
|
||||
&= \Vert (\mathbb{I} + B)^{-1} + B (\mathbb{I} + B)^{-1} \Vert \\
|
||||
&\stackrel{\text{Dreicksungl.}}{\ge } \Vert (\mathbb{I} + B)^{-1} \Vert
|
||||
- \Vert B (\mathbb{I} + B)^{-1} \Vert \\
|
||||
&\ge \Vert (\mathbb{I} + B)^{-1} \Vert - \Vert B \Vert \cdot \Vert (\mathbb{I} + B)^{-1} \Vert \\
|
||||
&= (1 - \Vert B \Vert) \Vert (\mathbb{I} + B)^{-1} \Vert
|
||||
.\end{salign}
|
||||
Damit folgt die Behauptung.
|
||||
\end{proof}
|
||||
|
||||
\begin{korrolar}
|
||||
Sei $A \in \mathbb{K}^{n \times n}$ regulär und
|
||||
$\tilde A \in \mathbb{K}^{n \times n}$ s.d. $\Vert A - \tilde A\Vert < \frac{1}{\Vert A^{-1} \Vert}$. Dann
|
||||
ist $\tilde A$ regulär.
|
||||
\end{korrolar}
|
||||
|
||||
\begin{proof}
|
||||
Es ist $\tilde A = \tilde A + A - A = (\tilde A - A) + A = A
|
||||
(\underbrace{A^{-1} (\tilde A - A) + \mathbb{I}}_{=:B})$. Damit folgt
|
||||
$\Vert B \Vert = \Vert A^{-1} (\tilde A - A) \Vert \le \Vert A^{-1} \Vert \cdot \Vert \tilde A
|
||||
- A \Vert < 1$.
|
||||
Mit \ref{lemma:stoerung} folgt $\mathbb{I} + A^{-1}(\tilde A - A)$ regulär. Da
|
||||
A regulär nach Vorraussetzung, folgt $\tilde A = A (\mathbb{I} + A^{-1} (\tilde A - A))$ regulär.
|
||||
\end{proof}
|
||||
|
||||
\chapter{Funktionen mehrerer Variablen}
|
||||
|
||||
Wir betrachten im Folgenden Funktionen $f\colon D \to \mathbb{K}$, mit
|
||||
$D \subseteq \mathbb{K}^{n}$, $D \neq \emptyset$ und Bildbereich $B_f \subseteq \mathbb{K}$.
|
||||
|
||||
Zur Erinnerung:
|
||||
\begin{itemize}
|
||||
\item \underline{Bild und Urbild}. Seien $M \subseteq D$, $N \subseteq f(D)$
|
||||
Teilmengen. Dann heißt
|
||||
\begin{align*}
|
||||
f(M) &:= \{y \in \mathbb{K} \mid \exists x \in M\colon y = f(x)\}
|
||||
\intertext{das Bild. Weiter heißt}
|
||||
f^{-1}(N) &:= \{ x \in D \mid \exists y \in N\colon f(x) = y\}
|
||||
.\end{align*}
|
||||
das Urbild. Dann ist $B_f = f(D)$ und $D = f^{-1}(B_f)$
|
||||
\item \underline{Notation}. $f^{-1}(\cdot )$ meint das Mengen-Urbild, \underline{nicht}
|
||||
eine Umkehrfunktion.
|
||||
\end{itemize}
|
||||
|
||||
Da alle Normen auf $\mathbb{K}^{n}$ äquivalent sind, sind alle Aussagen unabhängig
|
||||
von der gewählten Norm. Standard ist die euklid. Norm.
|
||||
|
||||
\section{Stetigkeit}
|
||||
|
||||
\begin{definition}[Stetigkeit]
|
||||
Eine Funktion $f\colon D \to \mathbb{K}$, $D \subseteq \mathbb{K}^{n}$ heißt
|
||||
\underline{stetig} in einem Punkt $a \in D$, wenn für alle Folgen
|
||||
$\left( x^{(k)} \right)_{k \in \N} \subseteq D$ mit
|
||||
$x^{(k)} \xrightarrow{k \to \infty} a$ gilt
|
||||
\[
|
||||
f\left( x^{(k)} \right) \xrightarrow{k \to \infty} f(a)
|
||||
.\] Die Funktion $f$ heißt \underline{stetig in $D$}, wenn sie für alle
|
||||
$x \in D$ stetig ist.
|
||||
\end{definition}
|
||||
|
||||
\begin{bem}
|
||||
\begin{itemize}
|
||||
\item Falls $f\colon D \to \mathbb{K}$ stetig, dann ist auch
|
||||
$f\colon M \to \mathbb{K}$, $M \subseteq D$ stetig.
|
||||
\item $f$ stetig $\implies \text{Re } f$, $\text{Im } f$, $|f|$ sind stetig.
|
||||
\end{itemize}
|
||||
\end{bem}
|
||||
|
||||
\begin{lemma}[$\varepsilon$-$\delta$-Kriterium der Stetigkeit]
|
||||
$f\colon D \to \mathbb{K}$, $D \subseteq \mathbb{K}^{n}$ ist stetig in $a \in D$, genau
|
||||
dann wenn $\forall \epsilon > 0$, $\exists \delta > 0$, s.d. $\forall x \in D$ gilt
|
||||
\[
|
||||
\Vert x - a \Vert < \delta \implies |f(x) - f(a)| < \epsilon
|
||||
.\]
|
||||
\end{lemma}
|
||||
|
||||
\begin{proof}
|
||||
wie für $n = 1$.
|
||||
\end{proof}
|
||||
|
||||
\begin{lemma}
|
||||
Seien $f, g\colon D \to \mathbb{K}$ stetig, dann sind
|
||||
$f + g$, $f \cdot g$ und $\frac{f}{g}$ (falls $g(x) \neq 0$ $\forall x \in D$)
|
||||
stetig.
|
||||
\end{lemma}
|
||||
|
||||
\begin{proof}
|
||||
wie für $n = 1$.
|
||||
\end{proof}
|
||||
|
||||
\begin{satz}
|
||||
Eine stetige Funktion $f\colon D \to \mathbb{K}$, $D \subseteq \mathbb{K}^{n}$
|
||||
ist auf jeder kompakten Menge $K \subseteq D$ beschränkt, d.h.
|
||||
\[
|
||||
\exists M_K \text{ s.d. } |f(x)| \le M_K \quad \forall x \in K
|
||||
.\]
|
||||
\end{satz}
|
||||
|
||||
\begin{proof}
|
||||
Ang.: $f(x)$ nicht beschränkt auf $K$. Dann gilt: $\forall k \in \N$, $\exists x^{(k)} \in K$ mit
|
||||
$|f\left(x^{(k)}\right)| > k$, d.h. $|f\left( x^{(k)} \right)| \xrightarrow{k \to \infty} \infty$.
|
||||
|
||||
Die Folge $(x^{(k)})_{k\in\N}$ besitzt auf der kompakten Menge $K$ eine
|
||||
konvergente Teilfolge $\left( x^{(k_j)} \right)_{j \in \N}$ mit
|
||||
$\displaystyle \lim_{j \to \infty} x^{(k_j)} = x \in K$.
|
||||
|
||||
Da $f$ stetig, folgt $|f\left( x^{(k_j)} \right)| \xrightarrow{j \to \infty} |f(x)|$. Widerspruch
|
||||
zu $|f\left( x^{(k)} \right)| \xrightarrow{k \to \infty} \infty$.
|
||||
\end{proof}
|
||||
|
||||
\begin{satz}[Extremum]
|
||||
Eine stetige Funktion $f\colon D \subseteq \mathbb{K}^{n} \to \mathbb{K}$ nimmt
|
||||
auf jeder nichtleeren kompakten Menge $K \subseteq D$ ihr
|
||||
Maximum und Minimum an, d.h. es ex. $x^{max}$ und $x^{min} \in K$, s.d.
|
||||
\begin{align*}
|
||||
f(x^{max}) &= \sup_{x \in K} f(x) =: \max_{x \in K} f(x) \\
|
||||
f(x^{min}) &= \inf_{x \in K} f(x) =: \min_{x \in K} f(x)
|
||||
.\end{align*}
|
||||
\label{satz:stetigextremum}
|
||||
\end{satz}
|
||||
|
||||
\begin{proof}
|
||||
$f$ stetig und deshalb beschränkt auf $K$, d.h. es ex. obere Schranke
|
||||
$\displaystyle M := \sup_{x \in K} f(x)$. Außerdem existiert eine Folge
|
||||
$\left( x^{(k)} \right)_{k \in \N} \subseteq K$, s.d.
|
||||
$f\left( x^{(k)} \right) \xrightarrow{k \to \infty} M$. Da $K$ kompakt, existiert
|
||||
eine konvergente Teilfolge $\left( x^{(k_j)} \right)_{j \in \N}$ mit
|
||||
$x^{(k_j)} \xrightarrow{j \to \infty} a =: x^{max} \in K$. Wegen der Stetigkeit von
|
||||
$f$, folgt aus $f\left( x^{(k_j)} \right) \xrightarrow{j \to \infty} f\left( x^{max} \right)$:
|
||||
$f(x^{max}) = M$.
|
||||
\end{proof}
|
||||
|
||||
\begin{bem}[Anwendung von Satz \ref{satz:stetigextremum}]
|
||||
Seien $K_1, K_2 \subseteq \mathbb{K}^{n}$, $K_1 \neq \emptyset$, $K_2 \neq \emptyset$
|
||||
kompakt. Dann ist die Menge $K_1 \times K_2$ auch kompakt. Definiere
|
||||
$f(x, y) := \Vert x - y \Vert$, $x \in K_1$, $y \in K_2$.
|
||||
|
||||
$f(x,y)$ ist stetig, denn
|
||||
\[
|
||||
|f(x,y) - f(x', y')| = | \Vert x - y \Vert - \Vert x' - y'\Vert |
|
||||
\quad \stackrel{\Delta -\text{ungl.}}{\le} \quad \Vert x - y - x' + y' \Vert \le \Vert x - x' \Vert + \Vert y - y' \Vert
|
||||
.\] $\forall x, x' \in K_1$ und $\forall y, y' \in K_2$ mit
|
||||
$\Vert x - x'\Vert < \delta = \frac{\epsilon}{2}$ und $\Vert y - y'\Vert < \delta = \frac{\epsilon}{2}$
|
||||
gilt
|
||||
\[
|
||||
|f(x,y) - f(x', y')| < \epsilon
|
||||
.\] Also ist $f(x,y)$ stetig auf $K_1 \times K_2$. Mit \ref{satz:stetigextremum} folgt damit:
|
||||
$\exists a \in K_1$, $b \in K_2$, s.d.
|
||||
\[
|
||||
\Vert a - b \Vert = \inf_{x \in K_1 y \in K_2} \Vert x - y \Vert =: d(K_1, K_2)
|
||||
\quad \text{Abstand zwischen Mengen } K_1 \text{ und } K_2
|
||||
.\] Im Fall $K_1 \cap K_2 = \emptyset$, gilt $d(K_1, K_2) > 0$. Falls
|
||||
$K_1 = \{a\} $, dann heißt $b \in K_2$ die Projektion des Punktes $a$ auf
|
||||
$K_2$ (diese ist im Allg. nicht eindeutig bestimmt).
|
||||
\end{bem}
|
||||
|
||||
\begin{definition}[Gleichmäßige Stetigkeit]
|
||||
Eine Funktion $f\colon D \to \mathbb{K}$, $D \subseteq \mathbb{K}^{n}$ ist gleichmäßig stetig,
|
||||
wenn $\forall \epsilon > 0$
|
||||
$\exists \delta > 0$, s.d.
|
||||
\[
|
||||
\forall x, y \in D\colon \Vert x - y \Vert < \delta \implies |f(x) - f(y)| < \epsilon
|
||||
.\]
|
||||
\end{definition}
|
||||
|
||||
\begin{satz}
|
||||
Eine stetige Funktion $f\colon D \to \mathbb{K}^{n}$, $D \subseteq \mathbb{K}^{n}$ ist
|
||||
auf einer kompakten Menge $K \subseteq D$ gleichmäßig stetig.
|
||||
\end{satz}
|
||||
|
||||
\begin{proof}
|
||||
Ang. $f$ nicht gleichmäßig stetig. Dann $\exists \epsilon > 0$, s.d. $\forall k \in \N$,
|
||||
ex. Punkte $x^{(k)}$ und $y^{(k)} \in K$, s.d.
|
||||
\[
|
||||
\Vert x^{(k)} - y^{(k)} \Vert < \frac{1}{k} \text{ und }
|
||||
\left|f\left( x^{(k)} \right) - f\left( y^{(k)} \right) \right| > \epsilon
|
||||
.\] Da $K$ kompakt, ex. eine konvergente Teilfolge $\left( x^{(k_j)} \right)_{j \in \N}$ von
|
||||
$(x^{(k)})_{k \in \N}$ mit $\displaystyle \lim_{j \to \infty} x^{(k_j)} = x \in K$. Wir haben
|
||||
$\Vert x^{(k)} - y^{(k)} \Vert < \frac{1}{k}$, also
|
||||
\[
|
||||
\Vert x^{(k_j)} - y^{(k_j)} \Vert < \frac{1}{k^{j}} \implies
|
||||
\lim_{j \to \infty} y^{(k_j)} = x = \lim_{j \to \infty} x^{(k_j)}
|
||||
.\] Da $f$ stetig, folgt
|
||||
\[
|
||||
\left| f\left( x^{(k_j)} \right) - f\left( y^{(k_j)} \right) \right|
|
||||
\xrightarrow{j \to \infty} |f(x) - f(x)| = 0
|
||||
.\] Widerspruch zu $\left| f\left( x^{(k)}\right) - f\left( y^{(k)} \right) \right| > \epsilon$.
|
||||
\end{proof}
|
||||
|
||||
\begin{definition}[Konvergenz von Funktionenfolgen]
|
||||
Sei $f_k \colon D \subseteq \mathbb{K}^{n} \to \mathbb{K}$, $k \in \N$.
|
||||
$(f_k)_{k \in \N}$ konvergiert
|
||||
\begin{itemize}
|
||||
\item \underline{punktweise} gegen eine Funktion $f\colon D \to \mathbb{K}$, falls
|
||||
$\forall x \in D$ gilt $f_k(x) \xrightarrow{k \to \infty} f(x)$.
|
||||
\item \underline{gleichmäßig}, falls $\sup_{x \in D} |f_k(x) - f(x)| \xrightarrow{k \to \infty} 0$.
|
||||
\end{itemize}
|
||||
\end{definition}
|
||||
|
||||
\begin{satz}[Gleichmäßige Konvergenz]
|
||||
Sei $f_k \colon D \subseteq \mathbb{K}^{n} \to \mathbb{K}$ stetig, $f_k \xrightarrow{k \to \infty} f$
|
||||
gleichmäßig mit $f\colon D \to \mathbb{K}$. Dann ist $f$ stetig.
|
||||
\end{satz}
|
||||
|
||||
\begin{proof}
|
||||
Sei $x \in D$ und $\epsilon > 0$ beliebig. Da $(f_k)_{k\in\N}$ gleichmäßig gegen $f$ konvergiert,
|
||||
existiert ein $n = n(\epsilon) \in \N$ s.d.
|
||||
$\displaystyle \sup_{y \in D} |f_n(y) - f(y)| < \frac{\epsilon}{3}$.
|
||||
|
||||
Da $f_n$ stetig, ex. $\delta > 0$, s.d. $\forall y \in D$ gilt:
|
||||
$\Vert x - y \Vert < \delta \implies |f_n(x) - f_n(y)| < \frac{\epsilon}{3}$.
|
||||
|
||||
Dann gilt $\forall x, y \in D$ mit $\Vert x - y \Vert < \delta $:
|
||||
\[
|
||||
|f(x) - f(y)| \le |f(x) - f_n(x)| + |f_n(x) - f_n(y)|
|
||||
+ |f_n(y) - f(y)| < \frac{\epsilon}{3} + \frac{\epsilon}{3} + \frac{\epsilon}{3} = \epsilon
|
||||
.\] Also ist $f$ stetig in $x$.
|
||||
\end{proof}
|
||||
|
||||
\begin{bem}
|
||||
Analoge Sätze gelten allgemein für Funktionen auf kompakten Mengen in
|
||||
normierten $(V, \Vert \cdot \Vert)$ oder metrischen $(X, d(\cdot , \cdot ))$ Räumen.
|
||||
\end{bem}
|
||||
|
||||
\end{document}
|
||||
Binary file not shown.
@@ -23,5 +23,6 @@
|
||||
\input{ana5.tex}
|
||||
\input{ana6.tex}
|
||||
\input{ana7.tex}
|
||||
\input{ana8.tex}
|
||||
|
||||
\end{document}
|
||||
|
||||
+67
@@ -24,6 +24,7 @@
|
||||
\RequirePackage[hidelinks, unicode]{hyperref} %[unicode, hidelinks]{hyperref}
|
||||
\RequirePackage{bookmark}
|
||||
\RequirePackage{wasysym}
|
||||
\RequirePackage{environ}
|
||||
|
||||
\usetikzlibrary{quotes, angles}
|
||||
|
||||
@@ -150,3 +151,69 @@
|
||||
|
||||
% contradiction
|
||||
\newcommand{\contr}{\text{\Large\lightning}}
|
||||
|
||||
% people seem to prefer varepsilon over epsilon
|
||||
\renewcommand{\epsilon}{\varepsilon}
|
||||
|
||||
\ExplSyntaxOn
|
||||
|
||||
% S-tackrelcompatible ALIGN environment
|
||||
% some might also call it the S-uper ALIGN environment
|
||||
% uses regular expressions to calculate the widest stackrel
|
||||
% to put additional padding on both sides of relation symbols
|
||||
\NewEnviron{salign}
|
||||
{
|
||||
\begin{align*}
|
||||
\lec_insert_padding:V \BODY
|
||||
.\end{align*}
|
||||
}
|
||||
|
||||
% some helper variables
|
||||
\tl_new:N \l__lec_text_tl
|
||||
\seq_new:N \l_lec_stackrels_seq
|
||||
\int_new:N \l_stackrel_count_int
|
||||
\int_new:N \l_idx_int
|
||||
\box_new:N \l_tmp_box
|
||||
\dim_new:N \l_tmp_dim_a
|
||||
\dim_new:N \l_tmp_dim_b
|
||||
\dim_new:N \l_tmp_dim_needed
|
||||
|
||||
% function to insert padding according to widest stackrel
|
||||
\cs_new_protected:Nn \lec_insert_padding:n
|
||||
{
|
||||
\tl_set:Nn \l__lec_text_tl { #1 }
|
||||
% get all stackrels in this align environment
|
||||
\regex_extract_all:nnN { \c{stackrel}{(.*?)}{(.*?)} } { #1 } \l_lec_stackrels_seq
|
||||
% get number of stackrels
|
||||
\int_set:Nn \l_stackrel_count_int { \seq_count:N \l_lec_stackrels_seq }
|
||||
\int_set:Nn \l_idx_int { 1 }
|
||||
\dim_set:Nn \l_tmp_dim_needed { 0pt }
|
||||
% iterate over stackrels
|
||||
\int_while_do:nn { \l_idx_int <= \l_stackrel_count_int }
|
||||
{
|
||||
% calculate width of text
|
||||
\hbox_set:Nn \l_tmp_box {$\seq_item:Nn \l_lec_stackrels_seq { \l_idx_int + 1 }$}
|
||||
\dim_set:Nn \l_tmp_dim_a {\box_wd:N \l_tmp_box}
|
||||
% calculate width of relation symbol
|
||||
\hbox_set:Nn \l_tmp_box {$\seq_item:Nn \l_lec_stackrels_seq { \l_idx_int + 2 }$}
|
||||
\dim_set:Nn \l_tmp_dim_b {\box_wd:N \l_tmp_box}
|
||||
% check if 0.5*(a-b) > minimum padding, if yes updated minimum padding
|
||||
\dim_compare:nNnTF
|
||||
{ 1pt * \dim_ratio:nn { \l_tmp_dim_a - \l_tmp_dim_b } { 2pt } } > { \l_tmp_dim_needed }
|
||||
{ \dim_set:Nn \l_tmp_dim_needed { 1pt * \dim_ratio:nn { \l_tmp_dim_a - \l_tmp_dim_b } { 2pt } } }
|
||||
{ }
|
||||
\quad
|
||||
% increment list index by three, as every stackrel produces three list entries
|
||||
\int_incr:N \l_idx_int
|
||||
\int_incr:N \l_idx_int
|
||||
\int_incr:N \l_idx_int
|
||||
}
|
||||
% replace all relations with align characters (&) and add the needed padding
|
||||
\regex_replace_all:nnN
|
||||
{ (&=|&\c{le}|&\c{ge}|&\c{stackrel}{.*?}{.*?}|&\c{neq}) }
|
||||
{ \c{kern} \u{l_tmp_dim_needed} \1 \c{kern} \u{l_tmp_dim_needed} }
|
||||
\l__lec_text_tl
|
||||
\l__lec_text_tl
|
||||
}
|
||||
\cs_generate_variant:Nn \lec_insert_padding:n { V }
|
||||
\ExplSyntaxOff
|
||||
|
||||
Reference in New Issue
Block a user