\documentclass[letterpaper]{article}

\usepackage{fullpage}
\usepackage{nopageno}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[utf8]{inputenc}
\allowdisplaybreaks

\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}

\begin{document}
\title{Notes}
\date{September 17, 2014}
\maketitle
\section*{2.7a}
show that $(a_n)=\left(\frac{n\cos^n(n)}{\sqrt{n^2+2n}}\right)_{n=1}^\infty$ has a convergent sequence

$n/\sqrt{n^2+2n}<1$ and $\left\lvert\cos^nn\right\rvert\le1$
\section*{2.7b}
\begin{align*}
  n+\cos(n\pi)\sqrt{n^+1}
\end{align*}
bounded below because even terms are increasing, odd terms bounded by 0 and $1-\sqrt{2}$. odd subsequence is bounded, so there is a convergent subsequence

\section*{2.8}
if a sequence is convergent to $L$ then $\forall\varepsilon>0\exists N\in\mathbb{N}$ such that $\left\lvert a_n-L\right\rvert<\varepsilon$ if $n\ge N$

where cauchy sequence is $\forall\varepsilon>0\exists N\in\mathbb{N}$ such that $\left\lvert a_n-a_m\right\rvert<\varepsilon\forall n,m\ge N$

\subsection*{theorem}
every convergent sequence is cauchy

every cauchy sequence of reals converges to a real

not every cauchy sequence of rationals converges to a rational, although it will converge to a real.

definition:

a subset $S$ is said to be complete if every Cauchy sequence $(a_n)$ in $S$ (that is $a_n\in S$) converges to a point in $S$

reals are complete, rationals are not

\section*{completeness theorem}
every cauchy sequence of real numbers converges. so $\mathbb{R}$ is complete

\subsubsection*{proof}
let $(a_n)$ be cauchy. then $\forall\varepsilon>0\exists N$ such that if $n,m\ge N$ then $\left\lvert a_n-a_m\right\rvert<\varepsilon$.

step 1

$(a_n)$ is bounded.

given $\varepsilon=1, \exists N_1$ succh that $\left\lvert a_n-a_m\right\rvert<1\forall n,m\ge  N_1$. in particulare $\left\lvert a_n-a_{N_1}\right\rvert<\forall n\ge N_1$ so $-1+a_{N_1}<a_n<1+a_{N_1}$ and $a_1,\dots a_{N_1}$ is finite so it is bounded.

step 2

BW saays there is a subsequence $(a_{n_k})$ converging to $L\in\mathbb{R}$.

step 3

the whole sequence onverges to some $L$

$\left\lvert a_n-L\right\rvert=\left\lvert a_n-a_{n_k}+a_{n_k}-L\right\rvert\le\left\lvert a_n-a_{n_k}\right\rvert+\left\lvert a_{n_k}-L\right\rvert<2\varepsilon$

\section*{example}
contractive sequences $\left\lvert a_{n+1}-a_n\right\rvert\le\lambda\left\lvert a_n-a_{n-1}\right\rvert,\lambda\in(0,1)$

limit of $\lambda^n$ as n aproaches infinity is 0.

limit of $\left\lvert a_{n+1}-a_n\right\rvert=0$, telescoping $|a_n-a_n|=|a_n-a_{m-1}+a_{m-1-\dots-a_{n+1}a_{n+1}-a_n}\le$
\end{document}


% Created 2021-07-20 Tue 10:14
% Intended LaTeX compiler: pdflatex
\documentclass[presentation,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{khpreamble}
\usepackage{amssymb}
\DeclareMathOperator{\shift}{q}
\DeclareMathOperator{\diff}{p}
\usetheme{default}
\author{Kjartan Halvorsen}
\date{\today}
\title{Polynomial pole placement - part 2}
\hypersetup{
 pdfauthor={Kjartan Halvorsen},
 pdftitle={Polynomial pole placement - part 2},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 26.3 (Org mode 9.4.6)},
 pdflang={English}}
\begin{document}

\maketitle

\section{Intro}
\label{sec:org8bb9cb2}

\begin{frame}[label={sec:orgef2154c}]{Goal of today's lecture}
Understand the design procedure of polynomial pole placement
\end{frame}

\section{2-dof controller}
\label{sec:orga4e419a}

\begin{frame}[label={sec:org6dfc545}]{Two-degree-of-freedom controller}
\begin{center}
\includegraphics[width=0.7\linewidth]{../../figures/2dof-block-explicit}
\end{center}

\begin{align*}
Y(z)     &= \frac{F_f(z)H(z)}{1 + z^{-d}F_b(z)H(z)}U_c(z) + \overbrace{\frac{1}{1 + z^{-d}F_b(z)H(z)}}^{S_s(z)}V(z)  - \overbrace{\frac{z^{-d}F_b(z)H(z)}{1 + z^{-d}F_b(z)H(z)}}^{T_s(z)}N(z)\\
\end{align*}

\alert{Evidently} \(S_s(z) + T_s(z) = 1\) \alert{Conclusion:} One must find a balance between disturbance rejection and noise attenuation.
\end{frame}

\section{Sensitivity, revisited}
\label{sec:orgaa3ab2a}
\begin{frame}[label={sec:org523ac99}]{The sensitivity function}
\[S_s(z) = \frac{1}{1 + z^{-d}F_b(z)H(z)} = \frac{1}{1 + G_o(z)}= \frac{1}{G_o(z) - (-1)}\]

\begin{columns}
\begin{column}{0.45\columnwidth}
\[|S_s(\mathrm{e}^{i\omega h})| = |S_s(i\omega)| = \frac{1}{| G_o(i\omega) - (-1)|}\]

\alert{The magnitude of the sensitivity function is inverse proportional to the distance of the Nyquist curve to the critical point -1}
\end{column}

\begin{column}{0.65\columnwidth}
\begin{center}
\includegraphics[width=0.6\linewidth]{../../figures/implane-nyquist-margins}
\end{center}
\end{column}
\end{columns}
\end{frame}

\section{RST}
\label{sec:orgb0db44e}

\begin{frame}[label={sec:org73a5512}]{The design procedure}
\end{frame}
\begin{frame}[label={sec:org07f51fc}]{The design procedure}
Given plant model \(H(z)=\frac{B(z)}{A(z)}\) and specifications on the desired closed-loop poles \(A_{cl}(z)\)
\begin{enumerate}
\item Find polynomials \(R(z)\) and \(S(z)\) with \(n_R \ge n_S\) such that
\[ A(z)R(z)z^{d} + B(z)S(z) = A_{cl}(z) \]
\item Factor the closed-loop polynomials as \(A_{cl}(z) = A_c(z)A_o(z)\), where \(n_{A_o} \le n_R\). Choose
\[T(z) = t_0 A_o(z),\] where \(t_0 = \frac{A_c(1)}{B(1)}\).
\end{enumerate}

The control law is then
\[ R(q) u(k) = T(q)u_c(k) - S(q)y(k). \]
The closed-loop response to the command signal is given by
\[ A_c(q)y(k) = t_0 B(q) u_c(k). \]
\end{frame}
\begin{frame}[label={sec:org1a53433}]{Determining the order of the controller}
With Diophantine equation
   \[ A(z)R(z)z^{d} + B(z)S(z) = A_{cl}(z) \qquad (*) \]
and feedback controller
\[F_b(z) = \frac{S(z)}{R(z)} = \frac{s_0z^n + s_1z^{n-1} + \cdots + s_n}{z^n + r_1 z^{n-1} + \cdots + r_n}\]
\alert{How should we choose the order of the controller?} Note:
\begin{itemize}
\item the controller has \(n+n+1 = 2\deg R + 1\) unknown parameters
\item the LHS of \((*)\) has degree \(\deg \big(A(z)R(z)z^d + B(z)S(z)\big) = \deg A + \deg R + d\)
\item The diophantine gives as many (nontrivial) equations as the degree of the polynomials on each side when we set the coefficients equal.

\alert{\(\Rightarrow\;\)Choose \(\deg R\) so that \(2\deg R + 1 = \deg A + \deg R + d\)}
\end{itemize}
\end{frame}

\begin{frame}[label={sec:org2ebbb1d}]{Determining the order of the controller - Exercise}
With the plant model \[H(z) = \frac{B(z)}{A(z)} = \frac{b}{z + a}\] and \(d=0\) (no delay), what is the appropriate degree of the controller
\[F_b(z) = \frac{S(z)}{R(z)} = \frac{s_0z^n + s_1z^{n-1} + \cdots + s_n}{z^n + r_1 z^{n-1} + \cdots + r_n}\]
so that all parameters can be determined from the diophantine equation
\[ A(z)R(z) + B(z)S(z) = A_c(z)A_o(z)?\]
\begin{center}
\begin{tabular}{ll}
1. \(n = 0\) & 2. \(n = 1\)\\
3. \(n=2\) & 4. \(n=3\)\\
\end{tabular}
\end{center}
\end{frame}

\begin{frame}[label={sec:orgefa8757}]{Determining the order of the controller - Exercise - Solution}
With the plant model \[H(z) = \frac{B(z)}{A(z)} = \frac{b}{z + a}\] and \(d=0\) (no delay), what is the appropriate degree of the controller \[F_b(z) = \frac{S(z)}{R(z)} = \frac{s_0z^n + s_1z^{n-1} + \cdots + s_n}{z^n + r_1 z^{n-1} + \cdots + r_n}\]
so that all parameters can be determined from the diophantine equation
\[ A(z)R(z) + B(z)S(z) = A_c(z)A_o(z)?\]
\begin{center}
\begin{tabular}{rr}
1. \(n = 0\) & 2.\\
3. & 4.\\
\end{tabular}
\end{center}
\end{frame}

\begin{frame}[label={sec:orgcbd8cc2}]{Two-degree-of-freedom controller, the importance of the observer poles}
\begin{center}
\includegraphics[width=0.7\linewidth]{../../figures/2dof-block-explicit}
\end{center}
\begin{align*}
Y(z) &= \frac{t_0B(z)z^d}{A_c(z)}U_c(z) + \frac{A(z)R(z)z^d}{A_c(z)A_o(z)}V(z)- \frac{S(z)B(z)}{A_c(z)A_o(z)}N(z)
\end{align*}
\alert{Conclusiones} 1) There is a partial separation between designing for reference tracking and designing for perturbance rejection. 2) The observer poles (the roots of \(A_o(z)\)) can be used to determine a balance between disturbance rejection and noise attenuation.
\end{frame}

