\documentclass[10pt]{beamer}

\mode<presentation>
{
 \usetheme{Boadilla}
\pagestyle{empty}

\setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries}
\setbeamerfont*{block}{size=\normalsize,series=\bfseries}
%\setbeamertemplate{blocks}[rounded][shadow=true]
}

\definecolor{links}{HTML}{2A1B81}
\hypersetup{colorlinks,linkcolor=,urlcolor=links}

\usepackage{etex}
% \usepackage{helvet}
\usepackage{amsmath, amssymb}
\usepackage{color}
%\usepackage{asymptote}
\usepackage{mathrsfs}
\usepackage{dsfont}

\usepackage{pst-sigsys,pst-plot,pstricks-add}
%\usepackage{auto-pst-pdf}
\usepackage{pst-pdf}

\definecolor{links}{HTML}{2A1B81}
\hypersetup{colorlinks,linkcolor=,urlcolor=links}

\def\nn{\nonumber}

\definecolor{links}{HTML}{2A1B81}
\hypersetup{colorlinks,linkcolor=,urlcolor=links}

\newcommand{\fs}[2]{#2}

\title[]{Introduction to Systems.}
\author[\textcolor{blue}{Systems and Circuits}]{\textcolor{darkblue}{Pablo M. Olmos} (olmos@tsc.uc3m.es)\\ \textcolor{darkblue}{Emilio Parrado} (emipar@tsc.uc3m.es)}
\institute{\textcolor{white}{UC3M}}

\definecolor{darkblue}{rgb}{0.0, 0.0, 0.40}
\setbeamercolor{title}{fg=darkblue}
\setbeamercolor{frametitle}{fg=darkblue}
\definecolor{darkgreen}{rgb}{0.0, 0.4, 0.0}

\AtBeginSection[]
{
  \begin{frame}<beamer>{Index}
    \tableofcontents[currentsection,currentsubsection]
  \end{frame}
}

\begin{document}
\frame{
\titlepage
\thispagestyle{empty}
\begin{center}
\includegraphics[scale=0.05]{Figures/uc3m-logo.pdf}
\end{center}
}

\frame{

\frametitle{Systems}
\begin{itemize}
\item \textbf{System: Any process that results in the transformations of signals}.
\item Systems can model the behavior of a chemical process, a hydraulic system, an electric circuit, a communication channel, ...
\end{itemize}

}

\frame{
\frametitle{Microphone (transducer)}
\begin{figure}
\centering\includegraphics[scale=0.6]{Figures/Signal21.pdf}
\caption{Voice (pressure) signal $\Rightarrow$ Voltage signal}
\end{figure}
}

%\frame{
%\frametitle{Amplifer}
%\begin{figure}
%\centering\includegraphics[scale=0.4]{Figures/Signal19.pdf}
%\end{figure}
%}

\frame{
\frametitle{Communication channel}
\begin{figure}
\centering\includegraphics[scale=0.5]{Figures/Signal22.pdf}
\end{figure}
}

\frame{
\frametitle{Seismic analysis and earthquake prevention}
\begin{figure}
\centering\includegraphics[scale=0.5]{Figures/Signal24.pdf}
\end{figure}
\begin{itemize}
\item The building can be seen as a system.
\item Input signal: seismic (sinusoidal) wave with amplitude $A$ and angular frequency $\omega$.
\item Output signal: Building curvature and displacement.
\end{itemize}
}

\frame{
\frametitle{Electric Circuits}
\begin{figure}
\centering\includegraphics[scale=0.4]{Figures/Signal29.pdf}
\end{figure}
\begin{itemize}
\item Voltages and currents as a function of time in an electrical circuit are examples of signals.
\item A circuit is itself an example of a system, which responds to applied input voltage/current signals.
\end{itemize}

}

\frame{
\frametitle{Motivation: Image Filtering}

\begin{figure}
\includegraphics[scale=0.3]{Filtro_1.png}
\end{figure}

}

\frame{
\frametitle{Image Filtering}

\begin{figure}
\includegraphics[scale=1.0]{2D_1.pdf}
\end{figure}

\begin{align*}
Y[1,1]&=X[1,1]*K[1,1]+X[1,2]*K[1,2]+X[1,3]*K[1,3]\\
&+X[2,1]*K[2,1]+X[2,2]*K[2,2]+X[2,3]*K[2,3]\\
&+X[3,1]*K[3,1]+X[3,2]*K[3,2]+X[3,3]*K[3,3]
\end{align*}
}

\frame{
\frametitle{Image Filtering}

\begin{figure}
\includegraphics[scale=1.0]{2D_2.pdf}
\end{figure}

\begin{align*}
Y[1,2]&=X[1,2]*K[1,1]+X[1,3]*K[1,2]+X[1,4]*K[1,3]\\
&+X[2,2]*K[2,1]+X[2,3]*K[2,2]+X[2,4]*K[2,3]\\
&+X[3,2]*K[3,1]+X[3,3]*K[3,2]+X[3,4]*K[3,3]
\end{align*}
}

\frame{
\frametitle{Image Filtering}

\begin{figure}
\includegraphics[scale=1.0]{2D_1.pdf}
\end{figure}

\begin{align*}
Y[i,j]&=\sum_{k_1=1}^{n}\sum_{k_2=1}^{n} X[k_1,k_2]K[i-k_1,j-k_2], ~~~ K[u,q]=0 \text{ para } u>3, q>3
\end{align*}

{\bf Linear operator, the result does not depend on the position of the image}
}

\frame{
\frametitle{Image Filtering}

\begin{figure}
\includegraphics[scale=0.3]{Filtro_1.png}
\end{figure}

}

\frame{
\frametitle{Image Filtering}

\begin{figure}
\includegraphics[scale=0.3]{Filtro_2.png}
\end{figure}

}

\frame{
\frametitle{Image Filtering}

\begin{figure}
\includegraphics[scale=0.3]{Filtro_3.png}
\end{figure}

}

\section{Continuous-time and discrete-time systems}

\frame{

\begin{center}
\begin{tabular}{c}
\begin{pspicture}[](6,2)
   \pssignal(0,1){x}{$x(t)$}
   \psblock(3,1){a}{Continuous-time System}
   %\psblock(4,1){b}{$h[n], H(z)$}
   \pssignal(6,1){y}{$y(t)$}
   %-----------------
   \psset{arrows=->}
   \ncline{x}{a}  \ncline{a}{y}  %\ncline{b}{y}
\end{pspicture}
\\\\\\
\begin{pspicture}[](6,2)
   \pssignal(0,1){x}{$x[n]$}
   \psblock(3,1){a}{Discrete-time System}
   %\psblock(4,1){b}{$h[n], H(z)$}
   \pssignal(6,1){y}{$y[n]$}
   %-----------------
   \psset{arrows=->}
   \ncline{x}{a}  \ncline{a}{y}  %\ncline{b}{y}
\end{pspicture}
\end{tabular}
\end{center}

Symbolically, we represent a system as:
\begin{align}\nn
x(t)\rightarrow y(t)\\\nn
x[n]\rightarrow y[n]
\end{align}

}

\frame{
\frametitle{Interconnection of systems}

Complex system composed of the interconnection of simpler systems:

\begin{center}
\begin{tabular}{c}
\textbf{Cascade interconnection}\\\\
\begin{pspicture}[](8,2)
   \pssignal(0,1){x}{Input}
   \psblock(2,1){a}{System 1}
   \psblock(5,1){b}{System 2}
   \pssignal(8,1){y}{Output}
   %-----------------
   \psset{arrows=->}
   \ncline{x}{a}  \ncline{a}{b}  \ncline{b}{y}
\end{pspicture}
\\\\
\textbf{Parallel interconnection}\\\\
\begin{pspicture}[](6.5,2)
  %
   \pssignal(0,1){x}{Input}
   \pnode(1,1){b}
   \pnode(1,2){c}
   \pnode(1,0){d}
   \psblock(3,2){e}{System 1}
   \psblock(3,0){f}{System 2}
   \pnode(5,2){g}
   \pnode(5,0){h}
   \pscircleop(5,1){oplus}
   \pssignal(6.25,1){i}{Output}
   \ncline{x}{b}  \ncline{b}{c}  \ncline{b}{d}
    \ncline{e}{g} \ncline{f}{h}
    \psset{style=RoundCorners ,style=Arrow}
     \ncline{c}{e} \ncline{d}{f}
   \ncline{g}{oplus}  \ncline{h}{oplus} \ncline{oplus}{i}
\end{pspicture}
\end{tabular}
\end{center}

}

\frame{
\frametitle{Interconnection of systems}

\begin{center}
\begin{tabular}{c}
\textbf{Series/Parallel interconnection}\\\\
\begin{pspicture}[](8,2)

   \pssignal(0,1){x}{Input}
   \pnode(1,1){b}
   \pnode(1,2){c}
   \pnode(1,0){d}
   \psblock(2.5,2){e}{System 1}
   \psblock(5,2){j}{System 2}
   \psblock(4,0){f}{System 3}
   \pnode(6.5,2){g}
   \pnode(6.5,0){h}
   \pscircleop(6.5,1){oplus}
   \pssignal(8,1){i}{Output}

   %Conexiones
   \ncline{x}{b}  \ncline{b}{c}  \ncline{b}{d}
     \ncline{f}{h} \ncline{j}{g}
   \psset{style=RoundCorners ,style=Arrow}
     \ncline{c}{e} \ncline{d}{f}
   \ncline{g}{oplus}  \ncline{h}{oplus} \ncline{oplus}{i}
   \ncline{e}{j}
\end{pspicture}
\end{tabular}
\end{center}

\begin{block}{}
In general, the order is NOT interchangeable.
\end{block}

}

\frame{
\begin{align}\nn
y[n]=(2x[n]-x^2[n])^2
\end{align}
\vspace{1cm}

\begin{center}
\begin{pspicture}[](7.5,2)

   \pssignal(0,1){x}{$x[n]$}
   \pnode(1,1){b}
   \pnode(1,2){c}
   \pnode(1,0){d}
   \psblock(3,2){e}{Multiply by 2}
   \psblock(3,0){f}{Square}
   \pnode(5,2){g}
   \pnode(5,0){h}
   \pscircleop(5,1){oplus}
   \psblock(6.25,1){j}{Square}
   \pssignal(8.25,1){i}{$y[n]$}
   \ncline{x}{b}  \ncline{b}{c}  \ncline{b}{d}
    \ncline{e}{g} \ncline{f}{h}
   \psset{style=RoundCorners ,style=Arrow}
     \ncline{c}{e} \ncline{d}{f}
      \ncline{oplus}{j} \ncline{j}{i}
   \ncstar{->}{ncline}[naput]{h -}{oplus} %\ncline{h}{oplus}
   \ncline{g}{oplus}
\end{pspicture}
\end{center}

}

\frame{
\frametitle{Problem 31}

Consider the following interconnection of systems:

\begin{center}
\begin{pspicture}[](8,2)
   \pssignal(0,1){x}{$x(t)$}
   \pnode(1,1){b}
   \pnode(1,2){c}
   \pnode(1,0){d}
   \psblock(2.5,2){e}{$T_1$}
   \psblock(5,2){j}{$T_2$}
   \psblock(4,0){f}{$T_3$}
   \pnode(6.5,2){g}
   \pnode(6.5,0){h}
   \pscircleop(6.5,1){oplus}
   \pssignal(8,1){i}{$y(t)$}
   %Conexiones
   \ncline{x}{b}  \ncline{b}{c}  \ncline{b}{d}
     \ncline{f}{h} \ncline{j}{g}
   \psset{style=RoundCorners ,style=Arrow}
     \ncline{c}{e} \ncline{d}{f}
   \ncline{g}{oplus}  \ncline{h}{oplus} \ncline{oplus}{i}
   \ncline{e}{j}
\end{pspicture}
\end{center}
where $T_1: y(t)=2x(t-2)$, $T_2: y(t)=dx(t-2)/dt$ and $T_3: y(t)=x(-t+1)$.
\begin{enumerate}[a)]
\item Determine the system input-output relationship.
\item Compute the system response when $x(t)=u(t)$.
\end{enumerate}

}

