BwInf37-Runde2-Aufgabe1/DokumentationAufgabe1.tex

158 lines
4.4 KiB
TeX
Raw Normal View History

2019-01-30 14:38:04 +00:00
\documentclass[a4paper,10pt,ngerman]{scrartcl}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[a4paper,margin=2.5cm]{geometry}
% automatische Quotes
\usepackage{csquotes}
\MakeOuterQuote{"}
% Die nächsten drei Felder bitte anpassen:
\newcommand{\Name}{Arne Keller} % Teamname oder eigenen Namen angeben
\newcommand{\TeilnahmeId}{50966}
\newcommand{\Aufgabe}{Aufgabe 1: Lisa rennt}
% Kopf- und Fußzeilen
\usepackage{scrlayer-scrpage, lastpage}
\setkomafont{pageheadfoot}{\textrm}
\lohead{\Aufgabe}
\chead{\thepage{}/\pageref{LastPage}}
\rohead{\Name/Teilnahme-Id: \TeilnahmeId}
\cfoot{}
% Für mathematische Befehle und Symbole
\usepackage{amsmath,amsthm,amssymb}
% Für Bilder
\usepackage{graphicx,subcaption,float}
\usepackage{tkz-euclide}
\usetkzobj{all}
% Für Algorithmen
%\usepackage{algpseudocode}
% Für Quelltext
\usepackage{listings}
\usepackage{color}
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\lstset{
keywordstyle=\color{blue},commentstyle=\color{mygreen},
stringstyle=\color{mymauve},rulecolor=\color{black},
basicstyle=\footnotesize\ttfamily,numberstyle=\tiny\color{mygray},
captionpos=b, % sets the caption-position to bottom
keepspaces=true, % keeps spaces in text
numbers=left, numbersep=5pt, showspaces=false,showstringspaces=false,
showtabs=false, stepnumber=2, tabsize=2, title=\lstname
}
\lstdefinelanguage{Rust}{
keywords={break, match, continue, else, for, fn, if, return, self, let, mut, loop, while, extern, crate, use, static, enum, struct, impl, as, type, derive, mod},
morecomment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]",
sensitive=true
}
% Diese beiden Pakete müssen als letztes geladen werden
%\usepackage{hyperref} % Anklickbare Links im Dokument
%\usepackage{cleveref}
% Daten für die Titelseite
\title{\Aufgabe}
\author{\Name\\Teilnahme-ID: \TeilnahmeId}
\date{29. April 2019}
\begin{document}
\maketitle
\tableofcontents
\section{Lösungsidee}
Zunächst kann man feststellen, dass der letzte Abschnitt jeder Route zum Bus immer exakt gerade ist. In einer Kurve würde Lisa weiter laufen, ohne am Ende auf der y-Achse weiter zu sein. Es gibt keinen, einen oder zwei Treffpunkte, bei denen Lisa (ohne zu warten) den Bus erwischt:
\begin{figure}[H]
\centering
\begin{subfigure}{.33\textwidth}
\centering
\begin{tikzpicture}
\tkzInit[xmax=3.5,ymax=7.5]
\tkzAxeXY
\tkzGrid
\tkzDefPoint(0,0){B}
\tkzDefPoint(1.25,3.5){L}
\tkzDefPoint(0,2.83333){M1}
\tkzDefPoint(0,6.5){M2}
\tkzDrawSegment(L,M1)
\tkzDrawSegment(L,M2)
\tkzDrawPoints(B,L,M1,M2)
\tkzLabelPoints(B,L,M1,M2)
\end{tikzpicture}
\caption{Zwei Treffpunkte}
\label{abb:fall1}
\end{subfigure}%
\begin{subfigure}{.33\textwidth}
\centering
\begin{tikzpicture}
\tkzInit[xmax=3.5,ymax=7.5]
\tkzAxeXY
\tkzGrid
\tkzDefPoint(0,0){B}
\tkzDefPoint(2.020725942,3.5){L}
\tkzDefPoint(0,4.614){M}
\tkzDrawSegment(L,M)
\tkzDrawPoints(B,L,M)
\tkzLabelPoints[yshift=14pt](M)
\tkzLabelPoints(B,L)
\end{tikzpicture}
\caption{Ein Treffpunkt}
\label{abb:fall1}
\end{subfigure}%
\begin{subfigure}{.33\textwidth}
\centering
\begin{tikzpicture}
\tkzInit[xmax=3.5,ymax=7.5]
\tkzAxeXY
\tkzGrid
\tkzDefPoint(0,0){B}
\tkzDefPoint(3,3.5){L}
\tkzDrawPoints(B,L)
\tkzLabelPoints(B,L)
\end{tikzpicture}
\caption{Kein Treffpunkt}
\label{abb:fall1}
\end{subfigure}
\caption{Mögliche Treffpunktanzahlen}
\label{fig:treffpunkte}
\end{figure}
\begin{proof}
Sei Lisa bei $L(x_{L},y_{L})$ und der Bus bei $B(x_{B},y_{B})$. $M(x_{M},y_{M})$ sei der Treffpunkt von Lisa mit dem Bus. $d$ sei der Weg, den Lisa zu diesem Punkt geht.
\begin{align*}
d &= \sqrt{(x_{L}-x_{M})^2 + (y_{L}-y_{M})^2} &&\text{(Satz des Pythagoras)} \\
&= \sqrt{x_{L}^2 + (y_{L}-y_{M})^2} &&\text{($x_{B} = x_{M} = 0$)} \\
d^2 &= x_{L}^2 + (y_{L}-y_{M})^2 \\
&= x_{L}^2 + (y_{L}-y_{B}-2d)^2 &&\text{($y_{M} = y_{B} + 2d$)} \\
&= x_{L}^2 + y_{L}^2 + y_{B}^2 + 4d^2 - 2y_{B}y_{M} - 4dy_{L} + 4dy_{B} \\
-3d^2 + 4\cdot(y_{B}-y_{L})\cdot{}d &= x_{L}^2 + y_{L}^2 + y_{B}^2 - 2y_{B}y_{M} \\
d &= \frac{a\pm\sqrt{a^2 + 12\cdot{}(-x_{L}^2 - y_{L}^2 - y_{B}^2 + 2y_{B}y_{M})}}{-6} &&\text{($a = 4\cdot(y_{B}-y_{L})$)}\qedhere
\end{align*}
\end{proof}
Für diese Gleichung gibt es maximal zwei nicht-negative Lösungen.
\section{Umsetzung}
\section{Beispiele}
\section{Quellcode}
\lstinputlisting[frame=single,language=Rust,breaklines=true]{src/main.rs}
\end{document}