\section{Example}
\label{sec:orgabd7f07}
\begin{frame}[label={sec:org2ecba8c}]{Example - Level control of a dam}
\begin{center}
\includegraphics[width=0.5\linewidth]{../../figures/kraftverk}
\end{center}

\alert{Objective} Design a control system to maintain the water level under influence of disturbances.
\end{frame}

\begin{frame}[label={sec:org3c2cd7f}]{Example - Level control of a dam}
\begin{center}
\includegraphics[width=0.3\linewidth]{../../figures/kraftverk}
\end{center}

\alert{The process dynamics}

\begin{center}
  \begin{tikzpicture}
    \node at (0,0) {$y(k) = y(k-1) -v(k-1) + u(k-2)$};
    \node[coordinate, pin=140:{Cambio en el nivel de agua}] at (-2.6,0.2) {};
    \node[coordinate, pin=-140:{Cambio en flujos no controlados}] at (0.8,-0.2) {};
    \node[coordinate, pin=60:{Cambio en flujo controlado}] at (2,0.2) {};
\end{tikzpicture}
\end{center}
\begin{center}
  \begin{tikzpicture}[node distance=22mm, block/.style={rectangle, draw, minimum width=15mm}, sumnode/.style={circle, draw, inner sep=2pt}]

    \node[coordinate] (input) {};
    \node[block, right of=input, node distance=20mm] (delay)  {$z^{-1}$};
    \node[sumnode, right of=delay, node distance=16mm] (sum) {\tiny $\Sigma$};
    \node[block, right of=sum, node distance=20mm] (plant)  {$H_p(z)$};
    \node[coordinate, above of=sum, node distance=12mm] (disturbance) {};
    \node[coordinate, right of=plant, node distance=20mm] (output) {};

    \draw[->] (input) -- node[above, pos=0.3] {$u(k)$} (delay);
    \draw[->] (sum) -- node[above] {} (plant);
    \draw[->] (plant) -- node[above, near end] {$y(k)$} (output);
    \draw[->] (disturbance) -- node[right, pos=0.2] {$v(k)$} node[left, pos=0.8] {$-$} (sum);
    \draw[->] (delay) -- (sum);
  \end{tikzpicture}
\end{center}
\end{frame}

\begin{frame}[label={sec:org61013f5}]{Example - Level control of a dam}
\alert{The process dynamics}

\begin{center}
  \begin{tikzpicture}
    \node at (0,0) {$y(k) = y(k-1) -v(k-1) + u(k-2)$};
    \node[coordinate, pin=140:{Cambio en el nivel de agua}] at (-2.6,0.2) {};
    \node[coordinate, pin=-140:{Cambio en flujos no controlados}] at (0.8,-0.2) {};
    \node[coordinate, pin=60:{Cambio en flujo controlado}] at (2,0.2) {};
\end{tikzpicture}
\end{center}
\begin{center}
  \begin{tikzpicture}[node distance=22mm, block/.style={rectangle, draw, minimum width=15mm}, sumnode/.style={circle, draw, inner sep=2pt}]

    \node[coordinate] (input) {};
    \node[block, right of=input, node distance=20mm] (delay)  {$z^{-1}$};
    \node[sumnode, right of=delay, node distance=16mm] (sum) {\tiny $\Sigma$};
    \node[block, right of=sum, node distance=20mm] (plant)  {$H_p(z)$};
    \node[coordinate, above of=sum, node distance=12mm] (disturbance) {};
    \node[coordinate, right of=plant, node distance=20mm] (output) {};

    \draw[->] (input) -- node[above, pos=0.3] {$u(k)$} (delay);
    \draw[->] (sum) -- node[above] {} (plant);
    \draw[->] (plant) -- node[above, near end] {$y(k)$} (output);
    \draw[->] (disturbance) -- node[right, pos=0.2] {$v(k)$} node[left, pos=0.8] {$-$} (sum);
    \draw[->] (delay) -- (sum);
  \end{tikzpicture}
\end{center}
\alert{Activity} What is the transfer function from \(u(k)\) to \(y(k)\)?

\begin{center}
\begin{tabular}{lll}
1: \(H(z) = \frac{z}{z-1}\) & 2: \(H(z)=\frac{1}{z-1}\) & 3: \(H(z)=\frac{1}{z(z-1)}\)\\
\end{tabular}
\end{center}
\end{frame}