\frame{
Sol:

\begin{center}
\begin{pspicture}[](8,2)

   \pssignal(0,1){x}{$x(t)$}
   \pnode(1,1){b}
   \pnode(1,2){c}
   \pnode(1,0){d}
   \psblock(2.5,2){e}{$T_1$}
   \psblock(5,2){j}{$T_2$}
   \psblock(4,0){f}{$T_3$}
   \pnode(6.5,2){g}
   \pnode(6.5,0){h}
   \pscircleop(6.5,1){oplus}
   \pssignal(8,1){i}{$y(t)$}
      \pssignal(3.75,2.3){}{$e(t)$}
   \pssignal(6,2.3){}{$w(t)$}
   \pssignal(6,-0.3){}{$r(t)$}
   %Conexiones
   \ncline{x}{b}  \ncline{b}{c}  \ncline{b}{d}
     \ncline{f}{h} \ncline{j}{g}
   \psset{style=RoundCorners ,style=Arrow}
     \ncline{c}{e} \ncline{d}{f}
   \ncline{g}{oplus}  \ncline{h}{oplus} \ncline{oplus}{i}
   \ncline{e}{j}
\end{pspicture}
\end{center}

\begin{align*}
&e(t)=2x(t-2)\Rightarrow ~ w(t)=\frac{de(t-2)}{d t}=2\frac{dx(t-4)}{d t}\\
&r(t)=x(-t+1)
%&\Rightarrow y(t)=2\frac{dx(t-4)}{d t}+x(-t+1)
\end{align*}

\begin{exampleblock}{For $x(t)=u(t)$}
\begin{align*}
y(t)=2\frac{dx(t-4)}{d t}+x(-t+1)= 2 \delta(t-4)+u(-t+1)
\end{align*}
\end{exampleblock}

}

