\documentclass[main.tex]{subfiles}
\begin{document}

\section{Sheet 12}

\subsection{Gravitational wave detection}

\subsubsection{Linear order edges stationarity}

We consider a perturbed metric  \(g_{\mu \nu } = \eta_{\mu \nu } + h_{\mu \nu }\), and we denote as \(h\) the perturbative order in the correction to the Minkowski metric (\emph{not} the trace of \(h_{\mu \nu }\), which is gauge-dependent and usually set to zero).

We take a test mass in Minkowski spacetime, and we choose a coordinate system such that at a certain starting time \(\tau_0 \) this point is stationary, so at this time \(u^{\mu }(\tau = \tau_0  ) = u^{\mu }_{0} = [1, \vec{0}]^{\top}\) for this mass.

At a following time the gravitational wave arrives, and perturbs the test mass: the mass, by following geodesic motion with respect to the perturbed metric, will move with respect to the coordinates. This is described by the geodesic equation
%
\begin{align} \label{eq:geodesic-equation}
u^{\nu } \nabla_{\nu } u^{\mu } = \dv{ u^{\mu } }{\tau } + \Gamma^{\mu }_{\alpha \beta } u^{\alpha } u^{\beta } = 0
\,.
\end{align}

We want to prove that, in our gauge, the test mass does not acquire velocity to linear order in \(h\).
First of all, to zeroth order in \(h\) the mass is in a Minkowski spacetime so, the Christoffel symbols are all zero and it does not move. In fact, the Christoffel symbols are made up of terms of the form \(\Gamma \sim g^{-1} \partial g = g^{-1} \partial h\), which is  \(\mathcal{O}(h)\) at least.
The velocity, on the other hand, is nonzero at linear order: \(u^{\mu } = u^{\mu }_{0} + \mathcal{O}(h)\).

We wish to consider equation \eqref{eq:geodesic-equation} to linear order; more specifically we are interested in the second term \(\Gamma^{\mu }_{\alpha \beta } u^{\alpha } u^{\beta }\), which defines the time evolution of the 4-velocity. For this to be first order the velocity must be considered only to constant order, since the Christoffel symbols are already first order.

Therefore we are left with
%
\begin{subequations}
\begin{align}
\dv{ u^{\mu }}{\tau } &= - \Gamma^{\mu }_{\alpha \beta } u^{\alpha }_{0} u^{\beta }_{0} = - \Gamma^{\mu }_{00} \\
&= - \frac{1}{2} \eta^{\mu \nu } \qty(2h_{\nu  0, 0} + h_{00,\nu }) = 0 \marginnote{The inverse metric must be considered only to constant order, otherwise the term is second order}
\,,
\end{align}
\end{subequations}
%
which vanishes because, in our gauge, \(h_{\mu 0} = 0\) for all \(\mu \).

\subsubsection{Linear order gravitational wave \(\Delta T / T\)}

We consider a gravitational wave
%
\begin{align}
h_{ij} (t, \vec{x}) = \cos(kt - \vec{k} \cdot \vec{x}) \sum _{r = \times , +} e_{ij}^{r} h_{r}
\,,
\end{align}
%
where
%
\begin{subequations}
\begin{align}
e_{ij}^{+} = \left[\begin{array}{cc}
1 &  0 \\
0 & -1
\end{array}\right] \qquad \text{and} \qquad
e_{ij}^{ \times } = \left[\begin{array}{cc}
0 & 1 \\
1 & 0
\end{array}\right]
\,
\end{align}
\end{subequations}
%
and \(\vec{k}^2 = k^2\). In principle the cosine could have an arbitrary phase added to the argument, but we set it to zero for simplicity.
Also, we set \(\vec{k} = k \hat{z}\).

Our interferometer configuration is as follows at order \(h^{0}\): we have the beamsplitter at coordinates \(\vec{B} = [0,0,0]^{\top}\) and the two mirrors at coordinates \(\vec{M}_{1} = T [\cos(\alpha ), \sin(\alpha ),0]^{\top} T \hat{L}_{1}\) and \(\vec{M}_{2} = T [ \cos(\alpha + \pi /2), \sin(\alpha + \pi /2),0]^{\top} = T \hat{L}_{2}\), for some angle \(\alpha \): this means that the arms are orthogonal and at a certain angle with respect to the incoming gravitational wave's basis axes.
We also defined some basis vectors aligned along the interferometer's arms.

We start off two beams of light at the beamsplitter at \(t=0\), and see how much time they each take to reach their respective mirrors. If these are the times \(T_{1,2}\) we then define \(\Delta T = \abs{T_1 - T_2 }\) and compute \(\Delta T / T\).

Photons' trajectories are defined by \(\dd{s^2} = 0\): so, if we parametrize a photon trajectory by \(x^{\mu }_{p} (\lambda ) = \lambda [1, \hat{L}_{p}]^{\top}\) (for \(p = 1, 2\)) this means that the photon's 4-velocity is
%
\begin{align}
u^{\mu }_{p} = \dv{}{\lambda } x^{\mu }_{p}(\lambda ) = [1, \hat{L}_{p}]
\,,
\end{align}
%
so if we assume the 4-velocity is normalized in the perturbed metric we find
%
\begin{subequations}
\begin{align}
0=\dd{s^2} &= - \dd{t_{p}^2} + \qty(\delta_{ij} + h_{ij}) \hat{L}^{i}_{p} \hat{L}^{j}_{p} \dd{\lambda^2}   \marginnote{\(\hat{L}\) is a unit vector}[.5cm]\\
\dd{t_{p}^2}  &= \qty(1 + h_{ij} \hat{L}^{i}_{p} \hat{L}^{j}_{p}) \dd{\lambda^2}  \\
\dd{t_{p}}  &= \sqrt{1 + h_{ij} \hat{L}^{i}_{p} \hat{L}^{j}_{p}} \dd{\lambda} \approx \qty(1 + \frac{1}{2} \abs{\hat{L}_{p}}_{h}^2) \dd{\lambda }
\,,
\end{align}
\end{subequations}
%
where by \(\abs{\hat{L}_{p}}_{h}\) we mean the norm of the vector \(\hat{L}\) taken with respect to the bilinear form \(h_{ij}\).

Now, we can compute the integral giving us the total time:
%
\begin{subequations}
\begin{align}
T_{p} &= \int \dd{t_{p}}  \\
&\approx \int \qty(1 + \frac{1}{2} \abs{\hat{L}_{p}}_{h}^2) \dd{\lambda }  \\
&= T + \frac{1}{2} \int \dd{\lambda } \cos(kt-\vec{k}\cdot \vec{x})  \qty(\sum_{r} e^{r}_{ij} h_{r} )\hat{L}^{i}_{p}\hat{L}^{j}_{p}
\,,
\end{align}
\end{subequations}
%
where \(t\) and \(\vec{x}\) are to be considered as functions of \(\lambda \): \(t=\lambda \) and \(\vec{x} = \hat{L}_{p} \lambda \), but by what we have assumed \(\vec{k} \cdot \vec{x} =0\) since the gravitational wave is perpendicular to the interferometer's plane.

Before assuming anything else, let us compute the bilinear form contribution. For brevity we will denote a cosine as \(c\) and a sine as \(s\). Then, for both \(p =1\) and \(p=2\) we will have:
%
\begin{subequations}
\begin{align}
e_{ij}^{+} \hat{L}^{i}_{p} \hat{L}^{j}_p
= \left[\begin{array}{ccc}
c & s & 0
\end{array}\right]
\left[\begin{array}{ccc}
1 & 0 & 0 \\
0 & -1 & 0 \\
0 & 0 & 0
\end{array}\right]
\left[\begin{array}{c}
c \\
s \\
0
\end{array}\right]= c^2- s^2
\,
\end{align}
\end{subequations}
%
for the plus polarization, and
%
\begin{subequations}
\begin{align}
e_{ij}^{ \times } \hat{L}^{i}_{p} \hat{L}^{j}_p
= \left[\begin{array}{ccc}
c & s & 0
\end{array}\right]
\left[\begin{array}{ccc}
0 & 1 & 0 \\
1 & 0 & 0 \\
0 & 0 & 0
\end{array}\right]
\left[\begin{array}{c}
c \\
s \\
0
\end{array}\right]= 2cs
\,
\end{align}
\end{subequations}
%
for the cross polarization. Now, recall that
%
\begin{align}
\cos^2 x - \sin^2 x = \cos(2x) \qquad \text{and} \qquad
2 \sin x \cos x = \sin (2 x)
\,,
\end{align}
%
and \emph{also} notice that we need to evaluate these expressions for \(x = \alpha \) for the first arm, with \(p=1\), and for \(x = \alpha + \pi /2\) for the other arm, with \(p=2\). Then, since all the dependence is on trigonometric functions of \emph{two times} \(x\) we must have that the correction on one arm is exactly equal in value and opposite in sign to the correction on the other arm, since the argument of the trigonometric functions changes by \(\pi \) and both sine and cosine are odd under translations of \(\pi \).

This means that in the global expression for \(\Delta T\) we will have twice the same term: then we can collect them, and find
%
\begin{align}
\Delta T = \qty(h_{+} \cos(2 \alpha ) + h_{ \times } \sin(2 \alpha )) \int \dd{\lambda } \cos(\lambda k)
\,,
\end{align}
%
where \(k\) is the wavenumber / frequency of the gravitational wave, while \(\lambda \) must be integrated from 0 to \(T\), the length of the interferometer arms.

The dimensions of the argument of the cosine are \SI{}{m/s}, so in order to make it adimensional we need to divide it by \(c\). The typical order of magnitude of the frequencies of GWs detected at the LIGO/VIRGO detectors is around \(f = \SI{100}{Hz}\), while the length of the arms is around \(T =\SI{4}{km}\). Therefore, the argument of the cosine is bounded by
%
\begin{align}
\frac{2 \pi f T }{c} \lesssim \frac{\SI{100}{Hz} \times \SI{4}{km}}{c} \approx \num{e-2}
\,,
\end{align}
%
where we used the relation between frequency and angular velocity: \(k = 2 \pi f\). This is small but not exceedingly small: we can approximate \(\cos(\lambda k ) = \const\) but our predictions will not exceed second-significant-digit accuracy.

With this approximation, the integral will equal the size of the integration region times the value of the cosine, leaving us with:
%
\begin{align}
\Delta T = \qty(h_{+} \cos(2 \alpha ) + h_{ \times } \sin(2 \alpha )) T \cos(t k)
\,,
\end{align}
%
which will vary in time in general, but if the light starts at \(t=0\) then in our approximation the cosine will always equal \(1\).  In the end  then we will be left with:
%
\begin{align}
\frac{\Delta T}{T} = h_{+} \cos(2 \alpha ) + h_{ \times } \sin(2 \alpha )
\,.
\end{align}

\subsubsection{Return trip \(\Delta T / T\)}

If we want to consider the return trip, almost everything will be the same except:
\begin{enumerate}
  \item the starting time and arrival time will change;\label{it:starting-time}
  \item the unit vectors \(\hat{L}\) will change into \(- \hat{L}\). \label{it:parity}
\end{enumerate}

Point \ref{it:starting-time} is not a concern if we are in the small frequency approximation: the cosine  will still almost be equal to 1, although the approximation will get a little worse.

Point \ref{it:parity} is not a concern either: the \(h-\)norm \(\hat{L} \rightarrow h_{ij} \hat{L}^{i} \hat{L}^{j}\) is symmetric, so the norm of a unit vector does not change under parity.

This means that over the time of the return trip a difference \(\Delta T _{\text{return}} = \Delta T _{\text{forward}}\) will be accumulated, so when we calculate \(\Delta T _{\text{total}} / (2T)\) we will get the same result we did with just the forward trip.

\subsubsection{Exact integration}

We now wish to calculate the global time difference without assuming \(k \lambda \) is small. As we saw before the contributions for the forward and backward journeys are the same, so we need to evaluate the integral
%
\begin{align}
\int_{0}^{2T} \cos(\lambda k) \dd{\lambda }
= \left. \frac{1}{k} \sin(\lambda k ) \right\vert_{\lambda = 0}^{\lambda = 2T} = \frac{\sin(2Tk)}{k}
\,,
\end{align}
%
and, as expected, if \(Tk \sim 0\) then
%
\begin{align}
\frac{\sin(2Tk)}{k} \sim \frac{2Tk}{k} = 2T
\,.
\end{align}

