From e39bbdf827003f784047535b249fa2492f0bd483 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Sat, 27 Oct 2018 16:57:32 +0200 Subject: [PATCH] Add dima u02 --- school/di-ma/uebung/02/02_1.tex | 136 ++++++++++++++++++++++++++++ school/di-ma/uebung/02/02_1.tex.old | 86 ++++++++++++++++++ school/di-ma/uebung/02/st.py | 36 ++++++++ 3 files changed, 258 insertions(+) create mode 100644 school/di-ma/uebung/02/02_1.tex create mode 100644 school/di-ma/uebung/02/02_1.tex.old create mode 100644 school/di-ma/uebung/02/st.py diff --git a/school/di-ma/uebung/02/02_1.tex b/school/di-ma/uebung/02/02_1.tex new file mode 100644 index 0000000..6242ba6 --- /dev/null +++ b/school/di-ma/uebung/02/02_1.tex @@ -0,0 +1,136 @@ +\documentclass[12pt,a4paper,german]{article} +\usepackage{url} +%\usepackage{graphics} +\usepackage{times} +\usepackage[T1]{fontenc} +\usepackage{ngerman} +\usepackage{float} +\usepackage{diagbox} +\usepackage[utf8]{inputenc} +\usepackage{geometry} +\usepackage{amsfonts} +\usepackage{amsmath} +\usepackage{csquotes} +\usepackage{graphicx} +\usepackage{epsfig} +\usepackage{paralist} +\geometry{left=2.0cm,textwidth=17cm,top=3.5cm,textheight=23cm} + +%%%%%%%%%% Fill out the the definitions %%%%%%%%% +\def \name {Valentin Brandl} % +\def \matrikel {108018274494} % +\def \pname {Marvin Herrmann} % +\def \pmatrikel {108018265436} % +\def \gruppe {2 (Mi 10-12 Andre)} +\def \uebung {2} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + % DO NOT MODIFY THIS HEADER +\newcommand{\hwsol}{ +\vspace*{-2cm} +\noindent \matrikel \quad \name \hfill \"Ubungsgruppe: \gruppe \\ +\noindent \pmatrikel \quad \pname \\ +\begin{center}{\Large \bf L\"osung f\"ur \"Ubung \# \uebung}\end{center} +} + +\begin{document} +%Import header +\hwsol + +\section*{Aufgabe 2.1} +\begin{enumerate}[1.] + \item Kekse $\widehat{=}$ Bälle (unterscheidbar, da \enquote{verschieden}), Portionen $\widehat{=}$ Urnen (nicht + unterscheidbar). $n = 9$, $k = 5$ + + Problem entspricht einer ungeordneten $k$-Mengenpartition, also $S_{n,k}$ + + \begin{eqnarray*} + S_{n,k} &=& S_{n-1,k-1} + k * S_{n-1,k} \text{ mit} \\ + S_{0,0} &=& 1 \\ + S_{n,n} &=& 1 \\ + S_{n,1} &=& 1 \\ + S_{n,0} &=& 0 \\\\ + S_{9,5} &=& 6951 + \end{eqnarray*} + + \item Bälle weiterhin unterscheidbar, Urnen jetzt auch unterscheidbar $\Rightarrow$ geordnete Mengenpartition. + + \begin{eqnarray*} + k! * S_{n.k} &=& 5! * S_{9,5} \\ + &=& 120 * 6951 \\ + &=& 834120 + \end{eqnarray*} + + \item Jetzt gilt Teller $\widehat{=}$ Ball, Keks $\widehat{=}$ Urne. $n = 5$, $k = 3$. + + Urnen sind unterscheidbar, \enquote{fünfgangiges Menü} $\Rightarrow$ Bälle sind auch untescheidbar + + \begin{eqnarray*} + n^{\underline{k}} &=& 5^{\underline{3}} \\ + &=& 5 * 4 * 3 \\ + &=& 60 + \end{eqnarray*} + +\end{enumerate} + +\section*{Aufgabe 2.2} +\begin{enumerate}[1.] + + \item Zyklenzerlegung: $(1\ 2\ 4) (3) (5\ 9) (6) (7\ 8)$ + + 2 Fixpunkte: $3$ und $6$ + + \item + \begin{eqnarray*} + s_{n.k} &=& s_{n-1,k-1} + (n-1)s_{n-1,k} \text{ mit} \\ + s_{0,0} &=& 1 \\ + s_{n,0} &=& 0 \\ + s_{n,n} &=& 1 \\\\ + s_{9,5} &=& 22449 + \end{eqnarray*} + +\end{enumerate} + +\section*{Aufgabe 2.3} +\begin{enumerate}[1.] + + \item + \begin{eqnarray*} + x_1 + x_2 + x_3 + x_4 + x_5 + x_6 &=& 67 \text{ mit } x_i \ge 0 \text{ für } 1 \le i \le 6 \\ + \text{Normalisierung:} \\ + \text{für } 1 \le i \le 3 \rightarrow x_i' &=& x_i - 1 \text{ (ungerade Zahlen werden gerade)} \\ + \text{für } 4 \le i \le 6 \rightarrow x_i' &=& x_i \\ + \Rightarrow x_1' + x_2' + x_3' + x_4' + x_5' + x_6' &=& 64 \\ + \text{für } 1 \le i \le 6 \rightarrow y_i &=& \frac{x_i'}{2} + \text{ (Bedingung \enquote{alle Zahlen gerade} erfüllt)} \\ + \Rightarrow y_1 + y_2 + y_3 + y_4 + y_5 + y_6 &=& 32 \\ + \text{für } 1 \le i \le 6 \rightarrow z_i &=& y_i + 1 \\ + \Rightarrow z_1 + z_2 + z_3 + z_4 + z_5 + y_6 &=& 38 \\\\ + \Rightarrow \binom{n-1}{k-1} &=& \binom{37}{5} = 435897 + \end{eqnarray*} + + \item + \begin{eqnarray*} + P_{n,k} &=& P_{n-1,k-1} + P_{n-k,k} \text{ mit} \\ + P_{n.0} &=& 0 \\ + P_{n.n} &=& 1 \\ + P_{n.1} &=& 1 \\\\ + P_{10,4} &=& 9 + \end{eqnarray*} + +\end{enumerate} + +\section*{Aufgabe 2.4} + +\begin{itemize} + + \item Nur Schritte nach rechts oder oben sind erlaubt + + \item Insgesamt $n$ Schritte nach oben und $k$ Schritte nach rechts + + \item $\Rightarrow \frac{(n + k)!}{n! k!} = \binom{n + k}{k}$ + +\end{itemize} + +\end{document} + diff --git a/school/di-ma/uebung/02/02_1.tex.old b/school/di-ma/uebung/02/02_1.tex.old new file mode 100644 index 0000000..d1e6855 --- /dev/null +++ b/school/di-ma/uebung/02/02_1.tex.old @@ -0,0 +1,86 @@ +\documentclass[12pt,a4paper,german]{article} +\usepackage{url} +%\usepackage{graphics} +\usepackage{times} +\usepackage[T1]{fontenc} +\usepackage{ngerman} +\usepackage{float} +\usepackage{diagbox} +\usepackage[utf8]{inputenc} +\usepackage{geometry} +\usepackage{amsfonts} +\usepackage{amsmath} +\usepackage{csquotes} +\usepackage{graphicx} +\usepackage{epsfig} +\usepackage{paralist} +\geometry{left=2.0cm,textwidth=17cm,top=3.5cm,textheight=23cm} + +%%%%%%%%%% Fill out the the definitions %%%%%%%%% +\def \name {Valentin Brandl} % +\def \matrikel {108018274494} % +\def \pname {Marvin Herrmann} % +\def \pmatrikel {108018265436} % +\def \gruppe {2 (Mi 10-12 Andre)} +\def \uebung {2} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + % DO NOT MODIFY THIS HEADER +\newcommand{\hwsol}{ +\vspace*{-2cm} +\noindent \matrikel \quad \name \hfill \"Ubungsgruppe: \gruppe \\ +\noindent \pmatrikel \quad \pname \\ +\begin{center}{\Large \bf L\"osung f\"ur \"Ubung \# \uebung}\end{center} +} + +\begin{document} +%Import header +\hwsol + +\section*{Aufgabe 2.1} +\begin{enumerate}[1.] + \item Kekse $\widehat{=}$ Bälle (unterscheidbar, da \enquote{verschieden}), Portionen $\widehat{=}$ Urnen (nicht + unterscheidbar). $n = 9$, $k = 5$ + + Problem entspricht einer ungeordneten $k$-Mengenpartition, also $S_{n,k}$ + + \begin{eqnarray*} + S_{n,k} &=& S_{n-1,k-1} + k * S_{n-1,k} \text{ mit} \\ + S_{0,0} &=& 1 \\ + S_{n,n} &=& 1 \\ + S_{n,1} &=& 1 \\ + S_{n,2} &=& 2^{n-1} - 1 \\ + S_{n,3} &=& \frac{1}{2}(3^{n-1} - 2^n + 1) \\ + S_{n,0} &=& 0 \\\\ + S_{9,5} &=& S_{8,4} + 5 * S_{8,5} \\ + &=& (S_{7,3} + 4 * S_{7,4}) + 5 * (S_{7,4} + 5 * S_{7,5}) \\ + &=& ((S_{6,2} + 3 * S_{6.3}) + 4 * (S_{6,3} + 4 * S_{6,4})) + 5 * ((S_{6,3} + 4 * S_{6,4}) + 5 * + (S_{6,4} + 5 * S_{6,5})) \\ + &=& ((32 + 3 * 90) + 4*(90 + 4*(S_{5,3} + 4*S_{5,4}))) + 5 * ((90 + 4*(S_{5,3} + 4*S_{5,4})) \\ + &&+ 5*((S_{5,3}+ 4*S_{5,4}) + 5*(S_{5,4} + 5*S_{5,5}))) \\ + &=& (302 + 4*(90+4*(57 + 4*(S_{4,3} + 4*S_{4,4})))) \\ + &&+ 5*((90+4*(57 + 4*(S_{4,3} + 4*S_{4,4}))) \\ + &&+ 5*((57 + 4*(S_{4,3} + 4*S_{4,4})) + 5 * ((S_{4,3} + 4*S_{4,4}) + 5 * 1))) \\ + &=& (302 + 4*(90 + 4*(57 + 4*(22 + 4*1)))) \\ + && + 5*((90 + 4*(57 + 4*(22 + 4*1)))) \\ + && + 5 * ((57 + 4*(22 + 4*1)) + 5*((22 + 4*1) + 5)) \\ + &=& 3238 + 3670 + 1580 \\ + &=& 8488 + \end{eqnarray*} + + \item Bälle weiterhin unterscheidbar, Urnen jetzt auch unterscheidbar $\Rightarrow$ geordnete Mengenpartition. + + \begin{eqnarray*} + k! * S_{n.k} &=& 5! * S_{9,5} \\ + &=& 120 * 8488 \\ + &=& 1018560 + \end{eqnarray*} + + \item Jetzt gilt Teller $\widehat{=}$ Ball, Keks $\widehat{=}$ Urne. $n = 5$, $k = 3$. + + Urnen sind unterscheidbar, \enquote{fünfgangiges Menü} $\Rightarrow$ Bälle sind auch untescheidbar + +\end{enumerate} + +\end{document} + diff --git a/school/di-ma/uebung/02/st.py b/school/di-ma/uebung/02/st.py new file mode 100644 index 0000000..b04a7e3 --- /dev/null +++ b/school/di-ma/uebung/02/st.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +def p(n,k): + if k == 0: + return 0 + elif n == k or k == 1: + return 1 + elif n < k: + return 0 + else: + return p(n-1,k-1) + p(n-k,k) + +def s(n,k): + if n == k: + return 1 + elif k == 0: + return 0 + elif n < k: + return 0 + else: + return s(n-1,k-1) + (n-1)*s(n-1,k) + +def S(n, k): + if n == k: + return 1 + elif k == 1: + return 1 + elif k == 0: + return 0 + elif n < k: + return 0 + else: + return S(n-1,k-1) + k * S(n-1,k) + +# print(S(9,5)) +print(p(10,4))