\section{Properties of systems}

\frame{
\frametitle{Systems with and without memory}

\begin{exampleblock}{}
A system $x(t)\rightarrow y(t)$ is said to be memoryless if the output $y(t_0)$ a one time instant $t_0$ only depends on the input at the same time instant, i.e.,  $x(t_0)$.
\end{exampleblock}

\textbf{Examples:}

\begin{itemize}
\item $y[n]=(2x[n]-x[n]^2)^2$ is memoryless.
\item $y(t)=x(t-1)$ is a system with memory.
\item $y(t)=x(t-3)x(t+2)$ is a system with memory.
\end{itemize}

}

\frame{
\frametitle{$y(t)=\frac{\partial x(t)}{\partial t}$ is a system \textcolor{red}{\textbf{with memory}}.}

\begin{align*}
y(t)=\frac{\partial x(t)}{\partial t}\doteq \lim_{\Delta\rightarrow 0}\frac{x(t+\Delta)-x(t)}{\Delta}
\end{align*}

\begin{itemize}
\item We need $x(t+\Delta)$!
\item The system has memory!
\end{itemize}

}

\frame{
\frametitle{Invertibility and inverse systems}

\begin{block}{}
\begin{itemize}
\item A system is said to be invertible if distinct inputs lead to distinct outputs.
\item By observing its output, we can determine its input.
\end{itemize}
\end{block}

\begin{tabular}{c}
\\\\
\begin{pspicture}[](9,2)
   \pssignal(0,1){x}{$x(t)$}
   \psblock(2,1){a}{$y(t)=2x(t)$}
   \psblock(5.5,1){b}{$z(t)=\frac{1}{2}y(t)$}
   \pssignal(8.25,1){y}{$x(t)$}
   %-----------------
   \psset{arrows=->}
   \ncline{x}{a}   \ncline{b}{y}
   \ncstar{->}{ncline}[naput]{a $y(t)$}{b} %\ncline{h}{oplus}
\end{pspicture}
\\\\
\begin{pspicture}[](13,2)
   \pssignal(0,1){x}{$x[n]$}
   \psblock(3,1){a}{$y[n]=\sum_{k=-\infty}^{n}x[k]$}
   \psblock(8,1){b}{$z[n]=y[n]-y[n-1]$}
   \pssignal(11,1){y}{$x[n]$}
   %-----------------
   \psset{arrows=->}
   \ncline{x}{a}   \ncline{b}{y}
    \ncstar{->}{ncline}[naput]{a $y[n]$}{b} %\ncline{h}{oplus}
\end{pspicture}
\end{tabular}
}

\frame{

Are invertible the following systems?

\begin{itemize}
\item $y[n]=x[2n]$
\item $y(t)=x(2t)$
\item $y(t)=x^{2}(t)$
\end{itemize}

}

\frame{
\frametitle{Problem 33}

Consider the following discrete-time system
\begin{align*}
y[n]=x[n]x[n-2]
\end{align*}
\begin{enumerate}[a)]
\item Is the system memoryless?
\item Determine the system response when the input is $x[n]=A\delta[n]$, where $A\in\mathbb{C}$.
\item Is the system invertible?
\end{enumerate}

}

\frame{
\frametitle{Causality}

\begin{exampleblock}{}
\begin{itemize}
\item A system is causal if the output at any time depends only on values of the input at the present time and in the past.
%\item A causal system is also referred to as nonanticipative.
\item $y(t)=f(x(t))$ is causal if $y(t_0)$ only depends on $x(t)$ for $t\leq t_0$.
\item $y[n]=f(x[n])$ is causal if $y[n_0]$ only depends on $x[n]$ for $n\leq n_0$.
\item Memoryless systems are always causal.
\end{itemize}
\end{exampleblock}

}

\frame{
Are the following systems causal?
\begin{itemize}
\item $y[n]=x[n]-x[n+1]$
\item $y(t)=x(t+1)$
\item $y[n]=\text{Even}(x[n-1])$?
\item $y(t)=x(\sin(t))$
\end{itemize}

}

\frame{
\frametitle{Stability}

\begin{exampleblock}{Bounded signal}
Consider an input signal $x(t)$ that verifies
\begin{align*}
|x(t)|\leq B~~\forall t
\end{align*}
for some real constant $B$. We say $x(t)$ is a bounded signal.
\end{exampleblock}

\begin{block}{Bounded Input, Bounded Output (BIBO) stability}
A given system $x(t)\rightarrow y(t)$ is \textbf{BIBO stable} if there exists a real constant $C$ for which
\begin{align*}
|y(t)|\leq C ~~\forall t
\end{align*}
for any input signal $x(t)$ that is bounded.
\end{block}
Same definition holds for discrete-time systems.

}

\frame{

Determine whether the following systems are stable:
\begin{align*}
y(t)&=x(t/3)\\\\
y[n]&=nx[n]\\\\
y(t)&=\int_{t-2}^{t-1}x^3(\tau)d\tau\\\\\
y[n]&=\sum_{k=-\infty}^{n}(1/2)^{n-k} x[k]
\end{align*}

}