So, the proper formula is
%
\begin{align}
\frac{\Delta T}{2T} =
\qty(h_{+} \cos(2 \alpha ) + h_{ \times } \sin(2 \alpha ))
\frac{\sin(2Tk)}{2Tk}
\,.
\end{align}

This vanishes for all the zeros of \(\sin(2Tk)\): for \(k=0\) this is expected (there is no gravitational wave) but it is weird for \(2Tk = n \pi \), \(n \in \mathbb{Z} \setminus \qty{0}\).

Let us look at the first weird case: \(2Tk = \pi \) to get an idea.

In that case, we have \(k =  \pi / 2T \), so the frequency of the GW is \(f = k / 2 \pi  =  1/ 4 T\).

Since gravitational waves travel at velocity 1, we have \(fP = 1\), where \(f\) and \(P\) are respectively the  frequency and period of the GW (spatial or temporal: it is equivalent, since \(c=1\)).
This means that, in the case we are considering, the wavelength of the GW is precisely equal to twice the length of the interferometer's arm, since we found \(P = 4T\).

More generally, we will have \(k = n \pi /2T\)
%
\begin{align}
P = \frac{1}{f} = \frac{2 \pi }{k} = \frac{4 \pi T}{n \pi } = \frac{4T}{n}
\,,
\end{align}
%
and we have proven that at precisely those frequencies the gravitational wave will have a vanishing net effect, since it will go through precisely \(n\) cycles during the beam's trajectory.

% The factor of 2 is \emph{probably} connected with the spin-2 nature of gravitons (i.\ e.\ the fact that they are symmetric under rotations of \(\pi \) around the wavevector).

\end{document}


\documentclass[12pt]{article}
\author{David Alves}

\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{dirtytalk}
\usepackage[a4paper]{geometry}
\usepackage{forest}
\usepackage{listings}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{nth}
\usepackage{relsize}
\usepackage{skak}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{titling}
\usepackage{wrapfig}
\usepackage{xcolor}

\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{patterns}

\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}

\def\multichoose#1#2{\ensuremath{\left(\kern-.3em\left(\genfrac{}{}{0pt}{}{#1}{#2}\right)\kern-.3em\right)}}

