Compare commits

..

No commits in common. "main" and "tut5-v1.1" have entirely different histories.

6 changed files with 16 additions and 1434 deletions

View File

@ -1,3 +1,4 @@
$pdflatex="pdflatex -shell-escape -interaction=nonstopmode -synctex=1 %O %S"; $pdflatex="pdflatex -shell-escape -interaction=nonstopmode -synctex=1 %O %S";
$out_dir = 'build'; $out_dir = 'build';
$pdf_mode = 1; $pdf_mode = 1;

View File

@ -1,25 +1,19 @@
PRESENTATIONS := $(patsubst src/%/presentation.tex,build/presentation_%.pdf,$(wildcard src/*/presentation.tex)) PRESENTATIONS := $(patsubst src/%/presentation.tex,build/presentation_%.pdf,$(wildcard src/*/presentation.tex))
HANDOUTS := $(patsubst build/presentation_%.pdf,build/presentation_%_handout.pdf,$(PRESENTATIONS)) HANDOUTS := $(patsubst build/presentation_%.pdf,build/presentation_%_handout.pdf,$(PRESENTATIONS))
RC_PDFLATEX := $(shell grep '$$pdflatex' .latexmkrc \
| sed -e 's/.*"\(.*\)".*/\1/' -e 's/%S//' -e 's/%O//')
.PHONY: all .PHONY: all
all: $(PRESENTATIONS) $(HANDOUTS) all: $(PRESENTATIONS) $(HANDOUTS)
build/presentation_%.pdf: src/%/presentation.tex build/prepared build/presentation_%.pdf: src/%/presentation.tex build/prepared
TEXINPUTS=./lib/cel-slides-template-2025:$(dir $<):$$TEXINPUTS \ TEXINPUTS=./lib/cel-slides-template-2025:$$TEXINPUTS latexmk $<
latexmk -outdir=build/$* $< mv build/presentation.pdf $@
cp build/$*/presentation.pdf $@
build/presentation_%_handout.pdf: src/%/presentation.tex build/prepared build/presentation_%_handout.pdf: src/%/presentation.tex build/prepared
TEXINPUTS=./lib/cel-slides-template-2025:$(dir $<):$$TEXINPUTS \ TEXINPUTS=./lib/cel-slides-template-2025:$$TEXINPUTS latexmk -pdflatex='pdflatex %O "\def\ishandout{1}\input{%S}"' $<
latexmk -outdir=build/$*_handout \ mv build/presentation.pdf $@
-pdflatex='$(RC_PDFLATEX) %O "\def\ishandout{1}\input{%S}"' $<
cp build/$*_handout/presentation.pdf $@
build/prepared: build/prepared:
mkdir build mkdir -p build
touch build/prepared touch build/prepared
.PHONY: clean .PHONY: clean

View File