\frame{
\frametitle{Time Invariance}

\begin{block}{}
A system is time-invariant if a time shift in the input signal causes a time shift in the output signal.
\end{block}
\vspace{0.5cm}

\begin{itemize}
\item If $y[n]=f(x[n])$, the system is invariant if $f(x[n-n_0])=y[n-n_0]$.
\item If $y(t)=f(x(t))$, the system is invariant if $f(x(t-t_0))=y(t-t_0)$.
\end{itemize}
}

\frame{
\frametitle{$y(t)=\sin(x(t))$}

Let $x_1(t)$ be the input:
\begin{align}\nn
y_1(t)=\sin(x_1(t)).
\end{align}
Define $x_2(t)=x_1(t-t_0)$:
\begin{align}\nn
y_2(t)=\sin(x_2(t))=\sin(x_1(t-t_0))=y_1(t-t_0).
\end{align}
The system is time-invariant.

}

\frame{
\frametitle{$y[n]=nx[n]$}
Let $x_1[n]$ be the input:
\begin{align}\nn
y_1[n]=nx_1[n].
\end{align}
Define $x_2[n]=x_1[n-n_0]$:
\begin{align}\nn
&y_2[n]=nx_2[n]=nx_1[n-n_0]\\\nn
 &y_1[n-n_0]=(n-n_0)x_1[n-n_0].
\end{align}
Therefore
\begin{align*}
y_1[n-n_0]�~~\mathbf{\neq}~~ y_2[n]
\end{align*}
The system is NOT time-invariant.

}

\frame{
\frametitle{Linearity}
Linear systems posse the important property of \textbf{superposition}.

\begin{exampleblock}{}
 For any system, consider two arbitrary inputs and their respective outputs:
\begin{align}\nn
x_1(t)\rightarrow y_1(t)\\\nn
x_2(t)\rightarrow y_2(t),
\end{align}
the system is linear if
\begin{align}\nn
ax_1(t)+bx_2(t)\rightarrow ay_1(t)+by_2(t)
\end{align}
for any two complex constants $a,b\in\mathbb{C}$.
\end{exampleblock}

\begin{block}{Linear discrete-time signals}
\begin{align}\nn
ax_1[n]+bx_2[n]\rightarrow ay_1[n]+by_2[n]
\end{align}
\end{block}

}

\frame{
The systems
\begin{align}\nn
y[n]=(x[n])^{2},\\\nn
y[n]=\exp(x[n]),
\end{align}
are not linear.
\vspace{0.5cm}

The system
\begin{align}\nn
y[n]=x[n]-x[n-3]+4x[n-8]
\end{align}
is linear.

}