\begin{frame}[label={sec:orgd0cf498}]{Example - Level control of a dam}
Given process \(H(z) = \frac{B(z)}{A(z)} = \frac{1}{z(z-1)}\) and desired poles in \(z=0.9\).

\begin{enumerate}
\item The Diophantine equation \(A(z)R(z)z^d + B(z)S(z) = A_{cl}(z)\)
\[ z(z-1)R(z) + S(z) = A_{cl}(z)\]
The order of the controller is
\[\deg R = \deg A + d - 1 = 2-1 = 1, \quad \Rightarrow \quad F_b(z)=\frac{S(z)}{R(z)} = \frac{s_0z + s_1}{z + r_1}\]
\item Resulting Diophantine equation
\[ z(z-1)(z+r_1) + s_0z + s_1 = A_{cl}(z)\]
The degree of \(A_{cl}(z)\) is 3. Choose \(A_o(z) = z\),  ( \(\deg A_o = \deg R\))
\[ A_{cl}(z) = A_o(z) A_c(z) = z(z-0.9)^2\]
\end{enumerate}
\end{frame}

\begin{frame}[label={sec:orgc75df91}]{Example - Level control of a dam}
\begin{enumerate}
\setcounter{enumi}{2}
\item From the Diophantine equation \[ z(z-1)(z+r_1) + s_0z + s_1 = z(z-0.9)^2\]
\[ z^3 + (r_1-1)z^2 - r_1z + s_0z + s_1 = z^3 -1.8z^2 + 0.81z\]
we obtain the equations
\begin{align*}
\begin{cases} z^2 &: \quad r_1-1 = -1.8\\
z^1 &: \quad -r_1 + s_0 = 0.81\\
z^0 &: \quad s_1 = 0
\end{cases}
\quad \Rightarrow \quad
\begin{cases} r_1 &= -0.8\\ s_0 &= 0.01\\ s_1 &=0 \end{cases}
\end{align*}
\[F_b(z) = \frac{0.01z}{z - 0.8}\]
\end{enumerate}
\end{frame}

\begin{frame}[label={sec:org2dcdae7}]{Example - Level control of a dam}
\begin{enumerate}
\setcounter{enumi}{3}
\item We have \(A_o(z) = z\), so
\[T(z) = t_0A_o(z) = t_0z\]
\[G_c(z) = \frac{T(z)B(z)}{A_o(z)A_c(z)} = \frac{t_0 B(z)}{A_c(z)}, \quad \text{queremos}\, G_c(1)=1\]
\[ t_0 = \frac{A_c(1)}{B(1)} = \frac{(1-0.9)^2}{1} = 0.01\]
\end{enumerate}

\alert{Control law}
\[R(\shift) u(kh) = T(\shift)u_c(kh) - S(\shift)y(kh)\]
\[ (\shift - 0.8)u(kh) = 0.01\shift u_c(kh) - 0.01\shift y(kh)\]
\[ u(kh+h) = 0.8u(kh) + 0.01 u_c(kh+h) - 0.01y(kh+h)\]
\end{frame}
\end{document}


\documentclass{article}
\usepackage{fullpage}
\usepackage{nopageno}
\usepackage{amsmath}
\usepackage{amssymb}
\allowdisplaybreaks

\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}

\begin{document}
\title{Notes}
\date{March 7, 2014}
\maketitle
\section*{worksheet}
\subsection*{2}
multinomial theorem
\[(x_1+x_2+\dots+x_t)^n=\sum\limits{\binom{n}{r_1}\binom{n-r_1}{r_z}\dots\binom{n-r_1-\dots-r_{t-1}}{r_t}{x_1}^{r_1}{x_2}^{r_2}\dots{x_t}^{r_t}}\]
combinatorial proof sketch

\emph{``would be sufficient for an exam''}
\begin{align*}
  (x_1+\dots+x_t)(x_1+\dots+x_t)\dots(x_1+\dots+x_t)
\end{align*}
when you multiply out, each term is a word in the letters $x_1,\dots,x_t$
\begin{align*}
  \underbrace{x_2x_5x_2x_1x_3x_1}_n
\end{align*}
so the coefficient of ${x_1}^{r_1}{x_2}^{r_2}\dots{x_t}^{r_t}$ counts \# words of length $n$ with $\underbrace{r_ix_i}_{\text{letter distribution}}$'s
\section*{example 39}
find the coefficient of ${x_1}^3x_2{x_3}^4{x_5}^2$ in $(x_1+\dots+x_5)^{10}$. $\frac{10!}{3!1!4!2!}$
\section*{other example}
what is $\sum\limits_{n_1+n_2+n_3=n}{\binom{n}{n_1,n_2,n_3}(-1)^{n_2}}$. use multinomial thm, plug in 1,-1,1 for x's
\section*{other example}
what is $\sum\limits_{n_1+n_2+n_3=n}{\binom{n}{n_1,n_2,n_3,n_4}(-1)^{n_2+n_4}}=(1-1+1-1)^n=0$
\section*{chapter 6}
\subsection*{principle of inclusion-exclusion}
$\abs{A_1\cup A_2\cup A_3\dots\cup A_n}=\abs{\cup_{i=1}^n{A_i}}=\sum\limits_{i=1}^n{\abs{A_1}}-\sum\limits_{i\ne j}{\abs{A_i\cap A_j}}+\sum\limits{\abs{A_i\cap A_j\cap A_k}}-\dots+(-1)^{n+1}\abs{A_1\cap\dots\cap A_n}$
\subsection*{application 1}
find \# integers between 1 and 1000. that are not divisible by 5,6, or 8.
$A_i=$set of integers between 1-1000 divisible by $i$. consider $A_5,A_6,A_8$

we are looking for $A_5\cup A_6\cup A_8$

$\left\lvert A_5\right\rvert+\left\lvert A_6\right\rvert+\left\lvert A_8\right\rvert-\left\lvert A_5\cap A_6\right\rvert-\left\lvert A_5\cap A_8\right\rvert-\left\lvert A_6\cap A_8\right\rvert+\left\lvert A_5\cap A_6\cap A_8\right\rvert$
\end{document}


\documentclass[10pt]{article}
\author{Alex Peyrard}
\title{Digital Image Processing}
\usepackage{graphicx}

\begin{document}
\maketitle
\section{Introduction}
All of the programs are written in python 3. The shebangs are included and thus they should work if called using the "./program.py" notation. In case this causes a problem, please try to call them using "python3 program.py" notation.\\\\
I will provide further help on how to call each program.
\subsection{libraries}
I used numpy in all of the programs and scipy in some of them. I will detail when scipy is used.
\section{Exercise 1}
The program called ex1.py computes the histogram of a greyscale image, and enhances the image using histogram equalization. it displays the enhanced image, the histograms of the default and enhanced images, and the transformation function.\\
In this exercise, the matplotlib library is used to plot hitograms and functions.
\subsection{Examples}
\subsubsection{Fig1.jpg}
All of the results are obtained using the program with the call "./ex1.py Fig1.jpg"
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex1/Fig1.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex1/Fig1_hist.png}
	\caption{Original image's histogram}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex1/Fig1_cdf.png}
	\caption{Enhancement function}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex1/Fig1_enh_hist.png}
	\caption{Enhanced image histogram}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex1/Fig1_enh.jpg}
	\caption{Enhanced image}