\newcommand{\ts}[1]{\textsuperscript{#1}}

\newcommand{\ProblemStatement}[1]{
\subsection*{Problem Statement}
#1
\subsection*{Solution}
}

% If uncommented, next line hides problem statements
%\renewcommand{\ProblemStatement}[1]{}

\title{Math 142 Problem Set 13}
\author{David Alves}
\date{2016-12-01}

\begin{document}
\pagenumbering{gobble}

\begin{center}
\large \thetitle \\
\theauthor \\
\thedate
\end{center}

\subsection*{Sources}

    \begin{itemize}
    \item http://tex.stackexchange.com and https://www.sharelatex.com for help with \LaTeX
    \end{itemize}

\section{Patriotic Octagons}
\ProblemStatement{
Suppose you have to paint each edge of an octagon red, white, or blue. Find the
number of ways to do this, counting two painting methods the same if they can be
obtained from each other by rotation.
}

There are 834 ways of painting the sides of an octagon red, white, or blue that
are distinct under rotation.

\begin{proof}
Let $G = C_8$, the cyclic group of 8 elements. Let 1 denote the identity
permutation in $G$, $g$ denote rotation by 1, $g^2$ denote rotation by two, etc.
We know that $Fix(g^k)$ is the number of colors (3) to the power of the number
of cycles in $g^k$, since each cycle must have all elements the same color.
Below are the cycles counts for each permutation.

\subsubsection*{One Cycle}

\begin{tikzpicture}
\node at (0,0) {$g$};
\node[shape=circle] (A) at (0,1.5) {1};
\node[shape=circle] (B) at (1.06,1.06) {2};
\node[shape=circle] (C) at (1.5,0) {3};
\node[shape=circle] (D) at (1.06,-1.06) {4};
\node[shape=circle] (E) at (0,-1.5) {5};
\node[shape=circle] (F) at (-1.06,-1.06) {6};
\node[shape=circle] (G) at (-1.5,0) {7};
\node[shape=circle] (H) at (-1.06,1.06) {8};
\draw [->] (A) edge[bend left=10] (B);
\draw [->] (B) edge[bend left=10] (C);
\draw [->] (C) edge[bend left=10] (D);
\draw [->] (D) edge[bend left=10] (E);
\draw [->] (E) edge[bend left=10] (F);
\draw [->] (F) edge[bend left=10] (G);
\draw [->] (G) edge[bend left=10] (H);
\draw [->] (H) edge[bend left=10] (A);
\end{tikzpicture}
\begin{tikzpicture}
\node at (0,0) {$g^7$};
\node[shape=circle] (A) at (0,1.5) {1};
\node[shape=circle] (B) at (1.06,1.06) {2};
\node[shape=circle] (C) at (1.5,0) {3};
\node[shape=circle] (D) at (1.06,-1.06) {4};
\node[shape=circle] (E) at (0,-1.5) {5};
\node[shape=circle] (F) at (-1.06,-1.06) {6};
\node[shape=circle] (G) at (-1.5,0) {7};
\node[shape=circle] (H) at (-1.06,1.06) {8};
\draw [->] (A) edge[bend right=10] (H);
\draw [->] (B) edge[bend right=10] (A);
\draw [->] (C) edge[bend right=10] (B);
\draw [->] (D) edge[bend right=10] (C);
\draw [->] (E) edge[bend right=10] (D);
\draw [->] (F) edge[bend right=10] (E);
\draw [->] (G) edge[bend right=10] (F);
\draw [->] (H) edge[bend right=10] (G);
\end{tikzpicture}
\begin{tikzpicture}
\node at (0,0) {$g^3$};
\node[shape=circle] (A) at (0,1.5) {1};
\node[shape=circle] (B) at (1.06,1.06) {2};
\node[shape=circle] (C) at (1.5,0) {3};
\node[shape=circle] (D) at (1.06,-1.06) {4};
\node[shape=circle] (E) at (0,-1.5) {5};
\node[shape=circle] (F) at (-1.06,-1.06) {6};
\node[shape=circle] (G) at (-1.5,0) {7};
\node[shape=circle] (H) at (-1.06,1.06) {8};
\draw [->] (A) edge[bend right=10] (D);
\draw [->] (B) edge[bend right=10] (E);
\draw [->] (C) edge[bend right=10] (F);
\draw [->] (D) edge[bend right=10] (G);
\draw [->] (E) edge[bend right=10] (H);
\draw [->] (F) edge[bend right=10] (A);
\draw [->] (G) edge[bend right=10] (B);
\draw [->] (H) edge[bend right=10] (C);
\end{tikzpicture}
\begin{tikzpicture}
\node at (0,0) {$g^5$};
\node[shape=circle] (A) at (0,1.5) {1};
\node[shape=circle] (B) at (1.06,1.06) {2};
\node[shape=circle] (C) at (1.5,0) {3};
\node[shape=circle] (D) at (1.06,-1.06) {4};
\node[shape=circle] (E) at (0,-1.5) {5};
\node[shape=circle] (F) at (-1.06,-1.06) {6};
\node[shape=circle] (G) at (-1.5,0) {7};
\node[shape=circle] (H) at (-1.06,1.06) {8};
\draw [->] (A) edge[bend left=10] (F);
\draw [->] (B) edge[bend left=10] (G);
\draw [->] (C) edge[bend left=10] (H);
\draw [->] (D) edge[bend left=10] (A);
\draw [->] (E) edge[bend left=10] (B);
\draw [->] (F) edge[bend left=10] (C);
\draw [->] (G) edge[bend left=10] (D);
\draw [->] (H) edge[bend left=10] (E);
\end{tikzpicture}

\subsubsection*{Two Cycles}
\begin{tikzpicture}
\node at (0,0) {$g^2$};
\node[shape=circle] (A) at (0,1.5) {1};
\node[shape=circle] (B) at (1.06,1.06) {2};
\node[shape=circle] (C) at (1.5,0) {3};
\node[shape=circle] (D) at (1.06,-1.06) {4};
\node[shape=circle] (E) at (0,-1.5) {5};
\node[shape=circle] (F) at (-1.06,-1.06) {6};
\node[shape=circle] (G) at (-1.5,0) {7};
\node[shape=circle] (H) at (-1.06,1.06) {8};
\draw [->] (A) edge[bend right=30] (C);
\draw [->] (B) edge[bend right=30] (D);
\draw [->] (C) edge[bend right=30] (E);
\draw [->] (D) edge[bend right=30] (F);
\draw [->] (E) edge[bend right=30] (G);
\draw [->] (F) edge[bend right=30] (H);
\draw [->] (G) edge[bend right=30] (A);
\draw [->] (H) edge[bend right=30] (B);
\end{tikzpicture}
\begin{tikzpicture}
\node at (0,0) {$g^6$};
\node[shape=circle] (A) at (0,1.5) {1};
\node[shape=circle] (B) at (1.06,1.06) {2};
\node[shape=circle] (C) at (1.5,0) {3};
\node[shape=circle] (D) at (1.06,-1.06) {4};
\node[shape=circle] (E) at (0,-1.5) {5};
\node[shape=circle] (F) at (-1.06,-1.06) {6};
\node[shape=circle] (G) at (-1.5,0) {7};
\node[shape=circle] (H) at (-1.06,1.06) {8};
\draw [->] (A) edge[bend left=30] (G);
\draw [->] (B) edge[bend left=30] (H);
\draw [->] (C) edge[bend left=30] (A);
\draw [->] (D) edge[bend left=30] (B);
\draw [->] (E) edge[bend left=30] (C);
\draw [->] (F) edge[bend left=30] (D);
\draw [->] (G) edge[bend left=30] (E);
\draw [->] (H) edge[bend left=30] (F);
\end{tikzpicture}\\

\noindent\begin{minipage}{.35\textwidth}
\subsubsection*{Four Cycles}
\begin{tikzpicture}
\node at (0,0) {$g^4$};
\node[shape=circle] (A) at (0,1.5) {1};
\node[shape=circle] (B) at (1.06,1.06) {2};
\node[shape=circle] (C) at (1.5,0) {3};
\node[shape=circle] (D) at (1.06,-1.06) {4};
\node[shape=circle] (E) at (0,-1.5) {5};
\node[shape=circle] (F) at (-1.06,-1.06) {6};
\node[shape=circle] (G) at (-1.5,0) {7};
\node[shape=circle] (H) at (-1.06,1.06) {8};
\draw [->] (A) edge[bend left=20] (E);
\draw [->] (B) edge[bend left=20] (F);
\draw [->] (C) edge[bend left=20] (G);
\draw [->] (D) edge[bend left=20] (H);
\draw [->] (E) edge[bend left=20] (A);
\draw [->] (F) edge[bend left=20] (B);
\draw [->] (G) edge[bend left=20] (C);
\draw [->] (H) edge[bend left=20] (D);
\end{tikzpicture}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\subsubsection*{Eight Cycles}
\begin{tikzpicture}
\node at (0,.15) {\textbf{(id)}};
\node[shape=circle] (A) at (0,1.5) {1};
\node[shape=circle] (B) at (1.06,1.06) {2};
\node[shape=circle] (C) at (1.5,0) {3};
\node[shape=circle] (D) at (1.06,-1.06) {4};
\node[shape=circle] (E) at (0,-1.5) {5};
\node[shape=circle] (F) at (-1.06,-1.06) {6};
\node[shape=circle] (G) at (-1.5,0) {7};
\node[shape=circle] (H) at (-1.06,1.06) {8};
\draw [->] (A) edge[loop above,looseness=4] (A);
\draw [->] (B) edge[loop above,looseness=4] (B);
\draw [->] (C) edge[loop above,looseness=4] (C);
\draw [->] (D) edge[loop above,looseness=4] (D);
\draw [->] (E) edge[loop above,looseness=4] (E);
\draw [->] (F) edge[loop above,looseness=4] (F);
\draw [->] (G) edge[loop above,looseness=4] (G);
\draw [->] (H) edge[loop above,looseness=4] (H);
\end{tikzpicture}
\end{minipage}

Therefore we have the following cardinalities for $Fix(g^k)$:

\begin{center}
\begin{tabular}{ rcccl }
    $|Fix(1)|  $ &=& $3^8$ &=& 6561\\
    $|Fix(g)|  $ &=& $3^1$ &=& 3\\
    $|Fix(g^2)|$ &=& $3^2$ &=& 9\\
    $|Fix(g^3)|$ &=& $3^1$ &=& 3\\
    $|Fix(g^4)|$ &=& $3^4$ &=& 81\\
    $|Fix(g^5)|$ &=& $3^1$ &=& 3\\
    $|Fix(g^6)|$ &=& $3^2$ &=& 9\\
    $|Fix(g^7)|$ &=& $3^1$ &=& 3\\
\end{tabular}
\end{center}

By the Polya-Burnside theorem, the number of orbits (aka distinct paintings
after considering rotation) is $\frac{1}{|G|}\sum_{g \in G} |Fix(g)|$, thus we
have $\frac{1}{8}(6561 + 3 + 9 + 3 + 81 + 3 + 9 + 1) = $ 834 total ways to
paint the octagon.
\end{proof}

\section{Thanksgiving Dinner}
\ProblemStatement{
Your grandmother cooked a turkey, stuffng, cornbread, 2 distinguishable salads
(Caesar and spinach) and 3 distinguishable desserts (pumpkin pie, chocolate
mayhem cake, and sweet potato pie). You're allowed to eat or not eat any
particular of these 8 dishes (we assume you have infinite stomach space), but
you have to follow The Granny's Rule, which is that you cannot have any type of
dessert if you do not eat at least one salad. How many ways of eating are there?
(again, we do not care about the amount you are eating of each food, just
whether you eat it or not).
}

There are 200 possible ways of eating.

\begin{proof}
Assume for a moment that only the 2 salads and 3 deserts existed. There would be 4
possibilities for salad consumption and 8 possibilities for dessert consumption.
3 of the 4 salad possibilities (the ones where at least one salad is eaten)
allow any dessert possibility, while the last one (where no salad is eaten)
allows only one desert possibility (the one where no desert is eaten). Thus we
have $3 \times 8 + 1 \times 1 = 25$ possible meals when we only consider salad
and desert. There are no restrictions on the other courses, so for each of those
25 valid salad-dessert combinations there are 8 possibilities for the
other dishes, giving $8 \times 25 = 200$ possible meals in total.
\end{proof}

\section{Thankfulness}
\ProblemStatement{
What are you thankful for?
}

I'm thankful for my health and my family. It's been a good year and we've been
very fortunate. In particular my wife and I had a baby daughter in January and
she's happy and healthy, so I'm very thankful for her.

\section{Generating with Powers of Ten}
\ProblemStatement{
Show with generating functions that every nonnegative integer has a unique
decimal expansion (think about what this means; consult earlier homework for
help).
}

\begin{proof}
We can represent the decimal expansions using this generating function:

\[
\prod_{i=0}^{\infty} \left(1 + x^{10^i} + x^{2\times10^i} + \dots + x^{8\times10^i} + x^{9\times10^i}\right)
\]

The term where $i=0$ is the ones place, $i=1$ is the tens place, etc., while the 10 choices inside the parentheses represent the choices for that digit. In order to show that every nonnegative integer has a unique representation, we must show that

\[
\prod_{i=0}^{\infty} \left(1 + x^{10^i} + x^{2\times10^i} + \dots + x^{8\times10^i} + x^{9\times10^i}\right) = 1 + x + x^2 + x^3 + \dots
\]

We prove this by induction. Let $p(n)$ be the following statement:

\[
\prod_{i=0}^{n} \left(1 + x^{10^i} + x^{2\times10^i} + \dots + x^{8\times10^i} + x^{9\times10^i}\right) = 1 + x + x^2 + x^3 + \dots + x^{10^{n+1}-1}
\]
\\
$p(0)$ is the statement $(1 + x + x^2 + x^3 + \dots + x^8 + x^9) = (1 + x + x^2 + x^3+ \dots + x^8 + x^9)$, which is true. Next we must show that if $p(n)$ is true, $p(n+1)$ must also be true.\\

Multiplying both sides of $p(n)$ by $(1 + x^{10^{n+1}} + x^{2\times10^{n+1}} + \dots + x^{8\times10^{n+1}} + x^{9\times10^{n+1}})$ gives:

\begin{align*}
\prod_{i=0}^{n+1} \left(1 + x^{10^i} + x^{2\times10^i} + \dots + x^{8\times10^i} + x^{9\times10^i}\right) =
                    (1)\left(1 + x + x^2 + x^3 + \dots + x^{10^{n+1}-1}\right) + \\
\left(x^{       {10^{n+1}}}\right)\left(1 + x + x^2 + x^3 + \dots + x^{10^{n+1}-1}\right) +\\
\left(x^{2\times{10^{n+1}}}\right)\left(1 + x + x^2 + x^3 + \dots + x^{10^{n+1}-1}\right) +\\
\left(x^{3\times{10^{n+1}}}\right)\left(1 + x + x^2 + x^3 + \dots + x^{10^{n+1}-1}\right) +\\
\left(x^{4\times{10^{n+1}}}\right)\left(1 + x + x^2 + x^3 + \dots + x^{10^{n+1}-1}\right) +\\
\left(x^{5\times{10^{n+1}}}\right)\left(1 + x + x^2 + x^3 + \dots + x^{10^{n+1}-1}\right) +\\
\left(x^{6\times{10^{n+1}}}\right)\left(1 + x + x^2 + x^3 + \dots + x^{10^{n+1}-1}\right) +\\
\left(x^{7\times{10^{n+1}}}\right)\left(1 + x + x^2 + x^3 + \dots + x^{10^{n+1}-1}\right) +\\
\left(x^{8\times{10^{n+1}}}\right)\left(1 + x + x^2 + x^3 + \dots + x^{10^{n+1}-1}\right) +\\
\left(x^{9\times{10^{n+1}}}\right)\left(1 + x + x^2 + x^3 + \dots + x^{10^{n+1}-1}\right) +\\
\end{align*}
Multiplying through gives
\begin{align*}
\prod_{i=0}^{n+1} \left(1 + x^{10^i} + x^{2\times10^i} + \dots + x^{8\times10^i} + x^{9\times10^i}\right) =
\left(1 + x + x^2 + \dots + x^{10^{n+1}-2} + x^{10^{n+1}-1}\right) + \\
\left(x^{10^{n+1}} + x^{10^{n+1}+1} + x^{10^{n+1}+2} + \dots + x^{10^{n+1} + x^{10^{n+1}-2}} + x^{10^{n+1} + x^{10^{n+1}-1}}\right) +\\
\left(x^{2\times10^{n+1}} + x^{2\times10^{n+1}+1} + x^{2\times10^{n+1}+2} + \dots + x^{2\times10^{n+1} + 10^{n+1}-2} + x^{2\times10^{n+1} + 10^{n+1}-1}\right) +\\
\left(x^{3\times10^{n+1}} + x^{3\times10^{n+1}+1} + x^{3\times10^{n+1}+2} + \dots + x^{3\times10^{n+1} + 10^{n+1}-2} + x^{3\times10^{n+1} + 10^{n+1}-1}\right) +\\
\left(x^{4\times10^{n+1}} + x^{4\times10^{n+1}+1} + x^{4\times10^{n+1}+2} + \dots + x^{4\times10^{n+1} + 10^{n+1}-2} + x^{4\times10^{n+1} + 10^{n+1}-1}\right) +\\
\left(x^{5\times10^{n+1}} + x^{5\times10^{n+1}+1} + x^{5\times10^{n+1}+2} + \dots + x^{5\times10^{n+1} + 10^{n+1}-2} + x^{5\times10^{n+1} + 10^{n+1}-1}\right) +\\
\left(x^{6\times10^{n+1}} + x^{6\times10^{n+1}+1} + x^{6\times10^{n+1}+2} + \dots + x^{6\times10^{n+1} + 10^{n+1}-2} + x^{6\times10^{n+1} + 10^{n+1}-1}\right) +\\
\left(x^{7\times10^{n+1}} + x^{7\times10^{n+1}+1} + x^{7\times10^{n+1}+2} + \dots + x^{7\times10^{n+1} + 10^{n+1}-2} + x^{7\times10^{n+1} + 10^{n+1}-1}\right) +\\
\left(x^{8\times10^{n+1}} + x^{8\times10^{n+1}+1} + x^{8\times10^{n+1}+2} + \dots + x^{8\times10^{n+1} + 10^{n+1}-2} + x^{8\times10^{n+1} + 10^{n+1}-1}\right) +\\
\left(x^{9\times10^{n+1}} + x^{9\times10^{n+1}+1} + x^{9\times10^{n+1}+2} + \dots + x^{9\times10^{n+1} + 10^{n+1}-2} + x^{9\times10^{n+1} + 10^{n+1}-1}\right)\\
\end{align*}

which can be simplified to

\[
\prod_{i=0}^{n+1} \left(1 + x^{10^i} + x^{2\times10^i} + \dots + x^{8\times10^i} + x^{9\times10^i}\right) = 1 + x + x^2 + x^3 + \dots + x^{10^{n+2}-1}
\]

Since this is $p(n+1)$, we have shown that if $p(n)$ is true then $p(n+1)$ must be true, which completes the inductive proof.

\end{proof}

\section{Majority Rules}
\ProblemStatement{
Say $(2n + 1)$ people, including you, have a majority vote in a company for
allowing or disallowing hats to be worn in the company. If you know everyone
else is going to vote uniformly randomly for \say{yes} or \say{no}, what is the
probability that your vote is \say{critical}? (we define your vote to be
\say{critical} if after we fix everyone else's vote, you voting one way or
other changes the result) (optional: with a computer, explore the probability
that your vote is critical for big $n$, or for there being 3 outcomes instead
of 2)
}

The probability that your vote is \say{critical} is
\[
    \binom{2n}{n}\left(\frac{1}{2}\right)^{2n}
\]

\begin{proof}
First we observe that your vote is only critical if the other $2n$ votes
are tied with $n$ voting yes and $n$ voting no. If they were not tied, there
would have to be at least $n+1$ votes on one side and at most $n-1$ votes on
the other, so your vote would not be critical since there is a difference of
two.

There are $\binom{2n}{n}$ ways to choose the $n$ yes votes from among the $2n$
total votes. For each of those ways, the probability that it will occur is
$(\frac{1}{2})^n$ (the chance that all $n$ of the yes voters will vote yes)
times $(\frac{1}{2})^n$ (the chance that all $n$ of the no voters will vote
no). This gives an overall probability of $\binom{2n}{n}(\frac{1}{2})^{2n}$
\end{proof}

\subsection*{Optional}
Here's a Python program which generates $2n$ random votes and measures how often they are evenly split for large values of $n$:
\begin{center}
\begin{lstlisting}[language=Python]
#!/usr/bin/env python3
import random

def is_close(n):
    v = random.getrandbits(2*n)
    return bin(v).count('1') == n

def p_close(n, trials):
    return sum(is_close(n) for i in range(trials)) / trials

for exp in range(20):
    n = 2**exp
    trials = min(2**24, 2**(34-exp))
    print(exp, n, trials, p_close(n, trials), sep='\t')
\end{lstlisting}
\end{center}

\noindent Here's a table summarizing the output:

\begin{center}
\begin{tabular}{ lllr }
\hline
    $n$ & Measured Probability & Predicted Probability & Trials Run\\
\hline
$2^0    = 1     $ & 0.5001128315925598    & 0.5                 & 16777216 \\
$2^1    = 2     $ & 0.37497973442077637   & 0.375               & 16777216 \\
$2^2    = 4     $ & 0.2733776569366455    & 0.273438            & 16777216 \\
$2^3    = 8     $ & 0.19642597436904907   & 0.196381            & 16777216 \\
$2^4    = 16    $ & 0.13995373249053955   & 0.13995             & 16777216 \\
$2^5    = 32    $ & 0.09931820631027222   & 0.0993468           & 16777216 \\
$2^6    = 64    $ & 0.07034200429916382   & 0.0703861           & 16777216 \\
$2^7    = 128   $ & 0.04979640245437622   & 0.0498191           & 16777216 \\
$2^8    = 256   $ & 0.03525400161743164   & 0.0352446           & 16777216 \\
$2^9    = 512   $ & 0.02493804693222046   & 0.02492780589297954 & 16777216 \\
$2^{10} = 1024  $ & 0.017606258392333984  & 0.01762877240484652 & 16777216 \\
$2^{11} = 2048  $ & 0.012477874755859375  & 0.0124661853637603  & 8388608  \\
$2^{12} = 4096  $ & 0.008898258209228516  & 0.0088151932204816  & 4194304  \\
$2^{13} = 8192  $ & 0.006194591522216797  & 0.0062333780167465  & 2097152  \\
$2^{14} = 16384 $ & 0.004390716552734375  & 0.0044076974932754  & 1048576  \\
$2^{15} = 32768 $ & 0.003177642822265625  & 0.0031167246762524  & 524288   \\
$2^{16} = 65536 $ & 0.00229644775390625   & 0.0022038613571975  & 262144   \\
$2^{17} = 131072$ & 0.00154876708984375   & 0.0015583667966430  & 131072   \\
$2^{18} = 262144$ & 0.00140380859375      & 0.001101932254924   & 65536    \\
$2^{19} = 524288$ & 0.000946044921875     & 0.000779183955637   & 32768    \\
\end{tabular}
\end{center}

\section{Time Spent \& Thoughts}

This was a much easier problem set than usual. Problem \#1 tests a hard to understand topic, but it's a very straightforward application of the topic, so it wasn't bad. The decimal problem was a huge pain just because of the volume of equations and making sure that I didn't have any typos in them. I enjoyed the optional part of problem 5, but the rest of the problem set wasn't very interesting. I spent about four hours doing this homework.

\end{document}


% -*- root: ../thesis.tex -*-
%!TEX root = ../thesis.tex
% ******************************* Thesis Appendix A ****************************
\chapter{Appendix}
\section{Example code}

\section{Dataset Plots and statistics}
\clearpage
\subsection{Electricity}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
        Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 2510.68 & 321 & 6755124 & 21044 & 21044 & 0.0 & 764000.0 & 1H\\
        \hline
        test & 2509.92 & 2247 & 47501580 & 21068 & 21212 & 0.0 & 764000.0 & 1H\\
        \hline
    \end{tabular}
    \caption{Statistics of the Electricity dataset.}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/electricity_plot.png}
      \caption{Plot over the average timeseries in the electricity dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:electricity_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{2_background/figures/electricity_no_negative.png}
      \caption{Zoomed version of \ref{fig:electricity_plot}}
      \label{fig:electricity_plot_zooomed}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.65 & 0.17 & 1.0 & 0.09 \\
                \hline
                seasonality & 0.84 & 0.19 & 1.0 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the Electricity dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/electricity_violin.png}
      \caption{Scaled violin plot of the electricity dataset.}
      \label{fig:electricity_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{Exchange Rate}

\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
        Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 0.68 & 8 & 48568 & 6071 & 6071 & 0.01 & 2.11 & 1B\\
        \hline
        test & 0.68 & 40 & 246440 & 6101 & 6221 & 0.01 & 2.11 & 1B\\
        \hline
    \end{tabular}
    \caption{Statistics of the Exchange Rate dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/exchange_rate_plot.png}
      \caption{Plot over the average timeseries in the exchange rate dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:exchange_rate_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 1.0 & 0.0 & 1.0 & 0.99 \\
                \hline
                seasonality & 0.12 & 0.30 & 0.90 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the exchange rate dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/exchange_rate_violin.png}
      \caption{Scaled violin plot of the exchange rate dataset.}
      \label{fig:exchange_rate_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{Solar Energy}

\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 40.35 & 137 & 960233 & 7009 & 7009 & 0.0 & 509.05 & 10min\\
        \hline
        test & 40.25 & 959 & 6813695 & 7033 & 7177 & 0.0 & 509.05 & 10min\\
        \hline
    \end{tabular}
    \caption{Statistics of the Solar Energy dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/solar-energy_plot.png}
      \caption{Plot over the average timeseries in the solar energy dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:solar-energy_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.09 & 0.03 & 0.15 & 0.0 \\
                \hline
                seasonality & 0.84 & 0.02 & 0.87 & 0.79 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the solar-energy dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/solar-energy_violin.png}
      \caption{Scaled violin plot of the solar energy dataset.}
      \label{fig:solar-energy_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{Traffic}

\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 0.06 & 862 & 12099032 & 14036 & 14036 & 0.0 & 0.72 & H\\
        \hline
        test & 0.06 & 6034 & 85272488 & 14060 & 14204 & 0.0 & 0.72 & H\\
        \hline
    \end{tabular}
   \caption{Statistics of the Traffic dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/traffic_plot.png}
      \caption{Plot over the average timeseries in the traffic dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:traffic_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.16 & 0.12 & 0.79 & 0.0 \\
                \hline
                seasonality & 0.67 & 0.10 & 0.93 & 0.12 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the traffic dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/traffic_violin.png}
      \caption{Scaled violin plot of the traffic dataset.}
      \label{fig:traffic_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{Exchange Rate NIPS}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 0.68 & 8 & 48568 & 6071 & 6071 & 0.01 & 2.11 & B\\
        \hline
        test & 0.68 & 40 & 246440 & 6101 & 6221 & 0.01 & 2.11 & B\\
        \hline
    \end{tabular}
   \caption{Statistics of the Exchange Rate NIPS dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/exchange_rate_nips_plot.png}
      \caption{Plot over the average timeseries in the exchange rate nips dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:exchange_rate_nips_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 1.0 & 0.0 & 1.0 & 0.99 \\
                \hline
                seasonality & 0.12 & 0.30 & 0.90 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the exchange rate nips dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/exchange_rate_nips_violin.png}
      \caption{Scaled violin plot of the exchange rate nips dataset.}
      \label{fig:exchange_rate_nips_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{Electricity NIPS}
 \begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 607.95 & 370 & 2142282 & 1081 & 5833 & 0.0 & 168100.0 & H\\
        \hline
        test & 652.36 & 2590 & 10340239 & 1105 & 4000 & 0.0 & 168100.0 & H\\
        \hline
    \end{tabular}
    \caption{Statistics of the Electricity NIPS dataset.}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/electricity_nips_plot.png}
      \caption{Plot over the average timeseries in the electricity nips dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:electricity_nips_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.54 & 0.20 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.86 & 0.16 & 1.0 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the electricity nips dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/electricity_nips_violin.png}
      \caption{Scaled violin plot of the electricity nips dataset.}
      \label{fig:electricity_nips_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{Solar Energy NIPS}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 40.35 & 137 & 960233 & 7009 & 7009 & 0.00 & 509.05 & H\\
        \hline
        test & 40.25 & 959 & 6813695 & 7033 & 7177 & 0.00 & 509.05 & H\\
        \hline
    \end{tabular}
   \caption{Statistics of the Solar Energy NIPS dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/solar_nips_plot.png}
      \caption{Plot over the average timeseries in the solar nips dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:solar_nips_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.17 & 0.02 & 0.24 & 0.11 \\
                \hline
                seasonality & 0.86 & 0.02 & 0.89 & 0.80 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the solar nips dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/solar_nips_violin.png}
      \caption{Scaled violin plot of the solar nips dataset.}
      \label{fig:solar_nips_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{Traffic NIPS}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 0.05 & 963 & 3852963 & 4001 & 4001 & 0.00 & 1.00 & H\\
        \hline
        test & 0.05 & 6741 & 26964000 & 4000 & 4000 & 0.00 & 1.00 & H\\
        \hline
    \end{tabular}
   \caption{Statistics of the Traffic NIPS dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/traffic_nips_plot.png}
      \caption{Plot over the average timeseries in the traffic nips dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:traffic_nips_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.29 & 0.18 & 0.87 & 0.0 \\
                \hline
                seasonality & 0.76 & 0.12 & 0.94 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the traffic nips dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/traffic_nips_violin.png}
      \caption{Scaled violin plot of the traffic nips dataset.}
      \label{fig:traffic_nips_violin}
    \endminipage\hfill
\end{figure}
\clearpage
\subsection{Wiki Rolling NIPS}

\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 3720.54 & 9535 & 7551720 & 792 & 792 & 0.00 & 7752515.00 & D\\
        \hline
        test & 3663.55 & 47675 & 40619100 & 792 & 912 & 0.00 & 7752515.00 & D\\
        \hline
    \end{tabular}
   \caption{Statistics of the Wiki Rolling NIPS dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/wiki-rolling_nips_plot.png}
      \caption{Plot over the average timeseries in the wiki-rolling nips dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:wiki-rolling_nips_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.53 & 0.27 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.23 & 0.26 & 1.0 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the wiki-rolling nips dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/wiki-rolling_nips_violin.png}
      \caption{Scaled violin plot of the wiki-rolling nips dataset.}
      \label{fig:wiki-rolling_nips_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{Taxi}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 8.79 & 1214 & 1806432 & 1488 & 1488 & 0.0 & 265.0 & 30min\\
        \hline
        test & 7.41 & 67984 & 54999056 & 149 & 1469 & 0.0 & 225.0 & 30min\\
        \hline
    \end{tabular}
    \caption{Statistics of the Taxi NIPS dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/taxi_30min_plot.png}
      \caption{Plot over the average timeseries in the taxi dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:taxi_30min_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.02 & 0.02 & 0.16 & 0.0 \\
                \hline
                seasonality & 0.66 & 0.08 & 0.92 & 0.41 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the taxi dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/taxi_30min_violin.png}
      \caption{Scaled violin plot of the taxi dataset.}
      \label{fig:taxi_30min_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{M3 Monthly}

\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c ||}
        \hline
        Dataset & Mean & Series & Items & Shortest & Longest & Min & Max \\ [0.5ex]
        \hline\hline
        train & 4928.47 & 1428 & 141858 & 48 & 126 & 80.00 & 86730.00\\
        \hline
        test & 4971.28 & 1428 & 167562 & 66 & 144 & -1200.00 & 86730.00\\
        \hline
    \end{tabular}
    \caption{Statistics of the M3 Monthly dataset.}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m3_monthly_plot.png}
      \caption{Plot over the average timeseries in the m3 monthly dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:m3_monthly_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.68 & 0.31 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.35 & 0.29 & 1.0 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the m3 monthly dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m3_monthly_violin.png}
      \caption{Scaled violin plot of the m3 monthly dataset.}
      \label{fig:m3_monthly_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{M3 Quarterly}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c ||}
        \hline
        Dataset & Mean & Series & Items & Shortest & Longest & Min & Max \\ [0.5ex]
        \hline\hline
        train & 4819.27 & 756 & 30956 & 16 & 64 & 126.00 & 20245.00\\
        \hline
        test & 4983.53 & 756 & 37004 & 24 & 72 & 121.00 & 20375.00\\
        \hline
    \end{tabular}
    \caption{Statistics of the M3 Quarterly dataset.}
\end{table}
\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m3_quarterly_plot.png}
      \caption{Plot over the average timeseries in the m3 quarterly dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:m3_quarterly_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.88 & 0.19 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.33 & 0.35 & 1.0 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the m3 quarterly dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m3_quarterly_violin.png}
      \caption{Scaled violin plot of the m3 quarterly dataset.}
      \label{fig:m3_quarterly_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{M3 Yearly}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c ||}
        \hline
        Dataset & Mean & Series & Items & Shortest & Longest & Min & Max \\ [0.5ex]
        \hline\hline
        train & 4417.05 & 645 & 14449 & 14 & 41 & 30.00 & 39666.22\\
        \hline
        test & 4815.77 & 645 & 18319 & 20 & 47 & 30.00 & 45525.66\\
        \hline
    \end{tabular}
\caption{Statistics of the M3 Yearly dataset}
\end{table}
\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m3_yearly_plot.png}
      \caption{Plot over the average timeseries in the m3 yearly dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:m3_yearly_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.89 & 0.17 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.09 & 0.17 & 0.96 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the m3 yearly dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m3_yearly_violin.png}
      \caption{Scaled violin plot of the m3 yearly dataset.}
      \label{fig:m3_yearly_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{M3 Other}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c ||}
        \hline
        Dataset & Mean & Series & Items & Shortest & Longest & Min & Max \\ [0.5ex]
        \hline\hline
        train & 6152.18 & 174 & 11933 & 63 & 96 & 28.00 & 59472.00\\
        \hline
        test & 5999.87 & 174 & 13325 & 71 & 104 & 28.00 & 59472.00\\
        \hline
    \end{tabular}
\caption{Statistics of the M3 Other dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m3_other_plot.png}
      \caption{Plot over the average timeseries in the m3 other dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:m3_other_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.94 & 0.17 & 1.0 & 0.35 \\
                \hline
                seasonality & 0.07 & 0.08 & 0.44 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the m3 other dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m3_other_violin.png}
      \caption{Scaled violin plot of the m3 other dataset.}
      \label{fig:m3_other_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{M4 Hourly}

\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 6827.69 & 414 & 353500 & 700 & 960 & 10.00 & 703008.00 & H\\
        \hline
        test & 6859.56 & 414 & 373372 & 748 & 1008 & 10.00 & 703008.00 & H\\
        \hline
    \end{tabular}
    \caption{Statistics of the M4 Hourly dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_hourly_plot.png}
      \caption{Plot over the average timeseries in the m4 hourly dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:m4_hourly_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.62 & 0.37 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.88 & 0.16 & 1.0 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the m4 hourly dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_hourly_violin.png}
      \caption{Scaled violin plot of the m4 hourly dataset.}
      \label{fig:m4_hourly_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{M4 Daily}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 4951.40 & 4227 & 9964658 & 93 & 9919 & 15.00 & 352000.00 & D\\
        \hline
        test & 4960.15 & 4227 & 10023836 & 107 & 9933 & 15.00 & 352000.00 & D\\
        \hline
    \end{tabular}
    \caption{Statistics of the M4 Daily dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_daily_plot.png}
      \caption{Plot over the average timeseries in the m4 daily dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:m4_daily_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.98 & 0.05 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.05 & 0.10 & 1.0 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the m4 daily dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_daily_violin.png}
      \caption{Scaled violin plot of the m4 daily dataset.}
      \label{fig:m4_daily_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{M4 Weekly}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 3738.52 & 359 & 366912 & 80 & 2597 & 104.69 & 51410.00 & W\\
        \hline
        test & 3755.97 & 359 & 371579 & 93 & 2610 & 104.69 & 51410.00 & W\\
        \hline
    \end{tabular}
    \caption{Statistics of the M4 Weekly dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_weekly_plot.png}
      \caption{Plot over the average timeseries in the m4 weekly dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:m4_weekly_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.77 & 0.31 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.34 & 0.35 & 1.0 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the m4 weekly dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_weekly_violin.png}
      \caption{Scaled violin plot of the m4 weekly dataset.}
      \label{fig:m4_weekly_violin}
    \endminipage\hfill
\end{figure}
\clearpage
\subsection{M4 Monthly}

\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 4193.28 & 48000 & 10382411 & 42 & 2794 & 20.00 & 132731.31 & M\\
        \hline
        test & 4207.51 & 48000 & 11246411 & 60 & 2812 & 20.00 & 177950.00 & M\\
        \hline
    \end{tabular}
    \caption{Statistics of the M4 Monthly dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_monthly_plot.png}
      \caption{Plot over the average timeseries in the m4 monthly dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:m4_monthly_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.84 & 0.23 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.32 & 0.30 & 1.0 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the m4 monthly dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_monthly_violin.png}
      \caption{Scaled violin plot of the m4 monthly dataset.}
      \label{fig:m4_monthly_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{M4 Quarterly}

\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 4141.00 & 24000 & 2214108 & 16 & 866 & 19.50 & 82210.70 & 3M\\
        \hline
        test & 4287.13 & 24000 & 2406108 & 24 & 874 & 19.50 & 82210.70 & 3M\\
        \hline
    \end{tabular}
    \caption{Statistics of the M4 Quarterly dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_quarterly_plot.png}
      \caption{Plot over the average timeseries in the m4 quarterly dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:m4_quarterly_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.90 & 0.16 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.20 & 0.27 & 1.0 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the m4 quarterly dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_quarterly_violin.png}
      \caption{Scaled violin plot of the m4 quarterly dataset.}
      \label{fig:m4_quarterly_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{M4 Yearly}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 3630.52 & 23000 & 715065 & 13 & 300 & 22.10 & 115642.00 & 12M\\
        \hline
        test & 4076.24 & 23000 & 852909 & 19 & 300 & 22.00 & 158430.00 & 12M\\
        \hline
    \end{tabular}
    \caption{Statistics of the M4 Yearly dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_yearly_plot.png}
      \caption{Plot over the average timeseries in the m4 yearly dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:m4_yearly_plot}
    \endminipage\hfill
\end{figure}

\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.93 & 0.13 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.09 & 0.16 & 0.98 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the m4 yearly dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m4_yearly_violin.png}
      \caption{Scaled violin plot of the m4 yearly dataset.}
      \label{fig:m4_yearly_violin}
    \endminipage\hfill
\end{figure}

\clearpage
\subsection{M5}
\begin{table}[htb]
    \begin{tabular}{||c | c c c c c c c c ||}
        \hline
       Dataset & Mean & Series & Items & Shortest & Longest & Min & Max & Frequency\\ [0.5ex]
        \hline\hline
        train & 1.12 & 30490 & 57473650 & 1885 & 1885 & 0.00 & 763.00 & D\\
        \hline
        test & 1.13 & 30490 & 58327370 & 1913 & 1913 & 0.00 & 763.00 & D\\
        \hline
    \end{tabular}
    \caption{Statistics of the M5 dataset}
\end{table}

\begin{figure}[htb]
    \centering
    \minipage{1.0\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m5_plot.png}
      \caption{Plot over the average timeseries in the m5 dataset with one standard deviation shown in green. Only positive values are shown as the dataset is non-negative.}
      \label{fig:m5_plot}
    \endminipage\hfill
\end{figure}
\begin{figure}[htb]
    \centering
    \minipage{0.4\textwidth}
        \begin{center}
            \begin{tabular}{||c | c | c | c | c |}
                \hline
                statistic & mean & deviation & max & min\\
                \hline
                trend & 0.38 & 0.32 & 1.0 & 0.0 \\
                \hline
                seasonality & 0.28 & 0.33 & 1.0 & 0.0 \\
                \hline
                \hline
            \end{tabular}
            \caption{Strength of trend and seasonality of the m5 dataset}
        \end{center}
    \endminipage\hfill
     \minipage{0.45\textwidth}
      \includegraphics[width=\linewidth]{4_designing/figures/m5_violin.png}
      \caption{Scaled violin plot of the m5 dataset.}
      \label{fig:m5_violin}
    \endminipage\hfill
\end{figure}


\section{Cryptographic Details}
\label{sec:crypto-details}

\subsection{Hashing}
The hashing algorithm for all verification keys and multi-signature scripts is BLAKE2b-224.
Explicitly, this is the payment and stake credentials (Figure~\ref{fig:defs:addresses}),
the genesis keys and their delegates (Figure~\ref{fig:ts-types:pp-update}),
stake pool verification keys (Figure~\ref{fig:delegation-transitions}),
and VRF verification keys (Figure~\ref{fig:delegation-defs}).

Everywhere else we use BLAKE2b-256.
In the CDDL specification in Appendix~\ref{sec:cddl},
$\mathsf{hash28}$ refers to BLAKE2b-224 and
and $\mathsf{hash32}$ refers to BLAKE2b-256.
BLAKE2 is specified in RFC 7693 \cite{rfcBLAKE2}.

\subsection{Addresses}
The \fun{sign} and \fun{verify} functions from Figure~\ref{fig:crypto-defs-shelley}
use Ed25519. See \cite{rfcEdDSA}.

\subsection{KES}
The \fun{sign_{ev}} and \fun{verify_{ev}} functions from Figure~\ref{fig:kes-defs-shelley}
use the iterated sum construction from Section 3.1 of \cite{cryptoeprint:2001:034}.
We allow up to $2^7$ key evolutions, which is larger than the maximum number
of evolutions allow by the spec, \MaxKESEvo, which will be set to $90$.
See Figure~\ref{fig:rules:ocert}.

\subsection{VRF}
The \fun{verifyVrf} function from Figure~\ref{fig:defs-vrf}
uses ECVRF-ED25519-SHA512-Elligator2 as described in the draft IETF specification
\cite{rfcVRFDraft}.


\documentstyle[11pt,reduce]{article}
\title{A \REDUCE{} package for the computation of several matrix
normal forms}
\author{Matt Rebbeck \\
Konrad-Zuse-Zentrum f\"ur Informationstechnik Berlin \\
Takustra\"se 7  \\
D--14195 Berlin -- Dahlem \\
Federal Republic of Germany \\[0.05in]
E--mail: neun@zib.de \\[0.05in]
}
\date{February 1994}
\begin{document}
\maketitle
\index{NORMFORM package}

\section{Introduction}
When are two given matrices similar? Similar matrices have the same
trace, determinant, \hspace{0in} characteristic polynomial,
\hspace{0in} and eigenvalues, \hspace{0in} but the matrices
\begin{displaymath}
\begin{array}{ccc} {\cal U} = \left( \begin{array}{cc} 0 & 1 \\ 0 &
0 \end{array} \right) & $and$ & {\cal V} = \left( \begin{array}{cc}
0 & 0 \\ 0 & 0 \end{array} \right) \end{array}
\end{displaymath}
are the same in all four of the above but are not similar. Otherwise
there could exist a nonsingular ${\cal N} {\in} M_{2}$ (the set of
all $2 \times 2$ matrices) such that ${\cal U} = {\cal N} \, {\cal V}
\, {\cal N}^{-1} = {\cal N} \, {\it 0} \, {\cal N}^{-1} = {\it 0}$,
which is a contradiction since ${\cal U} \neq {\it 0}$.

Two matrices can look very different but still be similar. One
approach to determining whether two given matrices are similar is to
compute the normal form of them. If both matrices reduce to the same
normal form they must be similar.

{\small NORMFORM} is a package for computing the following normal
forms of matrices:

\begin{verbatim}
 - smithex
 - smithex_int
 - frobenius
 - ratjordan
 - jordansymbolic
 - jordan
\end{verbatim}

The package is loaded by {\tt load\_package normform;}

By default all calculations are carried out in {\cal Q} (the rational
numbers). For {\tt smithex}, {\tt frobenius}, {\tt ratjordan},
{\tt jordansymbolic}, and {\tt jordan}, this field can be extended.
Details are given in the respective sections.

The {\tt frobenius}, {\tt ratjordan}, and {\tt jordansymbolic} normal
forms can also be computed in a modular base. Again, details are given
in the respective sections.

The algorithms for each routine are contained in the source code.

{\small NORMFORM} has been converted from the normform and Normform
packages written by T.M.L. Mulders and A.H.M. Levelt. These have been
implemented in Maple [4].

\section{smithex}

\subsection{function}

{\tt smithex}(${\cal A},\, x$) computes the Smith normal form ${\cal S}$
of the matrix ${\cal A}$.

It returns \{${\cal S}, {\cal P}, {\cal P}^{-1}$\} where ${\cal S},
{\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P S P}^{-1} =
{\cal A}$.

${\cal A}$ is a rectangular matrix of univariate polynomials in $x$.

$x$ is the variable name.

\subsection{field extensions}

Calculations are performed in ${\cal Q}$. To extend this field the
{\small ARNUM} package can be used. For details see {\it section} 8.

\subsection{synopsis}

\begin{itemize}
\item The Smith normal form ${\cal S}$ of an n by m matrix ${\cal A}$
with univariate polynomial entries in $x$ over a field {\it F} is
computed. That is, the polynomials are then regarded as elements of the
{\it E}uclidean domain {\it F}($x$).

\item The Smith normal form is a diagonal matrix ${\cal S}$ where:

  \begin{itemize}
  \item rank(${\cal A}$) = number of nonzero rows (columns) of
        ${\cal S}$.
  \item ${\cal S}(i,\, i)$ is a monic polynomial for 0 $< i \leq $
        rank(${\cal A}$).
  \item ${\cal S}(i,\, i)$ divides ${\cal S}(i+1,\, i+1)$ for 0 $< i
        <$ rank(${\cal A}$).
  \item ${\cal S}(i,\,i)$ is the greatest common divisor of all $i$ by
        $i$ minors of ${\cal A}$.
  \end{itemize}

      Hence, if we have the case that $n = m$, as well as
      rank(${\cal A}$) $= n$, then product (${\cal S}(i,\,i),
      i=1\ldots n$) = det(${\cal A}$) / lcoeff(det$({\cal A}), \, x$).

\item The Smith normal form is obtained by doing elementary row and
      column operations. This includes interchanging rows (columns),
      multiplying through a row (column) by $-1$, and adding integral
      multiples of one row (column) to another.

\item Although the rank and determinant can be easily obtained from
      ${\cal S}$, this is not an efficient method for computing these
      quantities except that this may yield a partial factorization of
      det(${\cal A}$) without doing any explicit factorizations.

\end{itemize}

\subsection{example}

{\tt load\_package normform;}

\begin{displaymath}
{\cal A} = \left( \begin{array}{cc} x & x+1 \\ 0 & 3*x^2 \end{array}
\right)
\end{displaymath}

\begin{displaymath}
\hspace{-0.5in}
\begin{array}{ccc}
{\tt smithex}({\cal A},\, x) & = &
\left\{ \left( \begin{array}{cc} 1 & 0 \\
0 & x^3 \end{array} \right), \left( \begin{array}{cc} 1 & 0 \\ 3*x^2
& 1 \end{array} \right), \left( \begin{array}{cc} x & x+1 \\ -3 & -3
\end{array} \right) \right\} \end{array}
\end{displaymath}

\section{smithex\_int}

\subsection{function}

Given an $n$ by $m$ rectangular matrix ${\cal A}$ that contains
{\it only} integer entries, {\tt smithex\_int}(${\cal A}$) computes the
Smith normal form ${\cal S}$ of ${\cal A}$.

It returns \{${\cal S}, {\cal P}, {\cal P}^{-1}$\} where ${\cal S},
{\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P S P}^{-1} =
{\cal A}$.

\subsection{synopsis}

\begin{itemize}
\item The Smith normal form ${\cal S}$ of an $n$ by $m$ matrix
${\cal A}$ with integer entries is computed.

\item The Smith normal form is a diagonal matrix ${\cal S}$ where:

  \begin{itemize}
  \item rank(${\cal A}$) = number of nonzero rows (columns) of
        ${\cal S}$.
  \item sign(${\cal S}(i,\, i)$) = 1 for 0 $< i \leq $ rank(${\cal A}$).
  \item ${\cal S}(i,\, i)$ divides ${\cal S}(i+1,\, i+1)$ for 0 $< i
        <$ rank(${\cal A}$).
  \item ${\cal S}(i,\,i)$ is the greatest common divisor of all $i$ by
        $i$ minors of ${\cal A}$.
  \end{itemize}

      Hence, if we have the case that $n = m$, as well as
      rank(${\cal A}$) $= n$, then abs(det(${\cal A}$)) =
      product(${\cal S}(i,\,i),i=1\ldots n$).

\item The Smith normal form is obtained by doing elementary row and
      column operations. This includes interchanging rows (columns),
      multiplying through a row (column) by $-1$, and adding integral
      multiples of one row (column) to another.
\end{itemize}

\subsection{example}

{\tt load\_package normform;}

\begin{displaymath}
{\cal A} = \left( \begin{array}{ccc} 9 & -36 & 30 \\ -36 & 192 & -180 \\
30 & -180 & 180  \end{array}
\right)
\end{displaymath}

{\tt smithex\_int}(${\cal A}$) =
\begin{center}
\begin{displaymath}
\left\{ \left( \begin{array}{ccc} 3 & 0 & 0 \\ 0 & 12 & 0 \\ 0 & 0 & 60
\end{array} \right), \left( \begin{array}{ccc} -17 & -5 & -4 \\ 64 & 19
& 15 \\ -50 & -15 & -12 \end{array} \right), \left( \begin{array}{ccc}
1 & -24 & 30 \\ -1 & 25 & -30 \\ 0 & -1 & 1 \end{array} \right) \right\}
\end{displaymath}
\end{center}

\section{frobenius}

\subsection{function}

{\tt frobenius}(${\cal A}$) computes the Frobenius normal form
${\cal F}$ of the matrix ${\cal A}$.

It returns \{${\cal F}, {\cal P}, {\cal P}^{-1}$\} where ${\cal F},
{\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P F P}^{-1} =
{\cal A}$.

${\cal A}$ is a square matrix.

\subsection{field extensions}

Calculations are performed in ${\cal Q}$. To extend this field the
{\small ARNUM} package can be used. For details see {\it section} 8.

\subsection{modular arithmetic}

{\tt frobenius} can be calculated in a modular base. For details see
{\it section} 9.

\subsection{synopsis}

\begin{itemize}
\item ${\cal F}$ has the following structure:
      \begin{displaymath}
      {\cal F} = \left( \begin{array}{cccc} {\cal C}{\it p_{1}} &  &  &
      \\  & {\cal C}{\it p_{2}} &  &  \\  &  & \ddots &  \\  &  &  &
      {\cal C}{\it p_{k}} \end{array} \right)
      \end{displaymath}
      where the ${\cal C}({\it p_{i}})$'s are companion matrices
      associated with polynomials ${\it p_{1}, p_{2}},\ldots,
      {\it p_{k}}$, with the property that ${\it p_{i}}$ divides
      ${\it p_{i+1}}$ for $i =1\ldots k-1$. All unmarked entries are
      zero.

\item The Frobenius normal form defined in this way is unique (ie: if
      we require that ${\it p_{i}}$ divides ${\it p_{i+1}}$ as above).
\end{itemize}

\subsection{example}

{\tt load\_package normform;}

\begin{displaymath}
{\cal A} = \left( \begin{array}{cc} \frac{-x^2+y^2+y}{y} &
\frac{-x^2+x+y^2-y}{y} \\ \frac{-x^2-x+y^2+y}{y} & \frac{-x^2+x+y^2-y}
{y} \end{array} \right)
\end{displaymath}

{\tt frobenius}(${\cal A}$) =
\begin{center}
\begin{displaymath}
\left\{ \left( \begin{array}{cc} 0 & \frac{x*(x^2-x-y^2+y)}{y} \\ 1 &
\frac{-2*x^2+x+2*y^2}{y} \end{array} \right), \left( \begin{array}{cc}
1 & \frac{-x^2+y^2+y}{y} \\ 0 & \frac{-x^2-x+y^2+y}{y} \end{array}
\right), \left( \begin{array}{cc} 1 & \frac{-x^2+y^2+y}{x^2+x-y^2-y} \\
0 & \frac{-y}{x^2+x-y^2-y} \end{array} \right) \right\}
\end{displaymath}
\end{center}

\section{ratjordan}

\subsection{function}

{\tt ratjordan}(${\cal A}$) computes the rational Jordan normal form
${\cal R}$ of the matrix ${\cal A}$.

It returns \{${\cal R}, {\cal P}, {\cal P}^{-1}$\} where ${\cal R},
{\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P R P}^{-1} =
{\cal A}$.

${\cal A}$ is a square matrix.

\subsection{field extensions}

Calculations are performed in ${\cal Q}$. To extend this field the
{\small ARNUM} package can be used. For details see {\it section} 8.

\subsection{modular arithmetic}

{\tt ratjordan} can be calculated in a modular base. For details see
{\it section} 9.

\subsection{synopsis}

\begin{itemize}
\item ${\cal R}$ has the following structure:
      \begin{displaymath}
      {\cal R} = \left( \begin{array}{cccccc} {\it r_{11}} \\  &
      {\it r_{12}} \\  &  & \ddots \\  &  &  & {\it r_{21}}  \\ &  &
      &  & {\it r_{22}} \\ &  &  &  &  & \ddots \end{array} \right)
      \end{displaymath}

      The ${\it r_{ij}}$'s have the following shape:
      \begin{displaymath}
      {\it r_{ij}} = \left( \begin{array}{ccccc} {\cal C}({\it p}) &
      {\cal I}  &  &  & \\  &  {\cal C}({\it p}) & {\cal I}  & & \\ &
      & \ddots & \ddots & \\ &  &  &  {\cal C}({\it p}) & {\cal I} \\ &
      &  &  & {\cal C}({\it p}) \end{array} \right)
      \end{displaymath}

      where there are e${\it ij}$ times ${\cal C}({\it p})$ blocks
      along the diagonal and ${\cal C}({\it p})$ is the companion
      matrix  associated with the irreducible polynomial ${\it p}$. All
      unmarked entries are zero.
\end{itemize}

\subsection{example}

{\tt load\_package normform;}

\begin{displaymath}
{\cal A} = \left( \begin{array}{cc} x+y & 5 \\ y & x^2  \end{array}
\right)
\end{displaymath}

{\tt ratjordan}(${\cal A}$) =
\begin{center}
\begin{displaymath}
\left\{ \left( \begin{array}{cc} 0 & -x^3-x^2*y+5*y \\ 1 &
x^2+x+y \end{array} \right), \left( \begin{array}{cc}
1 & x+y \\ 0 & y \end{array} \right), \left( \begin{array}{cc} 1 &
\frac{-(x+y)}{y} \\ 0 & \hspace{0.2in} \frac{1}{y} \end{array} \right)
\right\}
\end{displaymath}
\end{center}

\section{jordansymbolic}

\subsection{function}

{\tt jordansymbolic}(${\cal A}$) \hspace{0in} computes the Jordan
normal form ${\cal J}$of the matrix ${\cal A}$.

It returns \{${\cal J}, {\cal L}, {\cal P}, {\cal P}^{-1}$\}, where
${\cal J}, {\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P J P}^
{-1} = {\cal A}$. ${\cal L}$ = \{ {\it ll} , $\xi$ \}, where $\xi$ is
a name and {\it ll} is a list of irreducible factors of ${\it p}(\xi)$.

${\cal A}$ is a square matrix.

\subsection{field extensions}

Calculations are performed in ${\cal Q}$. To extend this field the
{\small ARNUM} package can be used. For details see {\it section} 8.

\subsection{modular arithmetic}

{\tt jordansymbolic} can be calculated in a modular base. For details
see {\it section} 9.

\subsection{extras}

If using {\tt xr}, the X interface for \REDUCE, the appearance of the
output can be improved by switching {\tt on looking\_good;}. This
converts all lambda to $\xi$ and improves the indexing, eg: lambda12
$\Rightarrow \xi_{12}$. The example ({\it section} 6.6) shows the
output when this switch is on.

\subsection{synopsis}

\begin{itemize}
\item A {\it Jordan block} ${\jmath}_{k}(\lambda)$ is a $k$ by $k$
      upper triangular matrix of the form:

      \begin{displaymath}
      {\jmath}_{k}(\lambda) = \left( \begin{array}{ccccc} \lambda & 1
      &  &  & \\  &  \lambda & 1  & & \\ &
      & \ddots & \ddots & \\ &  &  &  \lambda & 1 \\ &
      &  &  & \lambda \end{array} \right)
      \end{displaymath}

      There are $k-1$ terms ``$+1$'' in the superdiagonal; the scalar
      $\lambda$ appears $k$ times on the main diagonal. All other
      matrix entries are zero, and ${\jmath}_{1}(\lambda) = (\lambda)$.

\item A Jordan matrix ${\cal J} \in M_{n}$ (the set of all $n$ by $n$
      matrices) is a direct sum of {\it jordan blocks}.

      \begin{displaymath}
      {\cal J} = \left( \begin{array}{cccc} \jmath_{n_1}(\lambda_{1})
      \\  & \jmath_{n_2}(\lambda_{2}) \\ & & \ddots \\ & & &
      \jmath_{n_k}(\lambda_{k}) \end{array} \right),
      {\it n}_{1}+{\it n}_{2}+\cdots +{\it n}_{k} = n
      \end{displaymath}

      in which the orders ${\it n}_{i}$ may not be distinct and the
      values ${\lambda_{i}}$ need not be distinct.

\item Here ${\lambda}$ is a zero of the characteristic polynomial
      ${\it p}$ of ${\cal A}$. If ${\it p}$ does not split completely,
      symbolic names are chosen for the missing zeroes of ${\it p}$.
      If, by some means, one knows such missing zeroes, they can be
      substituted for the symbolic names. For this,
      {\tt jordansymbolic} actually returns $\{ {\cal J,L,P,P}^{-1} \}$.
      ${\cal J}$ is the Jordan normal form of ${\cal A}$ (using
      symbolic names if necessary). ${\cal L} = \{ {\it ll}, \xi \}$,
      where $\xi$ is a name and ${\it ll}$ is a list of irreducible
      factors of ${\it p}(\xi)$. If symbolic names are used then
      ${\xi}_{ij}$ is a zero of ${\it ll}_{i}$. ${\cal P}$ and
      ${\cal P}^{-1}$ are as above.
\end{itemize}

\subsection{example}

{\tt load\_package normform;}\\
{\tt on looking\_good;}

\begin{displaymath}
{\cal A} = \left( \begin{array}{cc} 1 & y \\ y^2 & 3  \end{array}
\right)
\end{displaymath}

{\tt jordansymbolic}(${\cal A}$) =
\begin{eqnarray}
 & & \left\{ \left( \begin{array}{cc} \xi_{11} & 0 \\ 0 & \xi_{12}
\end{array} \right) ,
\left\{ \left\{ -y^3+\xi^2-4*\xi+3 \right\}, \xi \right\}, \right.
\nonumber \\ & & \hspace{0.1in} \left. \left( \begin{array}{cc}
\xi_{11} -3 & \xi_{12} -3 \\ y^2 & y^2
\end{array} \right), \left( \begin{array}{cc} \frac{\xi_{11} -2}
{2*(y^3-1)} & \frac{\xi_{11} + y^3 -1}{2*y^2*(y^3+1)} \\
\frac{\xi_{12} -2}{2*(y^3-1)} & \frac{\xi_{12}+y^3-1}{2*y^2*(y^3+1)}
\end{array} \right) \right\} \nonumber
\end{eqnarray}

\vspace{0.2in}
\begin{flushleft}
\begin{math}
{\tt solve(-y^3+xi^2-4*xi+3,xi)}${\tt ;}$
\end{math}
\end{flushleft}

\vspace{0.1in}
\begin{center}
\begin{math}
\{ \xi = \sqrt{y^3+1} + 2,\, \xi = -\sqrt{y^3+1}+2 \}
\end{math}
\end{center}

\vspace{0.1in}
\begin{math}
{\tt {\cal J}  = sub}{\tt (}{\tt \{ xi(1,1)=sqrt(y^3+1)+2,\, xi(1,2) =
-sqrt(y^3+1)+2\},}
\end{math}
\\ \hspace*{0.29in} {\tt first  jordansymbolic (${\cal A}$));}

\vspace{0.2in}
\begin{displaymath}
{\cal J} = \left( \begin{array}{cc} \sqrt{y^3+1} + 2 & 0 \\ 0 &
-\sqrt{y^3+1} + 2 \end{array} \right)
\end{displaymath}

\vspace{0.2in}
For a similar example ot this in standard {\REDUCE} (ie: not using
{\tt xr}), see the {\it normform.log} file.

\vspace{0.5in}

\section{jordan}

\subsection{function}

{\tt jordan}(${\cal A}$) computes the Jordan normal form
${\cal J}$ of the matrix ${\cal A}$.

It returns \{${\cal J}, {\cal P}, {\cal P}^{-1}$\}, where
${\cal J}, {\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P J P}^
{-1} = {\cal A}$.

${\cal A}$ is a square matrix.

\subsection{field extensions}

Calculations are performed in ${\cal Q}$. To extend this field the
{\small ARNUM} package can be used. For details see {\it section} 8.

\subsection{note}
In certain polynomial cases {\tt fullroots} is turned on to compute the
zeroes. This can lead to the calculation taking a long time, as well as
the output being very large. In this case a message {\tt ***** WARNING:
fullroots turned on. May take a while.} will be printed. It may be
better to kill the calculation and compute {\tt jordansymbolic} instead.

\subsection{synopsis}

\begin{itemize}
\item The Jordan normal form ${\cal J}$ with entries in an algebraic
      extension of ${\cal Q}$ is computed.

\item A {\it Jordan block} ${\jmath}_{k}(\lambda)$ is a $k$ by $k$
      upper triangular matrix of the form:

      \begin{displaymath}
      {\jmath}_{k}(\lambda) = \left( \begin{array}{ccccc} \lambda & 1
      &  &  & \\  &  \lambda & 1  & & \\ &
      & \ddots & \ddots & \\ &  &  &  \lambda & 1 \\ &
      &  &  & \lambda \end{array} \right)
      \end{displaymath}

      There are $k-1$ terms ``$+1$'' in the superdiagonal; the scalar
      $\lambda$ appears $k$ times on the main diagonal. All other
      matrix entries are zero, and ${\jmath}_{1}(\lambda) = (\lambda)$.

\item A Jordan matrix ${\cal J} \in M_{n}$ (the set of all $n$ by $n$
      matrices) is a direct sum of {\it jordan blocks}.

      \begin{displaymath}
      {\cal J} = \left( \begin{array}{cccc} \jmath_{n_1}(\lambda_{1})
      \\  & \jmath_{n_2}(\lambda_{2}) \\ & & \ddots \\ & & &
      \jmath_{n_k}(\lambda_{k}) \end{array} \right),
      {\it n}_{1}+{\it n}_{2}+\cdots +{\it n}_{k} = n
      \end{displaymath}

      in which the orders ${\it n}_{i}$ may not be distinct and the
      values ${\lambda_{i}}$ need not be distinct.

\item Here ${\lambda}$ is a zero of the characteristic polynomial
      ${\it p}$ of ${\cal A}$. The zeroes of the characteristic
      polynomial are computed exactly, if possible. Otherwise they are
      approximated by floating point numbers.
\end{itemize}

\subsection{example}

{\tt load\_package normform;}

\begin{displaymath}
{\cal A} = \left( \begin{array}{cccccc} -9 & -21 & -15 & 4 & 2 & 0 \\
-10 & 21 & -14 & 4 & 2 & 0 \\ -8 & 16 & -11 & 4 & 2 & 0 \\ -6 & 12 & -9
& 3 & 3 & 0 \\ -4 & 8 & -6 & 0 & 5 & 0 \\ -2 & 4 & -3 & 0 & 1 & 3
\end{array} \right)
\end{displaymath}

\begin{flushleft}
{\tt ${\cal J}$ = first jordan$({\cal A})$;}
\end{flushleft}

\begin{displaymath}
{\cal J} = \left( \begin{array}{cccccc} 3 & 0 & 0 & 0 & 0 & 0 \\ 0 & 3
& 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\
 0 & 0 & 0 & 0 & i+2 & 0 \\ 0 & 0 & 0 & 0 & 0 & -i+2
\end{array} \right)
\end{displaymath}

\newpage

\section{arnum}

The package is loaded by {\tt load\_package arnum;}. The algebraic
field ${\cal Q}$ can now be extended. For example, {\tt defpoly
sqrt2**2-2;} will extend it to include ${\sqrt{2}}$ (defined here by
{\tt sqrt2}). The {\small ARNUM} package was written by Eberhard
Schr\"ufer and is described in the {\it arnum.tex} file.

\subsection{example}

{\tt load\_package normform;} \\
{\tt load\_package arnum;} \\
{\tt defpoly sqrt2**2-2;} \\
(sqrt2 now changed to ${\sqrt{2}}$ for looks!)
\vspace{0.2in}

\begin{displaymath}
{\cal A} = \left( \begin{array}{ccc} 4*{\sqrt{2}}-6 & -4*{\sqrt{2}}+7 &
-3*{\sqrt{2}}+6 \\ 3*{\sqrt{2}}-6 & -3*{\sqrt{2}}+7 & -3*{\sqrt{2}}+6
\\ 3*{\sqrt{2}} & 1-3*{\sqrt{2}} & -2*{\sqrt{2}}   \end{array} \right)
\end{displaymath}
\vspace{0.2in}

\begin{eqnarray}
{\tt ratjordan}({\cal A}) & = &
\left\{ \left( \begin{array}{ccc} {\sqrt{2}} & 0 & 0 \\ 0 & {\sqrt{2}}
& 0 \\ 0 & 0 & -3*{\sqrt{2}}+1 \end{array} \right), \right. \nonumber
\\ & & \hspace{0.1in} \left. \left( \begin{array}{ccc} 7*{\sqrt{2}}-6
& \frac{2*{\sqrt{2}}-49}{31} & \frac{-21*{\sqrt{2}}+18}{31} \\
3*{\sqrt{2}}-6 & \frac{21*{\sqrt{2}}-18}{31} & \frac{-21*{\sqrt{2}}+18}
{31} \\ 3*{\sqrt{2}}+1 & \frac{-3*{\sqrt{2}}+24}{31} &
\frac{3*{\sqrt{2}}-24}{31} \end{array} \right), \right. \nonumber \\ &
& \hspace{0.1in} \left. \left( \begin{array}{ccc} 0 & {\sqrt{2}}+1 &
1 \\ -1 & 4*{\sqrt{2}}+9 & 4*{\sqrt{2}} \\ -1 & -\frac{1}{6}*{\sqrt{2}}
+1 & 1 \end{array} \right) \right\} \nonumber
\end{eqnarray}

\newpage

\section{modular}

Calculations can be performed in a modular base by switching {\tt on
modular;}. The base can then be set by {\tt setmod p;} (p a prime). The
normal form will then have entries in ${\cal Z}/$p${\cal Z}$.

By also switching {\tt on balanced\_mod;} the output will be shown using
a symmetric modular representation.

Information on this modular manipulation can be found in {\it chapter}
9 (Polynomials and Rationals) of the {\REDUCE}  User's Manual [5].

\subsection{example}

{\tt load\_package normform;} \\
{\tt on modular;} \\
{\tt setmod 23;}
\vspace{0.1in}

\begin{displaymath}
{\cal A} = \left( \begin{array}{cc} 10 & 18 \\ 17 & 20 \end{array}
\right)
\end{displaymath}

{\tt jordansymbolic}(${\cal A}$) =
\begin{center}
\begin{displaymath}
\left\{ \left( \begin{array}{cc} 18 & 0 \\ 0 & 12 \end{array} \right),
\left\{ \left\{ \lambda + 5, \lambda + 11  \right\}, \lambda \right\},
\left( \begin{array}{cc} 15 & 9 \\ 22 & 1 \end{array} \right), \left(
\begin{array}{cc} 1 & 14 \\ 1 & 15 \end{array} \right) \right\}
\end{displaymath}
\end{center}
\vspace{0.2in}

{\tt on balanced\_mod;}
\vspace{0.2in}

{\tt jordansymbolic}(${\cal A}$) =
\begin{center}
\begin{displaymath}
\left\{ \left( \begin{array}{cc} -5 & 0 \\ 0 & -11 \end{array} \right),
\left\{ \left\{ \lambda + 5, \lambda + 11  \right\}, \lambda \right\},
\left( \begin{array}{cc} -8 & 9 \\ -1 & 1 \end{array} \right), \left(
\begin{array}{cc} 1 & -9 \\ 1 & -8 \end{array} \right) \right\}
\end{displaymath}
\end{center}

\newpage
\begin{thebibliography}{6}
\bibitem{MulLev} T.M.L.Mulders and A.H.M. Levelt: {\it The Maple
        normform and Normform packages.} (1993)
\bibitem{Mulders} T.M.L.Mulders: {\it Algoritmen in De Algebra, A
        Seminar on Algebraic Algorithms, Nigmegen.} (1993)
\bibitem{HoJo} Roger A. Horn and Charles A. Johnson: {\it Matrix
        Analysis.} Cambridge University Press (1990)
\bibitem{Maple} Bruce W. Chat\ldots [et al.]: {\it Maple (Computer
        Program)}. Springer-Verlag (1991)
\bibitem{Reduce} Anthony C. Hearn: {\REDUCE} {\it User's Manual 3.6.}
	RAND (1995)
\end{thebibliography}

\end{document}


\documentclass[aspectratio=169]{beamer}
\input{../util/beamerpreamble.tex}

\title[GB13604]{GB13604 - Maths for Computer Science}
\subtitle[]{Lecture 3 -- Number Theory}
\author[Claus Aranha]{Claus Aranha\\{\footnotesize caranha@cs.tsukuba.ac.jp}}
\institute[COINS]{College of Information Science}
\date[2020-10-21]{2020-10-21\\{\tiny Last updated \today}}

\begin{document}

\begin{frame}
  \maketitle

  \begin{columns}
    \column{0.8\textwidth}
    {\smaller This course is based on Mathematics for Computer Science, Spring
    2015, by Albert Meyer and Adam Chlipala, Massachusetts Institute
    of Technology OpenCourseWare.}
    \column{0.2\textwidth}
    \includegraphics[width=\textwidth]{../img/by-nc-sa}
  \end{columns}
\end{frame}

\begin{frame}{Lecture Outline}

  Number Theory: From division to the RSA algorithm (textbook chapter 8).\bigskip

  \begin{itemize}
    \item Division and the Greatest Common Divisor (GCD);
    \item Primality, and simple cryptography;
    % First part of Turing crypto here
    \item Modular Arithmetic, and Euler's theorem;
    % Second part of Turing crypto here
    \item The RSA public key algorithm;
  \end{itemize}\bigskip

  Let's get started!
\end{frame}

\input{01_Divisibility.tex}
\input{02_CommonDivisor.tex}
\input{03_Primality.tex}
% Turing Code 1.0
\input{04_ModularArithmetic.tex}
% Turing Code 2.0
\input{05_RSA.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Conclusion}

\input{../util/lastslide.tex}
\end{document}


\documentclass[t,usenames,dvipsnames]{beamer}
\usetheme{Copenhagen}
\setbeamertemplate{headline}{} % remove toc from headers
\beamertemplatenavigationsymbolsempty

\usepackage{amsmath, tkz-euclide, tikz, xcolor, pgfplots, array}
\usetkzobj{all}
\pgfplotsset{compat = 1.16}
\usetikzlibrary{arrows.meta, calc, decorations.pathreplacing}
\pgfplotsset{every axis/.append style = {axis lines = middle, axis line style = {<->}}}
\pgfplotsset{every tick label/.append style={font=\tiny}}
\everymath{\displaystyle}

\title{Trig Equations}
\author{}
\date{}

\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Objectives}
    \tableofcontents[currentsection]
  \end{frame}
}

\begin{document}

\begin{frame}
    \maketitle
\end{frame}

\section{Solve trigonometric equations}

\begin{frame}{Trig Equations}
    A \alert{trigonometric equation} is one that contains a trig function with variable, such as $\sin x = \frac{1}{2}$.
\end{frame}

\begin{frame}{Trig Equations}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
xmin = -5, xmax = 12,
ymin = -1.5, ymax = 1.5,
xtick = {-3.67, 0.524, 2.618, 6.809, 8.901},
xticklabels = {$-\frac{7\pi}{6}$, $\frac{\pi}{6}$, $\frac{5\pi}{6}$, $\frac{13\pi}{6}$, $\frac{17\pi}{6}$}
]
\addplot [<->,>=stealth,very thick,domain=-4:10.5, samples = 300, smooth, blue] {sin(deg(x))};
\addplot+ [<->, domain=-5:12, no marks, very thick] {0.5};
\addplot [color=blue, mark=*] coordinates {(-3.67,0.5) (0.524,0.5) (2.618,0.5) (6.809,0.5) (8.901,0.5)};
\end{axis}
\end{tikzpicture}
\end{center}
\end{frame}

\begin{frame}{General Form of Solutions}
The \alert{general form} of this solution is
\[x = \frac{\pi}{6}+2\pi n \quad \text{or} \quad x = \frac{5\pi}{6} + 2\pi n \]

where $2\pi$ is the \alert{period} of the sine function.  \newline\\  \pause

Since there are an infinite number of solutions, we will usually confine our answers to be between 0 and $2\pi$.
\end{frame}

\begin{frame}{How to Solve a Trig Equation}
    \begin{enumerate}
        \item Get the trig function by itself, if possible.    \newline\\
        \item Solve for the variable using inverse trig.
    \end{enumerate}
\end{frame}

\begin{frame}{Example 1}
Solve each of the following in the interval $[0, 2\pi)$.    \newline\\
(a) \quad $\cos(2x) = -\frac{\sqrt{3}}{2}$
\begin{align*}
    \onslide<2->{2x &= 150^\circ + 360n & 2x &= 210 + 360n} \\[8pt]
    \onslide<3->{x &= 75^\circ + 180n & x &= 105^\circ + 180n} \\[8pt]
    \onslide<4->{x &= 75^\circ, \, 255^\circ & x &= 105^\circ, \, 285^\circ} \\[8pt]
\end{align*}
\onslide<5->{
\[ x = \left\{\frac{5\pi}{12}, \, \frac{7\pi}{12}, \, \frac{17\pi}{12}, \, \frac{19\pi}{12} \right\} \]}
\end{frame}

\begin{frame}{Example 1}
(b) \quad $\csc\left(\frac{1}{3}x-\pi\right) = \sqrt{2}$
\begin{align*}
    \onslide<2->{\frac{1}{3}x - 180^\circ &= 45^\circ + 360n & \frac{1}{3}x - 180^\circ &= 135^\circ + 360n}   \\[8pt]
    \onslide<3->{\frac{1}{3}x &= 225^\circ + 360n & \frac{1}{3}x &= 315^\circ + 360n} \\[8pt]
    \onslide<4->{x &= 675^\circ + 1080n & x &= 945^\circ + 1080n} \\[8pt]
\end{align*}
\begin{center}
    \onslide<5->{No angles between 0 and $2\pi$}
\end{center}
\end{frame}

\begin{frame}{Example 1}
(c) \quad $\cot(3x) = 0$
\begin{align*}
    \onslide<2->{3x &= 90^\circ + 180n & 3x &= 270^\circ + 180n} \\[8pt]
    \onslide<3->{x &= 30^\circ + 60n & x &= 90^\circ + 60n} \\[8pt]
    \onslide<4->{x &= 30^\circ, 90^\circ, 150^\circ, 210^\circ, 270^\circ, 330^\circ & x &= 90^\circ, 150^\circ, \dots} \\
\end{align*}
\[ \onslide<5->{x = \left\{\frac{\pi}{6}, \, \frac{\pi}{2}, \, \frac{5\pi}{6}, \, \frac{7\pi}{6}, \, \frac{3\pi}{2}, \, \frac{11\pi}{6}\right\}} \]
\end{frame}

\begin{frame}{Example 1}
(d) \quad $\sec^2 x = 4$
\begin{align*}
    \onslide<2->{\sqrt{\sec^2 x} &= \pm\sqrt{4} & &} \\[6pt]
    \onslide<3->{\sec x &= 2 & \sec x &= -2} \\[6pt]
    \onslide<4->{x &= 60^\circ, 300^\circ & x &= 120^\circ, 240^\circ}
\end{align*}

\onslide<5->{\[ x = \left\{ \frac{\pi}{3}, \frac{2\pi}{3}, \frac{4\pi}{3}, \frac{5\pi}{3}\right\} \]}
\end{frame}

\begin{frame}{Example 1}
(e) \quad $\tan\left(\frac{x}{2}\right) = -3$
\begin{align*}
    \onslide<2->{\frac{x}{2} &= \tan^{-1}(-3) + 180n & (\arctan(-3) \approx -143^\circ)}    \\[12pt]
    \onslide<3->{x &= 2\tan^{-1}(-3) + 360n & (2\arctan(-3) \approx -286^\circ)} \\[12pt]
    \onslide<4->{x &= 2\tan^{-1}(-3) + 360^\circ} \\[12pt]
    \onslide<5->{x &= 2\tan^{-1}(-3) + 2\pi  &}
\end{align*}
\end{frame}

\begin{frame}{Using Algebraic Techniques and Trig Identities}
The following examples make use of trig identities and algebraic techniques to solve the equations.
\end{frame}

\begin{frame}{Example 2}
Solve each in the interval $[0, 2\pi)$  \newline\\
(a) \quad $3\sin^3 x = \sin^2 x$
\begin{align*}
    \onslide<2->{3\sin^3 x - \sin^2 x &= 0 & &} \\[6pt]
    \onslide<3->{\sin^2 x(3\sin x - 1) &= 0 & &} \\[6pt]
    \onslide<4->{\sin^2 x &= 0 & 3\sin x - 1 &= 0} \\[6pt]
    \onslide<5->{\sin x &= 0 & \sin x = \frac{1}{3}} \\[6pt]
    \onslide<6->{x &= 0, 180^\circ & x &\approx 19.471^\circ, 160.529^\circ}
\end{align*}
\[ \onslide<7->{x = \left\{0, \, \arcsin\left(\frac{1}{3}\right), \, \pi - \arcsin\left(\frac{1}{3}\right), \, \pi \right\}}
\]
\end{frame}

\begin{frame}{Example 2}
(b) \quad $\sec^2 x = \tan x + 3$
\begin{align*}
    \onslide<2->{\tan^2 x + 1 &= \tan x + 3} \\[6pt]
    \onslide<3->{\tan^2 x - \tan x - 2 &= 0} \\[6pt]
    \onslide<4->{(\tan x - 2)(\tan x + 1) &= 0}
\end{align*}
\begin{align*}
    \onslide<5->{\tan x - 2 &= 0 & \tan x + 1 &= 0} \\
    \onslide<6->{\tan x &= 2 & \tan x &= -1}    \\
    \onslide<7->{x &\approx 63.5^\circ, 243.5^\circ & x &= 135^\circ, 315^\circ}
\end{align*}
\[
\onslide<8->{x = \left\{\arctan(2), \, \frac{3\pi}{4}, \, \pi + \arctan(2), \, \frac{7\pi}{4} \right\}}
\]
\end{frame}

\begin{frame}{Example 2}
(c) \quad $\cos(2x) = 3\cos x - 2$
\begin{align*}
    \onslide<2->{2\cos^2 x - 1 &= 3\cos x - 2} \\
    \onslide<3->{2\cos^2 x - 3\cos x + 1 &= 0} \\
    \onslide<4->{(2\cos x - 1)(\cos x - 1) &= 0}
\end{align*}
\begin{align*}
    \onslide<5->{2\cos x - 1 &= 0 & \cos x - 1 &= 0} \\
    \onslide<6->{\cos x &= \frac{1}{2} & \cos x &= 1} \\[6pt]
    \onslide<7->{x &= 60^\circ, 300^\circ & x &= 0}
\end{align*}

\[
\onslide<8->{x = \left\{ 0, \, \frac{\pi}{3}, \, \frac{5\pi}{3} \right\}}
\]
\end{frame}

\begin{frame}{Example 2}
(d) \quad $\sin(2x) = \sqrt{3}\cos x$
\begin{align*}
    \onslide<2->{2\sin x \cos x &= \sqrt{3}\cos x} \\
    \onslide<3->{2\sin x \cos x - \sqrt{3} \cos x &= 0} \\
    \onslide<4->{\cos x(2\sin x - \sqrt{3}) &= 0} \\
\end{align*}
\begin{align*}
    \onslide<5->{\cos x &= 0 & 2\sin x - \sqrt{3} &= 0} \\
    \onslide<6->{x &= 90^\circ, 270^\circ & 2\sin x &= \sqrt{3}} \\
    \onslide<7->{& & \sin x &= \frac{\sqrt{3}}{2}} \\[6pt]
    \onslide<8->{& & x &= 60^\circ, 120^\circ}
\end{align*}
\end{frame}

\begin{frame}{Example 2}
    \begin{align*}
        x &= 60^\circ, \, 90^\circ, \, 120^\circ, \, 270^\circ \\[12pt]
        \onslide<2->{x &= \left\{\frac{\pi}{3}, \, \frac{\pi}{2}, \, \frac{2\pi}{3}, \, \frac{3\pi}{2} \right\}}
    \end{align*}
\end{frame}

\end{document}