%\frame{
%Videos about signals and systems with examples (University of Arizona State):
%
%\begin{exampleblock}{}
%\url{https://sites.google.com/a/asu.edu/signals-and-systems/\#TOC-System-Properties}
%\end{exampleblock}
%
%}

\end{document}

Slides Systems_Circuits/M_7_Introduction to Systems/Intro_Systems.tex


\documentclass[12pt]{article}

% packages
\usepackage{enumitem} % enumerations
\usepackage{fancyhdr} % header
\usepackage[a4paper, margin=2.5cm]{geometry} % customize page
\usepackage[colorlinks=true]{hyperref} % links
\usepackage{xcolor} % colors

% header
\pagestyle{fancy}
\fancyhead[L]{\textbf{Exercise Sheet 2: Classification}}
\fancyhead[R]{Data Science 1 -- Winter 21/22}

% colors and commands
\definecolor{kitgreen}{HTML}{00876C}
\definecolor{kitblue}{HTML}{4664AA}

\hypersetup{allcolors=kitblue}

\newcommand{\code}[1]{\textcolor{kitgreen}{\texttt{#1}}}
\newcommand{\taskname}[1]{\textcolor{kitblue}{\textbf{[#1]}}}

\begin{document}

\section*{Setup}

Compared to the previous exercise sheet, you don't need to install any further packages.
We will work with \code{matplotlib}, \code{pandas}, and \code{scikit-learn}.

\section*{Task: Classification and Evaluation}

The aim of this exercise is to classify data with decision trees and to evaluate the results.
To this end, we use the \code{iris} dataset from \code{sklearn.datasets} again.
The type of flower, i.e., the species, is our target variable.

If you want, you can also try one or several of the other classification models and evaluation measures introduced in the lecture.
\code{scikit-learn} contains implementations of many of them, and the workflow is similar to the one we apply here.

\begin{enumerate}[label=\alph*), left=0pt, itemsep=12pt]
	\item
	\taskname{Training}
	Create an object of class \code{DecisionTreeClassifier} from the package \code{sklearn.tree} and train it.
	For the beginning, you can leave the hyperparameters of the tree at their defaults and use the full dataset for training.
	\newline
	What are disadvantages of such an approach?
	\item
	\taskname{Inspection}
	Create a visual representation of your decision tree with \code{plot\_tree()} from \code{sklearn.tree}.
	Also, have a look at the properties you can retrieve from the tree object.
	\newline
	Does the structure (e.g., the splits) of the tree make sense, given the plots we created and the statistical tests we conducted for the first exercise sheet?
	Which features were the most important ones during training?
	\item
	\taskname{Evaluation}
	Apply k-fold cross-validation to evaluate your model properly.
	You may use \code{StratifiedKFold} from \code{sklean.model\_selection} or implement it manually.
	For each train-test split, fit a model, make predictions, and store train accuracy as well as test accuracy.
	You may compute accuracy with the method \code{score()} of the tree object, \code{accuracy\_score()} from \code{sklearn.metrics}, or manually.
	\newline
	How do you interpret the results?
	Why did we stratify the split?
	\item
	\taskname{Baseline}
	Determine the accuracy of simply predicting the most frequent class.
	You may use \code{DummyClassifier} from \code{sklearn.dummy} or compute it manually.
	\newline
	How does knowing this accuracy influence our evaluation of prediction models?
	\item
	\taskname{Hyperparameter Tuning}
	Learn decision trees of different complexity by passing adequate hyperparameter values in the creation of \code{DecisionTreeClassifier} objects.
	You may, for example, vary the maximum depth of the tree.
	\newline
	How does varying this hyperparameter affect the resulting train and test accuracy?
	Which value would you recommend for the hyperparameter?
\end{enumerate}

\end{document}


\chapter*{Abstract}

In tandem with an increase in devices that can detect and store motion data, the interest in analyzing this type of data has grown.
Computing similarity distance is crucial for all types of analysis, and for trajectory data, there are several algorithms that compute it.

In this thesis, we theoretically and experimentally investigate seven different similarity distance measures.
The theoretical part of the thesis examines different notions of trajectory similarly and relates it back to the trajectory data format.
The experimental part of the thesis is focused on how the theory unfolds in practice.
We analyze a data set of arbitrary trajectories.
The analysis emphasizes how the different algorithms use different notions of similarity.


\documentclass[jou]{apa6}

\usepackage[american]{babel}

\usepackage{csquotes}
\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{bibliography.bib}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Discrete Structures
%% The start of RBS stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Working internal and external links in PDF
\usepackage{hyperref}
% Extra math symbols in LaTeX
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage{amssymb}
% Enumerations with (a), (b), etc.
\usepackage{enumerate}

\let\OLDitemize\itemize
\renewcommand\itemize{\OLDitemize\addtolength{\itemsep}{-6pt}}

\usepackage{etoolbox}
\makeatletter
\preto{\@verbatim}{\topsep=3pt \partopsep=3pt }
\makeatother

% These sizes redefine APA for A4 paper size
\oddsidemargin 0.0in
\evensidemargin 0.0in
\textwidth 6.27in
\headheight 1.0in
\topmargin -24pt
\headheight 12pt
\headsep 12pt
\textheight 9.19in

\title{Sample Quiz 5}
\author{Discrete Structures, Fall 2020}
\affiliation{RBS}

\leftheader{Discrete Sample Quiz 5}

\abstract{%
}

%\keywords{}

\begin{document}

%\thispagestyle{empty}

\twocolumn
\section{Quiz 5: Number Theory}

\vspace{6pt}
{\bf Question 1.} Do the prime factorization for this 6-digit positive integer:
$510,510$.

Write your answer as a product of prime powers {\tt p\^{}a*q\^{}b*r\^{}c} or similar.
Numbers $p,q,r$ etc. should be in increasing order. All exponents (even those equal to $1$) should be written explicitly.

\vspace{6pt}
{\bf Question 2.} Are these statements true or false (do not forget that ``all integers'' include also negative numbers):
\begin{enumerate}[(A)]
\item For all integers $a,b,c$, if $a|c$ and $b|c$, then $(a + b)|c$.
\item For all integers $a,b,c,d$, if $a|b$ and $c|d$, then $(ac)|(b + d)$.
\item For all integers $a,b$, if $a|b$ and $b|a$, then $a = b$.
\item For all integers $a,b,c$, if $a|(b + c)$, then $a|b$ and $a|c$.
\item For all integers $a,b,c$, if $a|bc$, then $a|b$ or $a|c$.
\item If $p$ and $q$ are primes ($> 2$), then $pq + 1$ is never prime.
\end{enumerate}

Write your answer as a comma-separated string of T/F. For example, {\tt T,T,T,T,T,T}.\\
{\em Note.} Even though you only write the answers,
make sure that you are able to justify your answer. For true statements you should be able to
find a reasoning; for false ones \textendash{} a counterexample.

\vspace{6pt}
{\bf Question 3.} Find $\text{lcm}(24^{75},75^{24})$

Write your answer as a product of prime powers {\tt p\^{}a*q\^{}b*r\^{}c} or similar.
Numbers $p,q,r$ etc. should be in increasing order. All exponents (even those equal to $1$) should be written explicitly.

\vspace{6pt}
{\bf Question 4.}
Convert $(100\,1100\,0011)_2$ to base $16$, base $8$ and base $7$.

Write your answer as $3$ comma-separated numbers. For the hexadecimal notation use all digits and also capital letters A,B,C,D,E,F.

\vspace{6pt}
{\bf Question 5.}
Express the infinite periodic binary fraction $0.0001100110011\ldots_2 = 0.0(0011)$ as a rational number.\\
{\em Note 1.} In binary fractions a digit that is $k$ places after the point is multiplied by $2^k$.
For example, $0.1_2$ means $1/2$; $0.01_2$ means $1/4$ and so on.\\
{\em Note 2.} You may need to use infinite geometric progression to find its value.

Write your answer as {\tt P/Q}, where $P,Q$ are both in decimal notation.

\vspace{6pt}
{\bf Question 6.} Find the sum and the product of these two integers written in binary:
$(101011)_2$, $(1101011)_2$.\\
{\em Note.} You may want to try the addition and multiplication algorithm directly in
binary (without converting them into the decimal and back to the binary).

Write your answer as two comma-separated numbers (both written in binary).

\vspace{6pt}
{\bf Question 7.} Write the first 10 powers of number $3$ modulo $11$: $3^1,3^2,3^3,\ldots,3^{10}$.

Write your answer as a comma-separated list of ten remainders (mod $11$), \textendash{} numbers between $0$ and $10$.

\vspace{6pt}
{\bf Question 8.} Alice has only 21-cent coins,
Bob has 34-cent coins. Alice wants to pay Bob exactly $1$ cent.
Find two non-negative integers $s,t$ that satisfy $21s - 34t = 1$.

Write your answer as two comma-separated integers.

\vspace{6pt}
{\bf Question 9.} Consider the opposite situation: Alice has only 34-cent coins,
Bob has only 21-cent coins. Find two non-negative integers
$s,t$ that satisfy $34s - 21t = 1$.

Write your answer as two comma-separated integers.

\vspace{6pt}
{\bf Question 10.} Find $21^{-1}$ modulo $34$. (This is a number $z$ between $0$ and $33$ such that
$21z \equiv 1\;(\text{mod}\,34)$.)

Write your answer as a number modulo $34$ (i.e. between $0$ and $33$).

\vspace{6pt}
{\bf Question 11.} Solve the congruence equation $21x \equiv 11\;(\text{mod}\,34)$.

Write your answer as a number modulo $34$ (i.e. between $0$ and $33$).

\vspace{6pt}
{\bf Question 12.} Solve the Bezout identity for the numbers $a=390$,$b=72$: Find any integers $x,y$
satisfying the equation $390x + 72y = \text{gcd}(390,72)$.

Write your answer as two comma-separated integers.

\newpage

\subsection{Answers}

{\bf Question 1.}\\
Answer: {\tt 2\^{}1*3\^{}1*5\^{}1*7\^{}1*11\^{}1*13\^{}1*17\^{}1}\\
When factorizing a number with computer, try dividing it by small primes $2,3,5,7,\ldots$
(if divisible, then divide by that prime, and try to divide by that prime again, and by all
larger primes). Do so, until you reacn $\sqrt{n}$.

If you wish to factorize large ``symmetric-looking'' numbers even faster (where the same
fragment repeats itself many times), notice
that $510510 = 510 \cdot 1001$. Then
factorize each of these numbers separately.

\vspace{6pt}
{\bf Question 2.} Answer: {\tt F,F,F,F,F,T}\\
{\bf (A)} $2 \mid 6$ and $3 \mid 6$, but $(2+3) \not\mid 6$ (i.e.\ $5$ does not divide $6$).\\
{\bf (B)} $2 \mid 2$ and $3 \mid 3$, but $(2 \cdot 3) \not\mid (2+3)$ (i.e.\ $6$ does not divide $5$).\\
{\bf (C)} For positive $a,b$ this would be true, but for $\mathbb{Z}$ it is not: $2 \mid (-2)$ and $(-2) \mid 2$,
but $2 \neq -2$.
{\bf (D)} $5 \mid (3+7)$, but $5 \not\mid 3$ and also $5 \not\mid 7$; so you can make even both conclusions fail,
not just one of them.
{\bf (E)} $6 \mid 2 \cdot 15$, but $6 \not\mid 2$ and also $6 \not\mid 15$. (This statement
$(a | bc) \rightarrow ((a | b) \vee (a | c))$ would be true iff $a$ is a prime number. Then it is called
{\em Euclid's Lemma}. But it is false for all non-prime $a$).
{\bf (F)} The last statement is true, because $pq+1$ would be an even number bigger than $2$, so it cannot be prime.

We summarize, that all statements can have counterexamples, but the last one is always true.

\vspace{6pt}
{\bf Question 3.} Answer: {\tt 2\^{}225*3\^{}75*5\^{}48}\\
$\text{lcm}(24^{75},75^{24}) = \text{lcm}(2^{225}\cdot{}3^{75},3^{24}\cdot{}5^{48})$. Then take the maximal
values for each prime power $2^a$, $3^b$, $5^c$ in both numbers.

\vspace{6pt}
{\bf Question 4.} Answer: {\tt 4C3,2303,3361}\\
Hexadecimal notation can be obtained, if we group digits by four
(from the end of the number): {\tt 100:1100:0011}. Encode each group of digits: {\tt 4C3}.\\
Octal notation can be obtained as we group digits by three:
{\tt 10:011:000:011}. Encode each group: {\tt 2303}.\\
Decimal notation is $\mathtt{4} \cdot 16^2 + \mathtt{C} \cdot 16^1 + \mathtt{3} =
4 \cdot 256 + 12 \cdot 16 + 3 = 1219$. We can divide $1219$ by $7$ and each time record the remainder:
\begin{verbatim}
1219:7 = 174, R.1
174:7 = 24, R.6
24:7 = 3, R.3
3:7 = 0, R.3
\end{verbatim}
Write all the remainders from right to left: {\tt 3361}. This is the
representation of $1219$ in base $7$. You can check this by Horner's scheme:
$$((((\mathtt{3}) \cdot 7 + \mathtt{3})\cdot 7 + \mathtt{6})\cdot 7 + \mathtt{1}) = 1219.$$

\vspace{6pt}
{\bf Question 5.} Answer: {\tt 1/10}\\
$$\alpha = 0.0001100110011\ldots_2 = \frac{1}{2}\cdot 0.001100110011\ldots_2 = $$
$$= \frac{1}{2} \cdot 3 \cdot 0.000100010001\ldots_2 = $$
$$= \frac{3}{2} \cdot \left( \frac{1}{16} + \frac{1}{16^2} + \frac{1}{16^3} + \ldots \right).$$
Apply the formula of infinite geometric progression:
$$\left( \frac{1}{16} + \frac{1}{16^2} + \frac{1}{16^3} + \ldots \right) = \frac{\frac{1}{16}}{1-\frac{1}{16}} = \frac{1}{15}.$$
We get $\alpha = \frac{3}{2} \cdot \frac{1}{15} = \frac{3}{30} = \frac{1}{10}$.

{\em Note.} This example has some practical implications: the floating point number $0.1$
looks short and simple in decimal system. But it is an infinite periodic fraction when
written in binary. Therefore it is stored with a rounding error in
computer memory; doing arithmetic on such numbers may cause these errors to accumulate.

\vspace{6pt}
{\bf Question 6.} Answer: {\tt 10010110,1000111111001}\\
Fastest way is adding (or multiplying) in binary notation using grid paper.
If we want to double-check the result, we can convert each number into decimal:
$$101011_2 = 43_{10};\;\;1101011_2 = 107_{10}.$$
Sum is $150$ and the product is $4601$.
Then convert back both numbers $(150, 4601)$ into binary.

\vspace{6pt}
{\bf Question 7.} Answer: {\tt 3,9,5,4,1,3,9,5,4,1}\\
Every next remainder is the previous remainder multiplied by $3$
modulo $11$.
To avoid operating with large numbers, we immediately reduce
each power $3^{k+1} = 3^k \cdot 3$ as a remainder (between $0$ and $10$).

These remainders form a period; after a period of $5$, the remainders
repeat indefinitely. (Accordingly to the {\em Little Fermat Theorem},
$a^{10}$ should be congruent $1$ (mod $11$)
for any $a$ not divisible by $11$; and after that the remainders
will be periodic.
So, even for other $a \neq 3$ something similar should happen.)

\vspace{6pt}
{\bf Question 8.} Answer: {\tt 13,8}\\
Observe that $\text{gcd}(21,34)=1$, so the numbers $21$ and $34$ are mutual primes.
We can guess these coefficients $s,t$ (or try out various $21s$ until
it gives the remainder $1$, when divided by $34$). If we want to proceed by
Blankinship's algorithm, it will work efficiently for any numbers:

$$\left( \begin{array}{ccc}
21 & 1 & 0 \\
34 & 0 & 1 \end{array} \right)
\leadsto
\left( \begin{array}{ccc}
21 & 1 & 0 \\
13 & -1 & 1 \end{array} \right)
\leadsto$$

$$
\leadsto
\left( \begin{array}{ccc}
8 & 2 & -1 \\
13 & -1 & 1 \end{array} \right)
\leadsto
\left( \begin{array}{ccc}
8 & 2 & -1 \\
5 & -3 & 2 \end{array} \right)
\leadsto
$$

$$
\leadsto
\left( \begin{array}{ccc}
3 & 5 & -3 \\
5 & -3 & 2 \end{array} \right)
\leadsto
\left( \begin{array}{ccc}
3 & 5 & -3 \\
2 & -8 & 5 \end{array} \right)
\leadsto
$$

$$\leadsto
\left( \begin{array}{ccc}
1 & 13 & -8 \\
2 & -8 & 5 \end{array} \right)
\leadsto
\left( \begin{array}{ccc}
1 & 13 & -8 \\
0 & -34 & 21 \end{array} \right).$$

The last two tables have one of the two rows:
$1$, $13$, $-8$. This means that we are able
to get number $1$, by using coefficients $13$
and $-8$ respectively:
$$21 \cdot (13) + 34 \cdot (-8).$$
Therefore $s = 13; t = -8$.

There are infinitely many other answers (you can get
all of them, if you increment $s$ by $34k$ and
$t$ by $21k$. Then both changes will cancel out:
$$(13,8);\;\;(47,29);\;\;(81,50);\ldots$$

\vspace{6pt}
{\bf Question 9.} Answer: {\tt 13,21} or {\tt 34,55} etc.\\
From the previous question we already know that $21s + 34t = 1$
for $(s,t) = (13,-8)$. In fact, there are infinitely
many pairs $(s,t)$ satisfying that equation $21s + 34t = 1$.
If we decrease $s$ by $34$ and increase
$t$ by $21$, then the expression does not change; then
we can decrease/increase again, and so on.

Let us perform that step once: $(s_2,t_2) = (13-34,-8+21) = (-21,13)$.
Therefore $21s_2 + 34t_2 = 1$ or $21\cdot (-21) + 34 \cdot 13 = 1$.
Therefore Alice can pay with $13$ 34-cent coins and get back
$21$ 21-cent coins. This would also let her pay $1$ cent.

\vspace{6pt}
{\bf Question 10.} Answer: {\tt 13}\\
We rewrite the solution obtained from Question 8.
Since $21s - 34t = 1$ (for $s=13$, $t=8$),
we can compute remainders
from both sides:
$$1 = 21s - 34t \;\equiv\; 21s\;(\text{mod}\,34).$$
Therefore $s=13$ satisfies $21 \cdot s \equiv 1$.

\vspace{6pt}
{\bf Question 11.} Answer: {\tt 7}\\
We know that $21^{-1} = 13$ (mod $34$) from the
previous exercise. Now we can solve the
congruence equation:
$21x \equiv 11\;(\text{mod}\;34)$;\\
$21^{-1} \cdot 21x \equiv 21^{-1} \cdot 11\;(\text{mod}\;34)$;\\
$1x \equiv 13 \cdot 11\;(\text{mod}\;34)$;\\
$x \equiv 143 \equiv 7\;(\text{mod}\;34)$.

\vspace{6pt}
{\bf Question 12.} Answer: {\tt 5,-27}\\
We can easily guess that $\text{gcd}(390,72)=6$ and
with some trial and error we can find that
$$390 \cdot (5) + 72\cdot (-27) = 6.$$

To show an algorithmic way,
we could do the row operations like in Blankinship's algorithm again:
start from the table:
$$\left( \begin{array}{ccc}
390 & 1 & 0 \\
72 & 0 & 1 \end{array} \right)
\leadsto \ldots$$
But let us show another (less formal) method: write
the regular Euclidean algorithm (and preserve
coefficients before $390$ and $72$):
\begin{itemize}
\item $30 = 390 - 5 \cdot 72$.
\item $12 = 72 - 2 \cdot 30 = $\\
$= 72 - 2 \cdot (390 - 5 \cdot 72) =$\\
$= 11 \cdot 72 - 2 \cdot 390$;
\item $6 = 30 - 2 \cdot 12 = $\\
$(390 - 5 \cdot 72) - 2 \cdot (11 \cdot 72 - 2 \cdot 390) =$\\
$=5 \cdot 390 -27 \cdot 72$.
\end{itemize}

\end{document}


\documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{textcomp}
\usepackage[top=0.8in, bottom=0.8in, left=0.8in, right=0.8in]{geometry}
% Add other packages here %
\usepackage[skip=.4\baselineskip]{parskip}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lipsum}
\usepackage{subcaption}
\usepackage{enumitem}

% Put your group number and names in the author field %
\title{\bf Exercise 1.\\ Implementing a first Application in RePast: A Rabbits Grass Simulation.}
\author{Group \textnumero 22: Dubuis Samuel, Facklam Oliver}

\begin{document}
\maketitle

\section{Implementation}
After having followed the tutorials of John T. Murphy from the University of Arizona, we ended up with a working simulation of the rabbits in grass scenario.
Throughout the coding, we had to make a few assumptions that we will now describe. We will also talk about particular remarks on our implementation.

\subsection{Assumptions}
% Describe the assumptions of your world model and implementation (e.g. is the grass amount bounded in each cell) %

Most of our assumptions are situated in the schedule part of the simulation. The first one we made is about the grass that the rabbits eat. We decided that at every step, when repopulating the space with grass based on the \texttt{GrassGrowthRate} value, each unit of grass is uniformly distributed, which means that a cell can get multiple units of grass. However we limited the grass to a maximum of 15 per spot. If some grass spawns on a full cell, that unit of grass is lost.

We also assumed that each unit of grass provides one unit of energy to the consuming rabbit. So when a rabbit lands on a particular cell, instead of only gaining one energy, it would gain energy equal to the amount of grass that spawned at this space. If a rabbit cannot move due to a collision, and grass spawned at that exact location, it would eat the grass.

The last assumption is about energy consumption. Reproducing consumes \texttt{birthThreshold} units of energy of the parent rabbit, leaving its energy after reproduction close to 0. Every move costs one energy.

\subsection{Implementation Remarks}
% Provide important details about your implementation, such as handling of boundary conditions %
A couple particular implementation remarks are to be noted.

First is the death of the rabbit when its energy reaches 0. In the tutorial of John Murphy, when an agent's steps to live get below 10, it changes color, and when it dies, it disappears from the grid and is added to the count of dead agents. In our implementation we skipped the changing color part, and also we are not counting how many rabbits died.

Also, when displaying the grass on the grid, the square starts as quite dark, though of the color green. The closer it gets to the max value of 15, the brighter green the square becomes. To display this, we implemented a \texttt{ColorMap} that maps the value at the particular spot on the grid to a shade of green.

To allow rabbits to not bump into the edge of the grid, the space is actually considered to be a torus.
Also, moving-wise, we implemented a switch for the rabbit's movement so it can only move to the cardinal directions, being North, East, South and West.

Reproduction of rabbits is executed at the end of every simulation step. The existing rabbits that have enough energy in that moment create a new rabbit and lose some of their energy.

We also made sure that the list of agents in our simulation wouldn't get bigger than the number of possible agents in our grid, as this number is limited by the \texttt{gridSize}.

\section{Results}
% In this section, you study and describe how different variables (e.g. birth threshold, grass growth rate etc.) or combinations of variables influence the results. Different experiments with diffrent settings are described below with your observations and analysis
In this section we will describe a few experiments that we made based on our working simulation. The main parameters we modified are the \texttt{GrassGrowthRate} and \texttt{BirthThreshold}.
We kept \texttt{GridSize} at 20.

\subsection{Experiment 1}
\begin{figure}[h!]
    \begin{subfigure}{.5\textwidth}
        \centering
        \includegraphics[width=.95\linewidth]{intro_rabbits/plot15_50.png}
        \caption{\texttt{BirthThreshold} 15; \texttt{GrassGrowthRate} 50}
        \label{fig:plot15-50}
    \end{subfigure}
    \hfill
    \begin{subfigure}{.5\textwidth}
        \centering
        \includegraphics[width=.95\linewidth]{intro_rabbits/plot15_1.png}
        \caption{\texttt{BirthThreshold} 15; \texttt{GrassGrowthRate} 1}
        \label{fig:plot15-1}
    \end{subfigure}\\%
    \begin{subfigure}{.5\textwidth}
        \centering
        \includegraphics[width=.95\linewidth]{intro_rabbits/plot2_1.png}
        \caption{\texttt{BirthThreshold} 2; \texttt{GrassGrowthRate} 50}
        \label{fig:plot2-50}
    \end{subfigure}
    \hfill
    \begin{subfigure}{.5\textwidth}
        \centering
        \includegraphics[width=.95\linewidth]{intro_rabbits/plot2_1.png}
        \caption{\texttt{BirthThreshold} 2; \texttt{GrassGrowthRate} 1}
        \label{fig:plot2-1}
    \end{subfigure}%\\%
    \caption{Plots of rabbit count (red) and grass/cell (blue) at each step, for different parameter settings}
    \label{fig:exp1}
\end{figure}

\subsubsection{Setting}
In this first experiment, we start with a single rabbit at 20 life steps and 20 initial grass.  We execute 4 runs of our simulation to compare the impact on rabbit population of:
\begin{itemize}[nosep]
    \item a \texttt{BirthThreshold} which can be high (15) or low (2)
    \item a \texttt{GrassGrowthRate} which can be high (50) or low (1)
\end{itemize}

\subsubsection{Observations}
% Elaborate on the observed results %

The situation with a high birth threshold and high grass growth is shown in figure (\ref{fig:plot15-50}). We get an average of about 198 rabbits alive at the same time. As seen on the plot, at the start the rabbit count immediately increases as each born rabbit gives birth to a new one, then it stabilizes. The large \texttt{GrassGrowthRate} allows the rabbits to reproduce multiple times. If there had been a higher \texttt{GrassGrowthRate}, the grid would probably have filled completely as each rabbit could have gained more energy to rebirth multiple times.

In the second situation, presented in figure (\ref{fig:plot15-1}), the grass growth rate is reduced to a very low number, so that rabbits definitely need to look for source of energy.
We can see that the first few rabbits give birth immediately as they spawn, having enough energy, but then die when their energy is depleted. Since grass is rare, none of them can find enough source of energy to reproduce another time. Logically, the average is around 6 rabbits, which is the number of rabbits that can be spawned before the first one dies.

The third situation combines a high grass growth rate with a low birth threshold, and is shown in figure (\ref{fig:plot2-50}). We can predict that with a small birth threshold, rabbits will birth multiples times in the same simulation, and with enough grass, the grid will become full. This is exactly what we observe: the grid fills in an instant and stays that way; as soon as a rabbit dies, another one replaces it.

In the last situation, shown in figure (\ref{fig:plot2-1}), both parameters are set to low values. We can predict that the number of rabbits will be higher than in situation 2 since the birth threshold is lower; however there is close to no grass to enable additional reproduction.
Despite this lack of grass, there are enough of them so that the grid fills up instantaneously.

\begin{figure}[h!]
    \begin{subfigure}{.5\textwidth}
        \centering
        \includegraphics[width=.95\linewidth]{intro_rabbits/birththreshold.png}
        \caption{Average number of rabbits vs. birth threshold}
        \label{fig:birththreshold}
    \end{subfigure}
    \hfill
    \begin{subfigure}{.5\textwidth}
        \centering
        \includegraphics[width=.95\linewidth]{intro_rabbits/grassgrowthrate.png}
        \caption{Average number of rabbits vs. grass growth rate}
        \label{fig:grassgrowthrate}
    \end{subfigure}
    \caption{Plots for experiments 2 \& 3}
    \label{fig:my_label}
\end{figure}

\subsection{Experiment 2}
\subsubsection{Setting}
In the second experiment, we want to analyze how the average rabbit count depends on the birth threshold. For this, we fix \texttt{GrassGrowthRate} to 50, and start with 10 rabbits, 20 initial energy and 0 grass. We then vary the \texttt{BirthThreshold} and for each value we plot the number of rabbits averaged over time. Results are shown in figure (\ref{fig:birththreshold}).

\subsubsection{Observations}

When the birth threshold is below the rabbits' initial energy (20), the grid has a tendency to fill up very quickly: the average number of rabbits is more than 350. However, when the birth threshold is higher than the initial energy, this threshold value doesn't seem to significantly influence the rabbit count.

\subsection{Experiment 3}
\subsubsection{Setting}
In this last experiment, we analyze the relationship between average rabbit count and grass growth. We use the same initial values as in the previous experiment and fix \texttt{BirthThreshold} to 50. We then vary the \texttt{GrassGrowthRate}. Results are shown in figure (\ref{fig:grassgrowthrate}).

\subsubsection{Observations}

Apart from the first couple of points which represent extreme situations, we observe a strong linear relationship between rabbit count and grass growth rate. The slope is 0.89 and the intercept -3.23.

% I don't think we should add any sections (a TA said so), and a conclusion wasn't in the template (even though it's weird)
%\section{Conclusion}
%As seen in all of the experiments, it seems that setting a \texttt{BirthThreshold} to a low value shows no valuable information. When too low, the rabbits are able to reproduce too often, filling up the grid rapidly. We could experiment further with a bigger grid to maybe see differences, but this is content for another time.
\end{document}