\end{figure}
\clearpage

\subsubsection{Fig2.jpg}
All of the results are obtained using the program with the call "./ex1.py Fig2.jpg"
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex1/Fig2.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex1/Fig2_hist.png}
	\caption{Original image's histogram}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex1/Fig2_cdf.png}
	\caption{Enhancement function}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex1/Fig2_enh_hist.png}
	\caption{Enhanced image histogram}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex1/Fig2_enh.jpg}
	\caption{Enhanced image}
\end{figure}
\clearpage

\section{Exercise 2}
The program called ex2.py performs several spatial enhancement techniques on a given greyscale image.
\subsection{Example on skeleton\_orig.tif}
All of the results are obtained using the program with the call "./ex2.py skeleton\_orig.tif"
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex2/skeleton_orig.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex2/skeleton_lap.jpg}
	\caption{Rescaled laplacian of image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex2/skeleton_lap_plus_orig.jpg}
	\caption{Sum of laplacian and original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex2/skeleton_sobel.jpg}
	\caption{Sobel gradient of original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex2/skeleton_smmoth_sobel.jpg}
	\caption{Smoothed Sobel gradient of original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex2/skeleton_product.jpg}
	\caption{Product of smoothed Sobel gradient and of the previous sum of laplacian and original}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex2/skeleton_final.jpg}
	\caption{Sum of original image and previous image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex2/skeleton_final.jpg}
	\caption{Power law of original image, gamma = 0.5, c = 1}
\end{figure}

\clearpage

\section{Exercise 3}
The program called ex3.py performs several frequency domain enhancement techniques on a given greyscale image.
\subsection{Examples}
\subsubsection{Ideal filter}
Those images are obtained using the call "./ex3 --ideal --highpass cutoff image" for highpass images, and "./ex3 --ideal --lowpass cutoff image" for lowpass images.
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_ideal_low_10.jpg}
	\caption{Cutoff 10 Ideal lowpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_ideal_low_30.jpg}
	\caption{Cutoff 30 Ideal lowpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_ideal_low_100.jpg}
	\caption{Cutoff 100 Ideal lowpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_ideal_high_10.jpg}
	\caption{Cutoff 10 Ideal highpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_ideal_high_30.jpg}
	\caption{Cutoff 30 Ideal highpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_ideal_high_100.jpg}
	\caption{Cutoff 100 Ideal highpass filter}
\end{figure}
\clearpage
\subsubsection{Gaussian filter}
Those images are obtained using the call "./ex3 --gaussian --highpass cutoff image" for highpass images, and "./ex3 --gaussian --lowpass cutoff image" for lowpass images.
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_gauss_low_10.jpg}
	\caption{Cutoff 10 Gaussian lowpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_gauss_low_30.jpg}
	\caption{Cutoff 30 Gaussian lowpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_gauss_low_100.jpg}
	\caption{Cutoff 100 Gaussian lowpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_gauss_high_10.jpg}
	\caption{Cutoff 10 Gaussian highpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_gauss_high_30.jpg}
	\caption{Cutoff 30 gaussian highpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_gauss_high_100.jpg}
	\caption{Cutoff 100 Gaussian highpass filter}
\end{figure}
\clearpage
\subsubsection{Butterworth filter}
Those images are obtained using the call "./ex3 --butterworth --highpass --order order cutoff image" for highpass images, and "./ex3 --butterworth --lowpass --order order cutoff image" for lowpass images.
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_butter_low_10.jpg}
	\caption{Cutoff 10 order 2 Butterworth lowpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_butter_low_30.jpg}
	\caption{Cutoff 30 order 2 Butterworth lowpass filter}
\end{figure}

\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_butter_high_10.jpg}
	\caption{Cutoff 10 order 2 Butterworth highpass filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex3/ch_butter_high_30.jpg}
	\caption{Cutoff 30 order 2 Butterworth highpass filter}
\end{figure}

\clearpage

\section{Exercise 4}
For exercise 4, the program gaussNoise.py adds gaussian noise of desired mean and variance o an image.
The program uniNoise.py adds uniform noise of desired lower and upper bound to an image.
The program filtering.py uses different means of filtering an image.
\subsection{Examples}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/Circuit.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/gaussC.jpg}
	\caption{Original image with gaussian noise of mean 0 and variance 260}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/uniC.jpg}
	\caption{Original image with uniform noise in the [-100, 100] range}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/gaussarith.jpg}
	\caption{Image with gaussian noise enhanced with arithmetic mean}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/uniarith.jpg}
	\caption{Image with uniform noise enhanced with arithmetic mean}
\end{figure}

\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/gaussgeo.jpg}
	\caption{Image with gaussian noise enhanced with geometric mean}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/unigeo.jpg}
	\caption{Image with uniform noise enhanced with geometric mean}
\end{figure}

\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/gaussharmo.jpg}
	\caption{Image with gaussian noise enhanced with harmonic filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/uniharmo.jpg}
	\caption{Image with uniform noise enhanced with harmonic filter}
\end{figure}

\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/gaussch15.jpg}
	\caption{Image with gaussian noise enhanced with contra harmonic filter of order 1.5}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/unich15.jpg}
	\caption{Image with uniform noise enhanced with contra harmonic filter of order 1.5}
\end{figure}

\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/gaussmedian.jpg}
	\caption{Image with gaussian noise enhanced with median filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/unimedian.jpg}
	\caption{Image with uniform noise enhanced with median filter}
\end{figure}

\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/gaussmax.jpg}
	\caption{Image with gaussian noise enhanced with max filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/unimax.jpg}
	\caption{Image with uniform noise enhanced with max filter}
\end{figure}

\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/gaussmin.jpg}
	\caption{Image with gaussian noise enhanced with min filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/unimin.jpg}
	\caption{Image with uniform noise enhanced with min filter}
\end{figure}

\clearpage
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/gaussmid.jpg}
	\caption{Image with gaussian noise enhanced with midpoint filter}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/unimid.jpg}
	\caption{Image with uniform noise enhanced with midpoint filter}
\end{figure}

\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/gaussalpha2.jpg}
	\caption{Image with gaussian noise enhanced with alpha trimmed filter of order 2}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex4/unialpha2.jpg}
	\caption{Image with uniform noise enhanced with alpha trimmed filter of order 2}
\end{figure}

\clearpage
\section{Exercice 5}
In exercise 5 we analyze blurring degradation.\\
Using "./ex5 blur image output" The program blurs and saves an image.\\
By using "./ex5 filter image output", the program enhances a blurred image using the inverse filter.
\section{Example}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex5/book_cover.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex5/blurredBook.jpg}
	\caption{Blurred image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex5/blurredGaussBook.jpg}
	\caption{Blurred image with gaussian noise of mean 0 variance 650}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex5/filteredBook.jpg}
	\caption{Enhanced image of the blurred book}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex5/filteredGaussBook.jpg}
	\caption{Enhanced image of the blurred book with noise}
\end{figure}
\clearpage

We can notice that the enhancement with inverse filtering isn't perfect, and is useless with noise.\\

I apologize for not being able to do the rest of the exercise.

\section{Exercise 6}
This program is capable of performing rotations, translations and rescaling on an image, using either the nearest neighbor or bilinear interpolation.\\

Usage :\\
--neighbor for nearest neighbor\\
--bilinear for bilinear interpolation\\