@ -30,10 +30,7 @@
\usepackage{tikz} \usepackage{tikz}
\usepackage{tikz-3dplot} \usepackage{tikz-3dplot}
\usetikzlibrary{spy, external, intersections, positioning} \usetikzlibrary{spy, external, intersections, positioning}
%\tikzexternalize[prefix=build/]
\ifdefined\ishandout\else
\tikzexternalize
\fi
\usepackage{pgfplots} \usepackage{pgfplots}
\pgfplotsset{compat=newest} \pgfplotsset{compat=newest}
@ -142,7 +139,7 @@
\end{gather*} \end{gather*}
\vspace*{-2mm} \vspace*{-2mm}
\begin{gather*} \begin{gather*}
P_X(n) = \frac{\lambda^n}{n!}e^{-\lambda} \\[2mm] P_X(k) = \frac{\lambda^k}{k!}e^{-\lambda} \\[2mm]
\phi_X(s) = \text{exp}\left(\lambda (e^{js} -1)\right) \phi_X(s) = \text{exp}\left(\lambda (e^{js} -1)\right)
\end{gather*} \end{gather*}
\vspace*{-2mm} \vspace*{-2mm}
@ -163,7 +160,7 @@
\vspace*{-6mm} \vspace*{-6mm}
\begin{gather*} \begin{gather*}
X \sim \text{Poisson}(\lambda) \\[3mm] X \sim \text{Poisson}(\lambda) \\[3mm]
P_X(n) = \frac{\lambda^n \cdot e^{-\lambda}}{n!} \\[4mm] P_X(k) = \frac{\lambda^k \cdot e^{-\lambda}}{k!} \\[4mm]
\phi_X(s) = \text{exp}\left(\lambda (e^{js} -1)\right) \phi_X(s) = \text{exp}\left(\lambda (e^{js} -1)\right)
\end{gather*} \end{gather*}
\end{greenblock} \end{greenblock}
@ -171,7 +168,7 @@
\vspace*{-6mm} \vspace*{-6mm}
\begin{gather*} \begin{gather*}
\nsum_{k=0}^{n} \binom{n}{k}a^k b^{n-k} = (a+b)^n, \hspace{15mm} \nsum_{k=0}^{n} \binom{n}{k}a^k b^{n-k} = (a+b)^n, \hspace{15mm}
\binom{n}{k} = \frac{n!}{(n-k)!k!} \binom{n}{k} = \frac{n!}{(n-k!)k!}
\end{gather*} \end{gather*}
\end{greenblock} \end{greenblock}
\column{\kitthreecolumns} \column{\kitthreecolumns}
@ -231,11 +228,11 @@
zweier Zufallsvariablen. zweier Zufallsvariablen.
\pause\begin{gather*} \pause\begin{gather*}
X \sim \text{Poisson}(\lambda_1) \hspace{3mm} X \sim \text{Poisson}(\lambda_1) \hspace{3mm}
\Leftrightarrow \hspace{3mm} P_X(n) \Leftrightarrow \hspace{3mm} P_X(k)
= \frac{\lambda_1^n \cdot e^{-\lambda_1}}{n!} \hspace{30mm} = \frac{\lambda_1^k \cdot e^{-\lambda_1}}{k!} \hspace{30mm}
Y \sim \text{Poisson}(\lambda_2) \hspace{3mm} Y \sim \text{Poisson}(\lambda_2) \hspace{3mm}
\Leftrightarrow \hspace{3mm} P_Y(n) \Leftrightarrow \hspace{3mm} P_Y(k)
= \frac{\lambda_2^n \cdot e^{-\lambda_2}}{n!} = \frac{\lambda_2^k \cdot e^{-\lambda_2}}{k!}
\end{gather*} \end{gather*}
\pause\begin{align*} \pause\begin{align*}
P_Z(n) &= P_{X+Y}(n) = \nsum_{k=0}^{n} P_X(k)P_Y(n-k) P_Z(n) &= P_{X+Y}(n) = \nsum_{k=0}^{n} P_X(k)P_Y(n-k)
@ -419,7 +416,7 @@
\begin{lightgrayhighlightbox} \begin{lightgrayhighlightbox}
Erinnerung: Unabhängige Ereignisse Erinnerung: Unabhängige Ereignisse
\begin{align*} \begin{align*}
A,B \text{ \normalfont unabhängig} X,Y \text{ \normalfont unabhängig}
\hspace{5mm} \Leftrightarrow \hspace{5mm} \hspace{5mm} \Leftrightarrow \hspace{5mm}
P(AB) = P(A)P(B) P(AB) = P(A)P(B)
\end{align*} \end{align*}
@ -439,8 +436,7 @@
\begin{lightgrayhighlightbox} \begin{lightgrayhighlightbox}
Erinnerung: Varianz Erinnerung: Varianz
\begin{align*} \begin{align*}
V(X) = E\big( \left(X - E(X)\right)^2 \big) = V(X) = E\big( \left(X - E(X)\right)^2 \big) = E(X^2) - E^2(X)
E(X^2) - E^2(X)
\end{align*} \end{align*}
\vspace*{-13mm} \vspace*{-13mm}
\end{lightgrayhighlightbox} \end{lightgrayhighlightbox}

View File

@ -1,38 +0,0 @@
import numpy as np
import matplotlib.pyplot as plt
from numpy.typing import NDArray
import argparse
def twodim_array_to_pgfplots_table_string(a: NDArray):
return (
" \\\\\n".join([" ".join([str(vali) for vali in val]) for val in a]) + "\\\\\n"
)
def main():
# Parse command line arguments
parser = argparse.ArgumentParser()
parser.add_argument("--correlation", "-c", type=np.float32, required=True)
parser.add_argument("-N", type=np.int32, required=True)
parser.add_argument("--plot", "-p", action="store_true")
args = parser.parse_args()
# Generate & plot data
means = np.array([0, 0])
cov = np.array([[1, args.correlation], [args.correlation, 1]])
x = np.random.multivariate_normal(means, cov, size=args.N)
print(twodim_array_to_pgfplots_table_string(x))
if args.plot:
plt.scatter(x[:, 0], x[:, 1])
plt.show()
if __name__ == "__main__":
main()

View File

@ -1,40 +0,0 @@
import argparse
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import binom
def array_to_pgfplots_table_string(a):
return " ".join([f"({k}, {val})" for (k, val) in enumerate(a)]) + f" ({len(a)}, 0)"
def P_binom(N, p, k):
return binom(N, k) * p**k * (1 - p) ** (N - k)
def main():
# Parse command line arguments
parser = argparse.ArgumentParser()
parser.add_argument("-N", type=np.int32, required=True)
parser.add_argument("-p", type=np.float32, required=True)
parser.add_argument("--show", "-s", action="store_true")
args = parser.parse_args()
# Generate and show data
N = args.N
p = args.p
bars = np.array([P_binom(N, p, k) for k in range(N + 1)])
print(array_to_pgfplots_table_string(bars))
if args.show:
plt.stem(bars)
plt.show()
if __name__ == "__main__":
main()

File diff suppressed because it is too large Load Diff