--rotate, --rescale, --translate to choose transform
\subsection{Examples}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex6/ray_trace_bottle.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex6/rotate26n.jpg}
	\caption{Image rotated by 26 degrees with nearest neighbor. Command line : ./ex6 --neighbor --rotate image 26}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex6/rotate155b.jpg}
	\caption{Image rotated by 155 degrees with bilinear interpolation. Command line : ./ex6 --bilinear --rotate image 155}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex6/rescale05.jpg}
	\caption{Image rescaled by 0.5 with nearest neighbor. Command line : ./ex6 --neighbor --rescale image 0.5}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex6/rescale2.jpg}
	\caption{Image rescaled by 2 with bilinear interpolation. Command line : ./ex6 --bilinear --rescale image 2}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex6/translate1.jpg}
	\caption{Image translated by 166.5 -455.3 with nearest neighbor. Command line : ./ex6 --neighbor --translate image 166.5 -455.3}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex6/translate2.jpg}
	\caption{Image translated by -25.12 65 with bilinear interpolation. Command line : ./ex6 --bilinear --translate image -25.12 65}
\end{figure}
\clearpage
\section{Exercise 7}
The exercise 7 program can compress an image using the discrete cosine transform and a mask to discard coefficients.\\

Usage :\\
--dct to perform the dct\\
--showdiff to show the differences between the original image and the compressed image\\

--threshold to use the threshold mask instead of the zonal mask.
\subsection{Examples}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex7/lenna.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex7/zonal.jpg}
	\caption{Image compressed using the zonal mask}
\end{figure}
\clearpage
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex7/zonaldiff.jpg}
	\caption{Differences between original and zonal compressed images}
\end{figure}

\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex7/threshold.jpg}
	\caption{Image compressed using the zonal mask}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex7/thresholddiff.jpg}
	\caption{Differences between original and zonal compressed images}
\end{figure}

\clearpage

I wasn't able to do the part of the exercise with wavelets.

\section{Exercise 8}
The exercise 8 program can perform morphological processing on an image.\\

Usage :\\
--dilate to use dilation\\
--erode to use erosion\\
--open to use opening\\
--close to use closing\\

--boundary to use boundary extraction\\
--filling to use hole filling\\
--extraction for feature extraction

\subsection{Examples}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex8/noisy_fingerprint.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex8/noisy_dilated.jpg}
	\caption{Dilated image. Command ./ex8 --dilate image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex8/noisy_eroded.jpg}
	\caption{Eroded image. Command ./ex8 --erode image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex8/noisy_opened.jpg}
	\caption{Opened image. Command ./ex8 --open image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex8/noisy_closed.jpg}
	\caption{Closed image. Command ./ex8 --close image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex8/lincoln.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex8/lincoln_boundary.jpg}
	\caption{Boundary of image. Command ./ex8 --boundary image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex8/region.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex8/region_filled.jpg}
	\caption{Image filled at position 50 50. Command ./ex8 --filling image 50 50}
\end{figure}

\begin{figure}[!ht]
	\centering
	\includegraphics[height=150pt]{./ex8/chicken.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=150pt]{./ex8/chicken_extracted.jpg}
	\caption{Image thresholded, eroded, and then extracted at position 100 356. Command ./ex8 --extraction image 100 356}
\end{figure}
\clearpage
The program also gives the number of pixels of the extracted component. In this case :  1356 pixels
\clearpage
\section{Exercise 9}
The exercise 9 program can perform image segmentation on an image using edge detectors or thresholding segmentation methods.\\

Usage : \\
--roberts to use the Roberts edge detectors\\
--prewitt to use the Prewitt edge detector\\
--sobel to use the Sobel edge detector\\
--mh to use the Marr hildreth edge detector\\
--canny to use the canny edge detector\\

--otsu to use Otsu's threshold segmentation.\\
--threshold to use the global thresholding method
\subsection{Examples}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex9/building.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex9/building_roberts.jpg}
	\caption{Image obtained using Roberts edge detector. Command : ./ex9 --roberts image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex9/building_prewitt.jpg}
	\caption{Image obtained using Prewitt edge detector. Command : ./ex9 --prewitt image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex9/building_sobel.jpg}
	\caption{Image obtained using Sobel edge detector. Command : ./ex9 --sobel image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex9/building_mh.jpg}
	\caption{Image obtained using Marr Hildreth edge detector. Command : ./ex9 --mh image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex9/building_canny.jpg}
	\caption{Image obtained using Canny edge detector. Command : ./ex9 --canny image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex9/polymersomes.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex9/polymersomes_otsu.jpg}
	\caption{Image obtained using Otsu's method. Command : ./ex9 --otsu image. Obtained $\eta$ : 0.48}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex9/polymersomes_global.jpg}
	\caption{Image obtained using global thresholding method method. Command : ./ex9 --threshold image.}
\end{figure}
\clearpage
We can see that Otsu's method is better at determining the best threshold value./
\section{Exercise 10}
The exercise 10 program can perform boundary following, resampling, and compute the chain code and the difference chain code of a grayscale image.\\

The pca program can use principal component analysis to compress an image and reconstruct it from fewer components.

Usage of ex10: \\
--boundary to use boundary following\\
--resampling to use boundary following and resampling\\
--linking to link the resampled points\\
--chain to compute the chain code\\
--chaindiff to compute the difference chain code\\

Usage of pca:
calling pca automatically reconstructs the 6 images from washington DC from 2 components and also prints the difference images.
\subsection{Examples}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/noisy_stroke.jpg}
	\caption{Original image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/noisy_boundary.jpg}
	\caption{Boundary of the image. Command : ./ex10 --boundary image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/noisy_resample.jpg}
	\caption{Resampling of the image's boundary. Command : ./ex10 --resampling image}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/noisy_link.jpg}
	\caption{Linking of the previous image. Command : ./ex10 --linking image}
\end{figure}
\clearpage
The chain code, obtained with ./ex10 --chain image, is 0000606666666646442444242222202202\\

The first difference chain code, obtained with ./ex10 --chaindiff image, is
000626000000062606200626000062062\\

Images used for pca :
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/WashingtonDC_Band1.jpg}
	\caption{Original image 1}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/WashingtonDC_Band2.jpg}
	\caption{Original image 2}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/WashingtonDC_Band3.jpg}
	\caption{Original image 3}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/WashingtonDC_Band4.jpg}
	\caption{Original image 4}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/WashingtonDC_Band5.jpg}
	\caption{Original image 5}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/WashingtonDC_Band6.jpg}
	\caption{Original image 6}
\end{figure}
\clearpage
Images obtained with 2 remaining components :
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash1.jpg}
	\caption{Image 1}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash2.jpg}
	\caption{Image 2}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash3.jpg}
	\caption{Image 3}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash4.jpg}
	\caption{Image 4}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash5.jpg}
	\caption{Image 5}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash6.jpg}
	\caption{Image 6}
\end{figure}
\clearpage
Stretched differences images:
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash1diff.jpg}
	\caption{Difference image 1}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash2diff.jpg}
	\caption{Difference image 2}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash3diff.jpg}
	\caption{Difference image 3}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash4diff.jpg}
	\caption{Difference image 4}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash5diff.jpg}
	\caption{Difference image 5}
\end{figure}
\begin{figure}[!ht]
	\centering
	\includegraphics[height=200pt]{./ex10/Wash6diff.jpg}
	\caption{Difference image 6}
\end{figure}
\end{document}


\section{Results}

In this section, we compare the results from Moltres for each CNRS Benchmark
step to the results in the benchmark paper \cite{tiberga_results_2020}.
The software packages from \gls{CNRS} and \gls{TUD}
each report two sets of results arising from different angular discretizations
in their neutronics models for Steps 0.2, 1.1, 1.2, 1.3, 1.4, and 2.1. These
sets of results are labeled as CNRS-$SP_1$ and
CNRS-$SP_3$; and TUD-$S_2$ and TUD-$S_6$, respectively. The
authors performed code-to-code verification by sampling observable values at
201 equidistant points along the centerlines AA' and BB' and reporting the
discrepancy $\epsilon_c$ of each observable from each software
(indexed by $c$) for each measured observable $Q_c$ (not to be confused with
fission heat source $Q_f$), relative to the average of
that same observable $Q_{avg}$ from all participating software. Variables
$\epsilon_c$ and $Q_{avg}$ are calculated as:
%
\begin{align}
    \epsilon_c =& \sqrt{\frac{\sum^{N_p}_{i=1}\left[Q_c(\vec{r_i}) - Q_{avg}
    (\vec{r_i})\right]^2}{\sum^{N_p}_{i=1} Q^2_{avg}(\vec{r_i})}}
    \shortintertext{and}
    Q_{avg}(\vec{r_i}) =& \frac{1}{N_c} \sum^{N_c}_{c=1} Q_c(\vec{r_i})
    \shortintertext{where}
    Q_c(\vec{r_i}) =&
    \mbox{ value of observable $Q$ at location $\vec{r_i}$ from software $c$,}
    \nonumber \\
    N_p =& \mbox{ number of sampling points of quantity $Q$} = 201,
    \nonumber \\
    N_c =& \mbox{ number of participating software packages.} \nonumber
\end{align}

The average discrepancy $\epsilon$ over all software is calculated as:
%
\begin{align}
    \epsilon =& \frac{1}{N_c}\sum^{N_c}_{c=1} \epsilon_c
\end{align}

We adopted the averaged values $\epsilon$ and $Q_{avg}$ directly from the
reference work \cite{tiberga_results_2020} without including our results
in the calculations. We note that the benchmark does not provide a reference
solution and a significantly erroneous value from one of the software packages
could heavily skew the discrepancy values. Nevertheless, the benchmark paper
reports good agreement among their software packages.

For observables measured along the centerlines AA' and/or BB', Tables
\ref{table:disc0} and \ref{table:disc1} report the discrepancy $\epsilon_c$ of
each observable from Moltres relative to the average of the benchmark
participants $Q_{avg}$ alongside the average discrepancy $\epsilon$ of
the benchmark participants. We also reproduce corresponding plots
in the benchmark paper for every observable along AA' or BB' in Figures
\ref{fig:0.1}, \ref{fig:0.2}, \ref{fig:0.3}, \ref{fig:1.1}, \ref{fig:1.2},
\ref{fig:1.3}, and \ref{fig:2.1} for a qualitative comparison of the results
from Moltres and the benchmark participants. Given the significant overlap in
the plot curves, these figures omit results from CNRS-$SP_1$ and TUD-$S_2$ to
reduce cluttering. Readers may also refer to
\ref{appendix:tables} for tables of observable values at nine equidistant
points along AA' and BB' from Moltres and the benchmark participants. We
provide these tables for ease of review and a direct comparison to
corresponding data tables from \cite{tiberga_results_2020}. The full dataset
of all observable results used in this results analysis is
available at \cite{park_results_2021}. Lastly, Table
\ref{table:rho} reports all reactivity and change in reactivity results from
Steps 0.2, 1.1, 1.2, and 1.3.

\begin{figure}[h]
	\centering
    \includegraphics[width=.8\columnwidth]{0-1-vel-plot}
	\caption{Step 0.1 \textemdash\ Horizontal velocity component along BB'.}
	\label{fig:0.1}
\end{figure}
%
\begin{figure}[h]
	\centering
	\includegraphics[width=.8\columnwidth]{0-2-fiss-plot}
	\caption{Step 0.2 \textemdash\ Fission rate density along AA'.}
	\label{fig:0.2}
	\includegraphics[width=.8\columnwidth]{0-3-temp-plot}
	\caption{Step 0.3 \textemdash\ Temperature distribution along BB'.}
	\label{fig:0.3}
\end{figure}
%
\FloatBarrier
%
\begin{table}[htb]
	\caption{Discrepancy values from Moltres alongside the average and standard
	deviation of the discrepancy values of the benchmark participants for Phase
	0.}
	\centering
	\small
	\begin{tabular}{l l c S S S}
		\toprule
		\multirow{2}{*}{\textbf{Step}} & \multirow{2}{*}{\textbf{Observable}} & \multirow{2}{*}{\textbf{Centerline}} & {\multirow{2}{*}{\textbf{Moltres [\%]}}} & \multicolumn{2}{c}{\textbf{Benchmark [\%]}} \\
		& & & & {Average} & {SD} \\
		\midrule
		\multirow{4}{*}{0.1} &
		\multirow{2}{*}{$u_x$} & AA' & 0.247 & 0.253 & 0.150 \\
		& & BB' & 0.266 & 0.318 & 0.102 \\
		\cmidrule{2-6}
		& \multirow{2}{*}{$u_y$} & AA' & 0.540 & 0.598 & 0.266 \\
		& & BB' & 0.468 & 0.795 & 0.421 \\
		\midrule
		{0.2} &
		{$\sum^6_g \Sigma_{f,g} \phi_g(\vec{r})$} & AA' & 0.313 & 0.285 & 0.153
		\\
		\midrule
		\multirow{2}{*}{0.3} &
		\multirow{2}{*}{$T$} & AA' & 0.090 & 0.085 & 0.031 \\
		& & BB' & 0.164 & 0.083 & 0.027\\
		\bottomrule
	\end{tabular}
	\label{table:disc0}
\end{table}

\subsection{Phase 0 results \& discussion}

Figures \ref{fig:0.1}, \ref{fig:0.2}, and \ref{fig:0.3} show that Moltres
accurately reproduced all three sets of results in Phase 0 for the velocity
field, fission rate density, and temperature. Table
\ref{table:disc0} reports the discrepancy values from Moltres for Phase 0 and
the corresponding average and \gls{SD} of the discrepancy values from
the benchmark participants
\cite{tiberga_results_2020}. Moltres performs very well as most discrepancy
values are either lower than or fall within one \gls{SD} of the benchmark
average discrepancies. The discrepancy value for $T$ along centerline BB' in
Step 0.3 is the only exception with its value of 0.164\% being larger than
the benchmark average by 3 \gls{SD}.

We
note in Figure \ref{fig:0.3} that the $T$ distribution from Moltres is almost
identical to the corresponding distributions from CNRS-$SP_3$ and TUD-$S_6$
along most of centerline BB'. However, Figure \ref{fig:0.3-zoom} shows
significant spread in the $T$ distributions along BB' from all software
packages near the top boundary. At $y = 2.0$ m, Moltres underpredicts the
temperature at 912.3 K compared to the benchmark participants' values which
range between 930.3 K and 948.1 K (Refer to Table \ref{table:0.3} for the
numerical values). This point on the top boundary lies directly downstream of
the velocity boundary condition discontinuity at the top-left corner.
Corner singularities are generally difficult to approximate with
continuous Galerkin methods \cite{kuhlmann_lid-driven_2018}.
The \gls{SUPG} stabilization scheme dampens numerical oscillations by
introducing pointwise artificial thermal diffusivity which depends strongly on
the inverse of local velocity magnitude \cite{peterson_overview_2018}.
Therefore, while the \gls{SUPG} scheme was very effective in eliminating
spurious numerical oscillations everywhere else, it provides little damping
along the top boundary due to the relatively large non-zero velocity boundary
condition. On the other hand, the temperature values in the rest of the domain
and the average discrepancies of the other variables show that Moltres can
still accurately reproduce the expected results and the temperature deviations
along the top boundary do not impact the overall integrity of our results.

\begin{figure}[htb]
	\centering
	\includegraphics[width=.8\columnwidth]{0-3-temp-plot-zoom}
	\caption{Step 0.3 \textemdash\ Temperature distribution along BB' for y = 1.94 m to
	y = 2.00 m.}
	\label{fig:0.3-zoom}
\end{figure}

Lastly, we observe in table \ref{table:rho} that the reactivity $\rho$ value of
465.6 pcm from Moltres falls well within the range of $\rho$ values from the
benchmark which range from 353.7 pcm up to 578.1 pcm. Given that Moltres
adopts the neutron diffusion model, our $\rho$ value agrees closest to the
results from the software packages which also adopt the neutron diffusion model
or theoretically-equivalent models such as the $SP_1$ and $S_2$ neutron
transport models, namely CNRS-$SP_1$, PoliMi, PSI, and TUD-$S_2$.

\begin{table}[htb]
    \caption{Reactivity $\rho$ and change in reactivity
    $\left(\rho_a - \rho_b\right)$ values from Steps 0.2, 1.1,
    1.2, and 1.3. All units are in pcm.}
    \centering
    \small
    \setlength\tabcolsep{2pt}
    \begin{tabular}{l S S S S}
        \toprule
        \multirow{2}{*}{\textbf{Software}} & {\textbf{Step 0.2}} &
        {\textbf{Step 1.1}} & {\textbf{Step 1.2}} & {\textbf{Step 1.3}} \\
        & {$\rho_{s_{0.2}}$}
        & {$\rho_{s_{1.1}} - \rho_{s_{0.2}}$}
        & {$\rho_{s_{1.2}} - \rho_{s_{1.1}}$}
        & {$\rho_{s_{1.3}} - \rho_{s_{0.2}}$} \\
        \midrule
        Moltres     & 465.6 & -62.7 & -1142.2 & -1207.7 \\
        CNRS-$SP_1$ & 411.3 & -62.5 & -1152.0 & -1220.5 \\
        CNRS-$SP_3$ & 353.7 & -62.6 & -1152.7 & -1220.7 \\
        PoliMi      & 421.2 & -62.0 & -1161.0 & -1227.0 \\
        PSI         & 411.7 & -63.0 & -1154.8 & -1219.6 \\
        TUD-$S_2$   & 482.6 & -62.0 & -1145.2 & -1208.5 \\
        TUD-$S_6$   & 578.1 & -60.7 & -1122.0 & -1184.4 \\
        \bottomrule
    \end{tabular}
    \label{table:rho}
\end{table}

\FloatBarrier

\subsection{Phase 1 results \& discussion}

Table \ref{table:disc1} shows the discrepancy values from Moltres relative to
the average and \gls{SD} of the benchmark participants for Steps 1.1, 1.2, and
1.3, and the corresponding average discrepancy values from the benchmark
\cite{tiberga_results_2020}. The subsequent subsections discuss the results
for each benchmark step in Phase 1.
%
\begin{table*}[htb]
	\caption{Discrepancy values from Moltres alongside the average and standard
	deviation of the discrepancy values of the benchmark participants for Phase
	1.}
	\centering
	\small
	\begin{tabular}{l l c S S S}
		\toprule
		\multirow{2}{*}{\textbf{Step}} & \multirow{2}{*}{\textbf{Observable}} & \multirow{2}{*}{\textbf{Centerline}} & {\multirow{2}{*}{\textbf{Moltres [\%]}}} & \multicolumn{2}{c}{\textbf{Benchmark [\%]}} \\
		& & & & {Average} & {SD} \\
		\midrule
		\multirow{2}{*}{1.1} &
		\multirow{2}{*}{$\sum_i \lambda_i C_i$} & AA' & 0.603 & 0.346 & 0.166
		\\
		& & BB' & 0.327 & 0.294 & 0.153 \\
		\midrule
		\multirow{4}{*}{1.2} &
		\multirow{2}{*}{$T$} & AA' & 0.076 & 0.095 & 0.015 \\
		& & BB' & 0.179 & 0.089 & 0.012 \\
		\cmidrule{2-6}
		& \multirow{2}{*}{\footnotesize $\Delta\left[\sum^6_g \Sigma_{f,g} \phi_g(\vec{r})
		\right]_{s_{1.2}-s_{0.2}}$} & AA' & 1.110 & 1.576 & 0.564 \\
		& & BB' & 1.089 & 1.133 & 0.392 \\
		\midrule
		\multirow{7}{*}{1.3} &
		{$u_x$} & AA' & 0.123 & 0.691 & 0.566 \\
		\cmidrule{2-6}
		& \multirow{2}{*}{$u_y$} & AA' & 0.237 & 0.329 & 0.131 \\
		& & BB' & 0.238 & 0.356 & 0.217 \\
		\cmidrule{2-6}
		& \multirow{2}{*}{$T$} & AA' & 0.064 & 0.057 & 0.023 \\
		& & BB' & 0.070 & 0.080 & 0.024 \\
		\cmidrule{2-6}
		& \multirow{2}{*}{$\sum_i \lambda_i C_i$} & AA' & 1.043 & 0.460 & 0.190
		\\
		& & BB' & 0.462 & 1.194 & 0.178 \\
		\bottomrule
	\end{tabular}
	\label{table:disc1}
\end{table*}

\subsubsection{Step 1.1: Circulating fuel}

Figure \ref{fig:1.1} shows good qualitative agreement in the delayed neutron
source distribution along BB' among Moltres and the benchmark participants.
From Table \ref{table:disc1}, Moltres reports discrepancies of 0.603\% and
0.327\% along the centerlines AA' and BB', respectively. Both values are on the
within two and one \gls{SD}, respectively, of the average discrepancies of the
benchmark participants (0.346\% and 0.294\%).
In Table \ref{table:rho}, we observe that the change in
$\rho$ relative to Step 0.2 is $-62.7$ pcm for Moltres and this value is
consistent with the $-63.0$ to $-62.0$ pcm range that most of the benchmark
participants' values fall in.
%
\begin{figure}[h!]
	\centering
    \includegraphics[width=.8\columnwidth]{1-1-dnp-x-plot}
    \includegraphics[width=.8\columnwidth]{1-1-dnp-y-plot}
	\caption{Step 1.1 \textemdash\ Delayed neutron source along AA' (top) and BB'
	(bottom).}
	\label{fig:1.1}
\end{figure}
%
\begin{figure*}[htb]
	\centering
	\includegraphics[width=.8\columnwidth]{1-2-temp-plot}
	\includegraphics[width=.8\columnwidth]{1-2-fiss-plot}
	\caption{Step 1.2 \textemdash\ Temperature distribution and change in fission rate
	density along AA'.}
	\label{fig:1.2}
\end{figure*}

\FloatBarrier

\subsubsection{Step 1.2: Power coupling}

Figure \ref{fig:1.2} shows the temperature distribution and the change in
fission rate density along AA' from Step 1.2. Similar to Step 0.3, the
temperature distribution from Moltres agrees closest with CNRS-$SP_3$ and
TUD-$S_2$. Table \ref{table:disc1} reports the same trends we observed in Phase
0; the average discrepancy in temperature along BB' from Moltres for Step 1.2
is marginally higher than the benchmark while the average discrepancy in the
fission rate density is within one \gls{SD} range to the benchmark average.
From Table \ref{table:rho}, Moltres also reports a change in $\rho$
relative to Step 1.1 of $-1142.2$ pcm which
falls within the range of reported benchmark participants' values.

\subsubsection{Step 1.3: Buoyancy}

Figure \ref{fig:1.3} shows the vertical velocity component, temperature, and
delayed neutron source distributions along AA'.
Moltres reproduces the correct trend in all three physical
observables. Step 1.3 has a relatively slower buoyancy-driven flow profile with
no forced flow from the top boundary. Consequently, there are no temperature
deviations near the top boundary and we observe in Table \ref{table:disc1} that
the average discrepancy value of 0.070\% for the temperature distribution along
BB' is in much closer agreement to the benchmark value of 0.080\% compared to
the corresponding temperature discrepancy values for Step 0.3 and 1.2.

In Table \ref{table:rho}, we observe that the change in $\rho$ from
Moltres (-1207.7 pcm) falls within the range of reported benchmark values and
matches the software from TUD-$S_2$ (-1208.5 pcm) the closest. This is likely
by virtue of the similar solvers (diffusion and $S_2$ neutronics models) and
methods of solution (finite element method on uniform meshes) employed by our
respective software.
%
\begin{figure*}[htb]
	\centering
	\includegraphics[width=.6\columnwidth]{1-3-vel-plot}
	\includegraphics[width=.6\columnwidth]{1-3-temp-plot}
	\includegraphics[width=.6\columnwidth]{1-3-dnp-plot}
	\caption{Step 1.3 \textemdash\ Vertical velocity component, temperature distribution,
	and delayed neutron source along AA'.}
	\label{fig:1.3}
\end{figure*}

\FloatBarrier

\subsubsection{Step 1.4: Full coupling}

Figure \ref{fig:color} shows 2D temperature distribution and velocity
streamlines from Moltres for Step 1.4 with $U_{lid} = 0.5$ m$\cdot$s$^{-1}$ and
$P = 1$ GW. Table \ref{table:full} shows the change in $\rho$ under the various
$U_{lid}$ and $P$ values. We refer readers to Tiberga et al.'s paper
\cite{tiberga_results_2020} for the benchmark participants' corresponding
values. The change in $\rho$ values from Moltres all fall within the range of
benchmark values
for all cases. Furthermore, the $\Delta\rho$ values are all within 1.1 pcm of
the corresponding values from the TUD-S$_2$ model in the benchmark paper. Given
that the $S_2$ discrete ordinates method is theoretically equivalent to the
multigroup neutron diffusion method, this indicates that Moltres is largely
consistent with the benchmark participants outside of differences from the
neutronics models.

\begin{figure}[htb]
  \centering
  \includegraphics[width=\columnwidth]{full-coupled}
  \caption{Temperature distribution from Moltres for the fully coupled
  system (Step 1.4) with buoyancy effects, $P = 1$ GW, and $U_{lid} = 0.5$
  m$\cdot$s$^{-1}$. The lines correspond to the streamlines of the velocity
  field.}
  \label{fig:color}
\end{figure}
%
\begin{table}[htb]
	\caption{Reactivity change in Step 1.4, relative to Step 0.2 under various
	$U_{lid}$ and $P$ values.}
	\centering
	\small
	\setlength\tabcolsep{1.5pt}
	\begin{tabular}{c c c c c c}
		\toprule
		& \multicolumn{5}{c}{$\rho_{s1.4} - \rho_{s0.2}$ [pcm]} \\
		\midrule
		{\backslashbox{$U_{lid}$ [m$\cdot$s$^{-1}$]}{$P$ [GW]}} & 0.2 & 0.4 & 0.6 & 0.8 & 1.0 \\
		\midrule
		0.0 & -263.7 & -498.3 & -730.9 & -966.7 & -1207.7 \\
		0.1 & -265.9 & -498.7 & -730.6 & -966.0 & -1206.7 \\
		0.2 & -268.1 & -498.8 & -729.4 & -963.7 & -1203.6 \\
		0.3 & -269.9 & -498.5 & -727.8 & -960.8 & -1199.5 \\
		0.4 & -271.9 & -498.5 & -726.5 & -958.3 & -1195.7 \\
		0.5 & -274.2 & -498.7 & -725.6 & -956.4 & -1192.7 \\
		\bottomrule
	\end{tabular}
	\label{table:full}
\end{table}

\FloatBarrier

\begin{table}[htb]
	\caption{Discrepancy values from Moltres alongside the average and standard
	deviation of the discrepancy values of the benchmark participants for Step
	2.1.}
	\centering
	\small
	\begin{tabular}{l l S S S}
		\toprule
		\multirow{2}{*}{\textbf{Step}} & \multirow{2}{*}{\textbf{Observable}} & {\multirow{2}{*}{\textbf{Moltres [\%]}}} & \multicolumn{2}{c}{\textbf{Benchmark [\%]}} \\
		& & & {Average} & {SD} \\
		\midrule
		\multirow{2}{*}{2.1} & Gain & 0.493 & 0.587 & 0.244 \\
		\cmidrule{2-5}
		& Phase shift & 1.741 & 2.176 & 0.554 \\
		\bottomrule
	\end{tabular}
	\label{table:disc2}
\end{table}
%
\begin{figure*}[htb]
	\centering
	\includegraphics[width=.8\columnwidth]{2-1-gain-plot}
	\includegraphics[width=.8\columnwidth]{2-1-phase-plot}
	\caption{Step 2.1 \textemdash\ Bode gain and phase plots of the frequency response of
	the fully coupled system.}
	\label{fig:2.1}
\end{figure*}

\subsection{Phase 2 results \& discussion}

Lastly, the following subsection discusses the results for the transient cases
in Step 2.1 which involve measuring the response in power output to periodic
perturbations in the heat transfer coefficient.

\subsubsection{Step 2.1: Forced convection transient}

Figure \ref{fig:2.1} shows the Bode gain and phase shift plots of the response
in power output in the fully coupled system. Along with the average discrepancy
values from Table \ref{table:disc2}, the results show that Moltres is
consistent with the benchmark. The gain data points from all \gls{MSR} software
agree closely with one another. Moltres reports an average discrepancy value of
0.496\%, slightly lower than the benchmark average of 0.587\%. On the other
hand, the phase shift data points show greater spread over the various driving
frequencies. We note the different timestepping schemes and timestep
sizes among the different software packages which is likely responsible for
the variations in the phase shift. Even with a precision of
$\pm0.9^\circ$ for each phase shift value, Moltres accurately reproduces the
correct trend with a lower average discrepancy (1.741\%) than the benchmark
participants' average (2.176\%).

\FloatBarrier