\section{Proofs: Comparison of  Rule Transformation Strategies}\label{sec:comparison_proofs}

We restate and give detailed proofs of two lemmas of \secref{sec:rule_inversion}.

\begin{lemma}\label{lemma:mp_to_md_with_proof}
  Any model ${\cal M}_P$ of ${\cal F}_P$ can be transformed into a model
  ${\cal M}_D$ of ${\cal F}_D$.
\end{lemma}

\begin{proof}
  We consider the transformation of a model ${\cal M}_P$ to a model
  ${\cal M}_D$, and assume ${\cal M}_P$ is a model of ${\cal F}_P$.
  We now construct an interpretation ${\cal M}_D$ for the formulas with the
  signature over ${\cal F}_D$.

  The interpretation ${\cal M}_D$ will be the same as ${\cal M}_P$,
  except for (1) the interpretation of the new types \texttt{Rulename$_C$},
  each of which will be chosen to be the set of all rule names having $C$ as
  conclusion, and (2) the interpretation of the new predicates $C^+$ on which
  we will focus now:
  For each rule  $\forall x_1, \dots, x_n.\; Pre(x_1,
  \dots, x_n) \IMPL C(x_1, \dots, x_n)$ with name  $rn$, whenever the $n$-tuple
  $(a_1, \dots, a_n)$ satsifies the precondition $Pre$ under ${\cal M}_P$ and, consequently,
  $(a_1, \dots, a_n) \in C^{{\cal M}_P}$, we will have   $(rn, a_1, \dots, a_n) \in (C^+)^{{\cal M}_D}$.

  It remains to be shown that ${\cal M}_D$ is indeed a model of ${\cal
    M}_D$. We show that related formulas in ${\cal F}_P$ and ${\cal F}_D$
  are interpreted as true in ${\cal M}_P$ resp.{} ${\cal M}_D$, where two
  formulas are \emph{related} if they are rules originating from the same rule
  of ${\cal R}_M$, or if they are related inversion predicates $Inv_C$ and $Inv_{C^+}$.

  We first address related rules. The proof is by well-founded induction over
  the rule order $\prec_R$. Consider a rule $r_P \in {\cal F}_P$ with rule
  name $rn_P$ which by construction has the form
  $r_p = \forall x_1, \dots x_n.\; pre_P^o \AND \NOT pre_P^1 \AND \NOT pre_P^k
  \IMPL C(x_1, \dots, x_n)$.
  We make a case distinction:
  \begin{itemize}
  \item Assume that for arguments $(a_1, \dots, a_n)$, interpretation
    ${\cal M}_P$ satisfies the precondition
    $pre_P^o \AND \NOT pre_P^1 \AND \NOT pre_P^k$ and thus also the
    conclusion. In this case, $(rn_P, a_1, \dots, a_n)\in (C^+)^{{\cal M}_D}$, thus
    satisfying the related rule $r_D \in {\cal F}_D$.
  \item Assume that for arguments $(a_1, \dots, a_n)$, interpretation
    ${\cal M}_P$ does not satisfy the precondition. Either $pre_P^o$ is not
    satisfied, leading again to a satisfying assignment of the related rule
    $r_D$, or one of the $pre_P^i$ is satisfied.

    In this case, as the rule $r_P^i$ with precondition $pre_P^i$ is strictly
    smaller than $r_P$ \wrt{} $\prec_R$, by induction hypothesis, also the
    postcondition of $r_P^i$ will be satisfied, so that in ${\cal M}_D$, one
    negated precondition of the related rule $r_D$ is not satisfied, so $r_D$
    is satisfied.
  \end{itemize}

  Once the equi-satisfiability of related rules has been established, it is
  easy to do so for related inversion predicates $Inv_C$ and $Inv_{C^+}$.
\end{proof}

\begin{lemma}\label{lemma:md_to_mp_with_proof}
  Any model ${\cal M}_D$ of ${\cal F}_D$ can be transformed into a model
  ${\cal M}_P$ of ${\cal F}_P$.
\end{lemma}

\begin{proof} (Sketch)
  In analogy to \lemmaref{lemma:mp_to_md}, we start from a model ${\cal M}_D$
  of ${\cal F}_D$ and construct a model ${\cal M}_P$ of ${\cal F}_P$.

  As in \lemmaref{lemma:mp_to_md}, the proof is by induction on $\prec_R$.
  Consider a rule $r_D \in {\cal F}_D$ with rule
  name $rn_D$ which by construction has the form
  $r_D = \forall x_1, \dots x_n.\; pre_D^o \AND \NOT post_D^1(rn_1) \AND \NOT post_D^k(rn_k)
  \IMPL C^+(rn_D, x_1, \dots, x_n)$. Again, we make a case distinction:
  \begin{itemize}
  \item Assume that for arguments $(a_1, \dots, a_n)$, interpretation
    ${\cal M}_D$ satisfies the precondition and thus also the conclusion. In
    this case, $(a_1, \dots, a_n)\in C^{{\cal M}_P}$, thus satisfying the
    related rule $r_P \in {\cal F}_P$.
  \item Assume that for arguments $(a_1, \dots, a_n)$, interpretation
    ${\cal M}_D$ does not satisfy the precondition. The interesting situation
    is if one $post_D^i(rn_i)$ is satisfied. At this point, we need the
    inversion formula of $post_D^i$, of the form
    $\forall r.\; post_D^i(r) \IMPL P_1(r) \OR \dots \OR P_p(r)$. The rule
    name $rn_i$ permits to select precisely the precondition $P_j$ of the
    related formula
    $r_P = \forall x_1, \dots x_n.\; pre_P^o \AND \NOT pre_P^1 \AND \NOT
    pre_P^k \IMPL C(x_1, \dots, x_n)$.
  \end{itemize}
\end{proof}


\documentclass[Thesis.tex]{subfiles}
\begin{document}
\chapter{The Quantum Problem}
\label{chp:the-quantum-problem}

\glsresetall

\section{Problem Statement}

Say you want to investigate the properties of some quantum mechanical system.
The first step is then to firmly establish how we should describe this system
and the laws that govern its behaviour.\footnote{For the entirety of this
thesis, we shall assume that the systems we consider do not show any significant
relativistic behaviour, so that no such considerations are necessary.}

If our system of interest consisted of non-quantum entities (e.g.\ the
trajectory of a baseball as it is thrown through the air towards a batter), we
would likely turn to our classical laws, such as Newton's second law of motion
%
\begin{align}
    \sum_i \vec F_i(t) = \dv{\vec p(t)}{t},
\end{align}
%
\noindent where $\vec F_i$ are the forces acting on the ball, and $\vec p$ is its momentum at
any given point in time, $t$. Using the law of motion we can use our knowledge about how the
environment affects the object to \emph{deterministically} calculate the resulting
behaviour. The really nice thing is that, if we also know the mass of the object, we
can derive the value of any other measurable physical quantity of interest. As such,
we can say that \emph{solving} a classical system consists of the following steps:

\begin{enumerate}
    \item Define the environment, i.e.\ the forces acting on the object(s)
    \item Use the second law of motion to obtain momentum $\vec p(t)$ and position $\vx(t)$
    \item Compute quantity of interest, $Q(\vec p, \vec x; t)$
\end{enumerate}

Moving to the quantum world, much of the same procedure remains the same. For the quantum
case, we have a different law of motion. In our non-relativistic view, this is the
\gls{tdse}:

\begin{align}
    \hat H\ket{\Psi} &= i\hbar \pdv{}{t}\ket{\Psi},\label{eq:schrodinger-time-dependent-general}
\end{align}
%
where $i=\sqrt{-1}$ is the imaginary unit and $\hbar=\flatfrac{h}{2\pi}$ is the reduced Planck constant.
The thing we want to solve for in this case is the so called wave function $\ket{\Psi}$
(explained momentarily), while the description of the system (analogous to the forces in
classical mechanics) goes into $\hat H$. We refer to the latter as the Hamiltonian
operator, and it should be a complete description of the kinetic and potential
energies of the particles involved. As an example, we write the equation for a
single particle at position $\vx$ in an energy potential $V(\vx; t)$ as follows
(where we explicitly use the position basis):

\begin{align}
    \qty[-\frac{\hbar^2}{2m} \laplacian + V(\vb x; t)]\Psi(\vb x;t) =
    i\hbar\pdv{\Psi(\vb x; t)}{t},\label{eq:schrodinger-time-dependent-position-basis}
\end{align}
%
where the first term constitutes the kinetic energy of the particle (with mass $m$), and the second term is
naturally the potential energy. For the systems that we shall consider in this thesis, the
Hamiltonians will all take this form, only varying the functional form of $V$.

Knowing the wave function $\Psi$ of a system is analogous to knowing position
and momentum in the classical view in that we can compute any observable
quantity from it (more on this in \cref{sec:obs-from-psi-to-Q}). As such, obtaining the full
expression for the correct wave function is of immense use.

The wave function lacks a clear physical intuition for what exactly it \emph{is},
like we have for position and momentum in classical mechanics. Perhaps the most helpful way to view $\Psi$ is
through the fact that its squared absolute value, $\abs{\Psi(\vb x; t)}^2$, is the
probability of finding a particle at position $\vb x$ at time $t$. Thinking of the (squared
norm of the) wave function as a substitute for the classical position $\vb x$ can
therefore be a helpful aid, as long as we keep the probabilistic nature of it in mind.

Summarizing the steps for \emph{solving} a quantum system, analogous to the
classical approach, we have the following plan:
\begin{enumerate}
    \item Define the environment through choosing a form for the Hamiltonian $\hat H$
    \item Use the \gls{tdse} to obtain the wave function $\ket\Psi$
    \item Use the wave function to compute quantities $Q$ of interest
\end{enumerate}

\section{Stationary States}

The \gls{tdse} (\cref{eq:schrodinger-time-dependent-position-basis}) is a partial differential equation,
since it contains partial derivatives of the wave function with respect to both position and
time. The standard approach to solving this equation is through \emph{separation of
variables}. We assume that we can factorize the full wave function as follows:

\begin{align}
    \Psi(\vb x; t) &= \psi(\vb x)\phi(t).\label{eq:separatable-wave-func-def}
\end{align}
%
In addition, we assume that $V(\vb x; t) = V(\vb x)$, i.e.\ that the potential is
time-independent.\footnote{There are systems for which this assumption does not hold. We
will, however, restrict ourself to consider only Hamiltonians for which this description
is valid} With these assumptions, we can divide through with $\Psi$ in
\cref{eq:schrodinger-time-dependent-position-basis} and obtain the
following:\footnote{It could be tempting to simply strike $\Psi$ from the lhs.\ of
\cref{eq:schrodinger-time-dependent-position-basis} when dividing by $\Psi$. Nevertheless, we
must remember that the Hamiltonian is an operator (specifically seen through the
$\laplacian$ in this case), and so we must divide only after letting this operate on
$\Psi$.}

\begin{align}
    \qty[- \frac{\hbar^2}{2m} \laplacian \psi + V(\vb x)\psi]\psi^{-1} &=
    i\hbar\dv{\phi}{t} \phi^{-1}.
\end{align}
%
We now make the following subtle observation: Since the lhs., a function of $\vb x$, is
equal to the rhs, a function of $t$, they must both be equal to a constant. If
this was not true, we could vary one of $\vx$ or $t$ and alter only one side of
the equation, leaving it invalid.
As both sides have units of energy, let's denote this constant energy as $E$, and proceed
to solve each equation by itself.

The time dependent equation becomes:

\begin{align}
    i\hbar \dv{\phi}{t} &= E\phi(t),
\end{align}
which is trivial to solve:
\begin{align}
    \phi(t) &= Ae^{-iEt/\hbar},
\end{align}
for some constant $A=\phi(0)$ determined by boundary conditions.

The time-independent equation, known as the \gls{tise}, is:
\begin{align}
    - \frac{\hbar^2}{2m} \laplacian\psi + V(\vb x)\psi =
    E\psi.\label{eq:schrodinger-time-independent-position-basis}
\end{align}
The solutions to this equation are the \emph{stationary states} of the system. If
we are able to find these solutions, then we automatically have also the full time
dependent solution through \cref{eq:separatable-wave-func-def}.

If we return \cref{eq:schrodinger-time-independent-position-basis} to the more general
form,
\begin{align}
    \hat H \ket{\psi} &= E\ket{\psi},
\end{align}
we can recognize the problem as an eigenvalue problem where we seek the eigenvalues ($E$)
and eigenvectors ($\ket{\psi}$) of the operator $\hat H$. In light of this, we prefer to
explicitly label the equation to account for the possibility that the equation could have
multiple (potentially infinite) solutions, and write this as
\begin{align}
    \hat H\ket{\psi_n} &= E_n\ket{\psi_n}.
\end{align}
Each of the $\ket{\psi_n}$ represents one possible stationary state, and could for instance be
different levels of energy excitations within an atom. For our purposes, we will only care
about the so called \emph{ground state}, i.e.\ the state $\ket{\psi_n}$ corresponding to the
lowest possible $E_n$. By convention, we assume that the energies are ordered such that $E_i
\leq E_j$ if $i < j$, and denote the ground state as $\ket{\psi_0}$ and the corresponding ground
state energy as $E_0$.

\section{Many-Body Systems}

Up until now, for simplicity, we've only considered the description of single-particle
systems. Changing the number of particles is a change in the system description, and as
such it entails modifying the Hamiltonian operator accordingly. Everything presented thus
far generalizes well to the case of more than one particle, simply by introducing the
appropriate sums. The general form of the many-body Hamiltonian we will consider is now:

\begin{align}
    \hat H &= - \sum_{i=1}^N \frac{\hbar^2}{2m_i} \laplacian_i + V(\vb x_1, \vb x_2,\dots,
    \vb x_N)\\
    &= -\sum_{i=1}^N \frac{\hbar^2}{2m_i} \laplacian_i + V(\vb
    X),\label{eq:Hamiltonian-operator-general}
\end{align}
were $\mat X \defeq (\vb x_1\ \vb x_2\ \dots\ \vb x_N)^T\in \mathbb{R}^{N\times D}$ is the matrix
of $D$-dimensional row vectors of coordinates for each particle. For further clarity,
$\vb x_i \defeq \sum_{d=1}^D x_{i,d} \vb e_d$ is a $D$-dimensional vector described by
its coordinates $x_{i,d}$ (with unit vectors $\vb{e}_d$), and the corresponding Laplacian
operator is
\begin{align}
    \laplacian_k \defeq \sum_{d = 1}^D \pdv[2]{}{x_{k,d}}.
\end{align}

\section{Requirements of Wave Functions}\label{sec:requirements-of-wave-functions}

We have stated earlier that by solving the Schrödinger equation and obtaining the wave
function, we can compute any desirable quantity of interest. In order for the wave
function to fulfill this rather impressive encoding of everything about the system, it has
to satisfy certain criteria. We now devote some special consideration to make these
requirements explicit.

In order to represent a physically observable system, a wave function $\Psi$ must:
\begin{enumerate}
    \item Be a solution to the Schrödinger equation
    \item Be normalizable (in order to represent a probability)
    \item Be a continuous function of space
    \item Have a continuous first order spacial derivative
    \item Obey suitable symmetry requirements
\end{enumerate}
%
While the first requirement is obvious, points 2-4 boil down to $\Psi$ taking a
functional form that is well behaved, satisfying required boundary conditions and being
possible to view as a \gls{pdf}. The last point is perhaps less clear, and
we devote some further attention to this point in particular.

\subsection{Symmetry of Wave Functions}

Nature has many examples of systems made up of particles of the same
species. That is, the particles all have the same mass, spin, electromagnetic
charge etc.\ such that there is no way to  distinguish one from the other by
measuring their properties. An example could be the electrons of an atom, all of
which have the exact same physical properties.

In classical mechanics, we can still distinguish identical particles by other
means. Imagine for instance a set of perfectly identical planets in orbit. Even
though they have all of the same physical properties, we can still enumerate
them and keep track of which is which. This is due to the fact that their
position in time and space is deterministically defined by their current state,
which allows us to track them.

In quantum mechanics, however, we no longer have this deterministic view. In
this world, even if we know where all the individual electrons are at a specific
point in time, we cannot say with certainty where they will be at a later
time. We blame this on the uncertainty principle, and the result is that systems of
identical particles become systems of \emph{indistinguishable} particles in
quantum mechanics.

Consider now a system of two indistinguishable particles, labeled $\vec x_1$ and
$\vec x_2$, where $\vec x_i$ contains all the quantum numbers required to describe
particle $i$ (e.g.\ position coordinates and the $z$ component of spin). The
system is then described by a wave function

\begin{align}
    \Psi(\vec x_1, \vec x_2).
\end{align}
Because the particles are indistinguishable, this labeling of 1 and 2 is
arbitrary, and so we should be able to relabel them:

\begin{align}
    \Psi(\vec x_2, \vec x_1).
\end{align}

These two expressions, which represent exchanging the two particles, \emph{must}
describe the same physical system. That is, the probabilities of both states
must be equal:

\begin{align}
    \abs{\Psi(\vec x_1, \vec x_2)}^2 &= \abs{\Psi(\vec x_2, \vec x_1)}^2\\
    \iff \Psi(\vec x_1,\vec x_2) &= e^{i\alpha}\Psi(\vec x_2, \vec x_1),
\end{align}
i.e.\ they can only differ in their complex phase, which doesn't affect any measurable
quantity. Repeating the exchange once more yields the original wave function,

\begin{align}
    \Psi(\vec x_1,\vec x_2) &= e^{2i\alpha}\Psi(\vec x_1, \vec x_2)\\
    \iff e^{i\alpha} &= \pm 1.
\end{align}
This result states that any wave function, upon the exchange of
indistinguishable particles, must be either symmetric (same sign) or
anti-symmetric (opposite sign) to that of the original. This is generalizable to
any number of particles, and is known as the \emph{Pauli exclusion principle}.
The following theorem summarizes the result~\cite{PhysRev-58-716}:

\begin{theorem}[Spin-Statistic
    Theorem]\label{theorem:spin-statistic}

    The wave function of a system of identical integer spin particles has the same value
    when the positions of any two particles are swapped. Particles with wave functions
    symmetric under exchange are called bosons.

    The wave function of a system of identical half-integer spin particles changes sign
    when two particles are swapped. Particles with wave functions antisymmetric under
    exchange are called fermions.
\end{theorem}

\section{Observables - From Wave Function to Measurement}
\label{sec:obs-from-psi-to-Q}

We have repeatedly claimed that armed with the correct wave function we can compute any
measurable quantity of interest. Finally, we consider how exactly we can go
about doing so.

Assume we want to compute an observable $O$. The first step is to determine the
corresponding \emph{operator} $\hat O$. This is in general done by taking the classical
description of the observable and performing a canonical transformation.\footnote{There are
also quantities that do not have a classical analog (e.g.\ spin) for which we can still
find operator forms.} Most notably, we have for the following transformations for
position and momentum:

\begin{align}
    \vb x &\rightarrow \hat\vx,\\
    \vb p &\rightarrow -i\hbar\grad.
\end{align}
For example, as is often the case, let's say we want to compute the total energy of the
system. For $N$ particles that would classically be:
\begin{align}
    H = \sum_{i=1}^N \frac{p_i^2}{2m_i} + V(\vb X),
\end{align}
where $\vb p_i$ denotes the momentum of particle $i$, all of which are placed in some
spacial potential $V$. It is easily verified that if we perform the above mentioned
substitutions we will recover \cref{eq:Hamiltonian-operator-general} and recognize
it as the Hamiltonian operator, $\hat H$.

Finally, having both the wave function and the appropriate operator $\hat O$ we can
proceed. Observables no longer have definite values in general as in classical
mechanics. Instead, we associate an expectation value with respect to the
\gls{pdf} described by $\Psi$:\footnote{Note that quantities
can still have definite values in certain states. This is then evident by the
expectation values having zero associated variance.}

\begin{align}
    \expval{O}=\expval{\hat O}&= \frac{\expval{\hat O}{\Psi}}{\braket{\Psi}} \\
    &= \frac{\int\dd{\vb X} \Psi^*(\vb X)\hat O(\vb X)\Psi(\vb X)}{\int\dd{\vb X}
    \abs{\Psi(\vb X)}^2},
\end{align}
where $\int\dd{\vb X}\qty(\cdot)$ indicates an integral over all possible configurations of the
system (e.g.\ all possible position and spin values for each particle). Often we have
required the wave function to be normalized in such a way that the denominator is equal to
unity, and it can then be omitted.

For many-body systems it should be apparent that this integral quickly becomes intractable
to compute analytically. In practice we employ a numerical strategy to evaluate these
integrals, where the technique we use depends on the dimensionality of the integral and
the required level of accuracy. In our case, due to the large number
of degrees of freedom in the systems we shall investigate, we will use
\gls{mci}. This will be discussed in more detail in \cref{chp:monte-carlo}.

\section{Example Systems}

So far we have not presented any particular systems. In this thesis we focus our
attention on two particular systems for illustrative purposes. We chose these systems
for their simplicity and/or the amount of preexisting results available
in the literature. We do this in order to benchmark our results against
known exact solutions, or when these do not exist, against verified approximate
results available in the literature.

\subsection{Quantum Dots}
\label{sec:quantum-dots-theory}

We consider a system of electrically charged particles (e.g.\ electrons) confined in a pure
isotropic harmonic oscillator potential, with an idealized total Hamiltonian
given by:

\begin{align}
    \begin{split}
        \hat H &= \sum_{i=1}^N\qty(-\frac{1}{2}\laplacian_i + V_{ext}(\vec r_i)) +
        \sum_{i < j} V_{int}(\vec r_i, \vec r_j)\\
        &= \sum_{i=1}^N\qty(-\frac{1}{2}\laplacian_i + \frac{1}{2}\omega^2
        r_i^2) + \sum_{i < j} \frac{1}{r_{ij}},
    \end{split}\label{eq:H-QD-def}
\end{align}
where we use natural units ($\hbar=c=m_e=1$) with energies in
atomic units (a.u.), $N$ denotes the number of particles in the system, and
$\omega$ is the oscillator frequency of the trap. Further, $\vec r_i$
denotes the position vector of particle $i$, with $r_i \defeq \norm{\vec r}$ and
$r_{ij}\defeq \norm{\vec r_i - \vec r_j}$ defined for notational brevity.

This system describes particles trapped in a parabolic potential well that pulls
them towards the bottom at all times, while simultaneously feeling the repulsive
Coulomb forces from the other particles. This hinders all particles from settling together
at the bottom. Even for this somewhat idealized system, the interplay between these two
opposing forces gives rise to a surprisingly complex problem, which will prove remarkably
hard to solve analytically even for two particles, and utterly impossible for higher $N$.

With the natural units in place, the only involved quantity without a proper
unit is length, i.e.\ what unit does the $\vb r_i$ have. A convenient
choice is to consider the mean square vibrational amplitude, $\expval{r^2}$, for
a single particle at $T = \SI{0}{\kelvin}$ placed in the oscillator trap.
Computing the expectation value we get
$\expval{r^2}=\flatfrac{\hbar}{2m\omega}$, and we define the unit of length as the
characteristic length of the trap, $a_{ho}=\qty(2\expval{r^2})^{\flatfrac{1}{2}}=\qty(\flatfrac{\hbar}{m\omega})^{\flatfrac{1}{2}}$~\cite{mhj-compphys-II}.

In our case, we limit ourselves to $N=2$ interacting electrons in two
dimensions in a trap with a frequency such that $\hbar \omega =
1$.\footnote{Note that, due to the natural units, this implies that $\omega =
  1$, which further means that $a_{ho} = 1$. It should be apparent why we use these
  definitions, as it simplifies both units and expressions.} We do this because for
this case we have exact, analytical solutions for the ground state energy. With the
interaction term included, the ground state energy is $E_0 = \SI{3}{\au}$~\cite{Taut1993}.
This limitation is purely one of convenience, as having exact benchmarks makes for better
verification of results. Furthermore, limiting the size of the problem makes the required
computation time manageable, which is good when experimenting with different techniques.

\subsubsection{Simple Non-Interacting Case}\label{sec:simple-non-inter-HO}
If we omit the interacting terms in \cref{eq:H-QD-def} we have
the standard harmonic oscillator Hamiltonian:
\begin{align}
  \label{eq:ho-no-interaction-hamiltonian}
    \hat H_0 &= \sum_{i=1}^N\qty(-\frac{1}{2}\laplacian_i +
    \frac{1}{2}\omega^2 r_i^2).
\end{align}
This Hamiltonian lends itself to analytical solutions, and the stationary
single particle states are (in 2D)~\cite{griffiths_schroeter_2018}:
\begin{align}\label{eq:ho-single-particle-orbitals}
    \phi_{n_x, n_y}(x, y) &= A H_{n_x}(\sqrt\omega x)H_{n_y}(\sqrt\omega y)
    e^{-\frac{\omega}{2}\qty(x^2 + y^2)},
\end{align}
for quantum numbers $n_x, n_y = 0, 1,\dots$, and the Hermite polynomials
$H_n$ (not to be confused with the Hamiltonians, and never to be mentioned again). The
ground state, $n_x=n_y=0$ is simply
\begin{align}
  \label{eq:ho-no-interaction-ground-state}
    \phi_{00}(x,y) =
    \sqrt{\frac{\omega}{\pi}}e^{-\frac{\omega}{2}\qty(x^2+y^2)}.
\end{align}
Using this wavefunction we can calculate the ground state
energy for one particle,
\begin{align}
    \epsilon_{00} = \frac{\expval{\hat H_0}{\phi_{00}}}{\braket{\phi_{00}}}
    = \omega = \SI{1}{\au}
\end{align}
The ground state wavefunction for the (unperturbed) two-electron case is simply the
product of the one-electron wave functions,
\begin{align}
    \begin{split}
        \Phi(\vec r_1, \vec r_2) &= \phi_{00}(\vec r_1)\phi_{00}(\vec r_2)\\
        &= \frac{\omega}{\pi} e^{-\frac{\omega}{2}\qty(r_1^2+r_2^2)}.
    \end{split}\label{eq:Phi-non-inter}
\end{align}
We can once again evaluate the ground state energy analytically, which yields
\begin{align}
    E_0 = \frac{\expval{\hat H_0}{\Phi}}{\braket{\Phi}}
    = 2\omega =\SI{2}{\au}
\end{align}
This result is not surprising, as adding one more particle, without any
interactions, should simply double the energy. Another way to look at it is
that the simple harmonic oscillator solution gives $\flatfrac{\omega}{2}$
per degree of freedom, so adding another two yields and extra $\omega$.

When the two particles are electrons, we may say something about their total
spin. As electrons are fermions, their total wavefunction must be
anti-symmetric upon interchanging the labels $1$ and $2$.
\Cref{eq:Phi-non-inter} is obviously symmetric, and so the
spin-wavefunction must necessarily be anti-symmetric. For the combination of
two spin-1/2 particles, there is only one candidate, namely the spin-$0$
singlet:

\begin{align}
    \chi_0 = \frac{1}{\sqrt 2}\qty(\ket{\uparrow\downarrow} -
    \ket{\downarrow\uparrow}).
\end{align}
A similar argument can be made for particles with different spins.

\subsubsection{Considerations from the Virial Theorem}

The virial theorem gives a general relation for the time-averaged kinetic
energy $\expval{K}$ and the corresponding potential energy
$\expval{V_{pot}}$ of a stable system of $N$ particles. In general the
theorem states:

\begin{align}
    \expval{K} = -\frac{1}{2}\sum_{k=1}^N \expval{\vec F_k \cdot \vec
    r_k},\label{eq:virial-theorem}
\end{align}
where $\vec F_k$ denotes the combined forces acting on particle $k$, located
at position $\vec r_k$. For a radial potential on the form $V(r)=ar^n$, such
that the potential between any two particles in the system depends on some
power of the inter-particle distance, the
theorem takes the following form:
\begin{align}
    \expval{K} = \frac{n}{2}\expval{V_{TOT}}
\end{align}
where $V_{TOT}$ denotes the sum of the potential energy $V(r)$ over all
pairs of particles.

Although the harmonic oscillator potential does not depend on the
\emph{inter-particle} distance, but rather on the positions of each particle,
it % TODO, what was the edit?
works out to the same relation in our case. Computing the full relation for
our Hamiltonian for two electrons in two dimensions, it even works out so
that we can use the same relation on the harmonic oscillator potential and the Coulomb
potential separately, and add the result. This means that the virial theorem
predicts the following~\cite{Katriel2012}:

\begin{align}
    \expval{K} = \expval{V_{ext}} -
    \frac{1}{2}\expval{V_{int}}.\label{eq:virial-result}
\end{align}
Note that this implies that we should consider the \emph{total} kinetic
energy, and the \emph{total} external and internal potential energies, as opposed to per
particle.

\subsection{Liquid $^4$He}
\label{sec:liquid-helium-theory}

Consider now an infinite collection of helium atoms ($^4$He) packed with a given density,
$\rho$. As infinities are hard to work with, we model this by considering a
cubic simulation box with side lengths $L$ and periodic boundary conditions. The
infinite collection is then composed of stacking copies of such simulation boxes
together. ~\cref{fig:pbc-illustration} shows an illustration of the idea.

\begin{figure}[h]
  \centering
  \input{illustrations/PBC-illustration.tex}
  \caption[Illustration of periodic boundary conditions]{Illustration of $^4$He organized into a grid of identical simulation
    boxes. The actual boxes are three-dimensional.\citesource{writing/illustrations/PBC-illustration.tex}}
  \label{fig:pbc-illustration}
\end{figure}

The Hamiltonian for this system is

\begin{align}
    \hat H &= -\sum_{i=1}^N \frac{\hbar^2}{2m}\laplacian_i + \sum_{i < j} V(r_{ij})
\end{align}
i.e.\ the kinetic energy of all atoms, plus an interaction potential dependent on
the distance between all pairs of atoms. The mass $m$ is the mass of one $^4He$
atom. The form of $V$ is not known analytically, but is experimentally probed to
great accuracy. Theorists have since fitted specific functional forms to the
experimental data, and we will do our calculations using one of these
potentials. The most commonly used is the simple Lennard-Jones (LJ)
potential~\cite{Kalos-1981}:

\begin{align}
    \label{eq:Lennard-Jones-def}
    V(r)
     &= 4\epsilon\qty[\qty( \frac{\sigma}{r} )^{12} - \qty( \frac{\sigma}{r} )^6 ]
\end{align}
with $\epsilon/\kappa = \SI{10.22}{\K}$\footnote{$\kappa$ is the Boltzmann constant.} and $\sigma = \SI{2.556}{\angstrom}$. This
models the competing forces of the atoms' mutual repulsion and attraction. The
positive term describes the short range Pauli repulsion due to overlapping
electron orbitals, and the negative term describes the long range attraction
due to phenomena such as van der Waals forces.

We can also use the slightly more accurate (and complicated) potential named HFDHE2~\cite{Aziz-hfdhe2}:

\begin{align}
    \label{eq:HFDHE2-def}
    V(r) &= \epsilon
    \left\{\!\begin{aligned}
        &A \exp(-\alpha \frac{r }{ r_m})\\
        &- F(r) \qty[ C_6  \qty(\frac{r_m }{ r})^6 + C_8  \qty(\frac{r_m }{ r})^8 + C_{10} \qty(\frac{r_m }{ r})^{10}]
    \end{aligned}\right\}
\end{align}
with

\begin{align}
    F(r) &= \begin{cases}
        \exp( - [D \frac{r_m}{r} -  1]^2 ) & \qfor \frac{r}{r_m} \leq D\\
        1 & \qotherwise
    \end{cases}
\end{align}
with the following parameters:
\begin{align}\label{eq:HFDHE2-parameters}
    \begin{split}
        &A = \num{0.5448504e6}\\
        &\alpha = \num{13.353384}\\
        &D = \num{1.241314}\\
        &r_m= \SI{2.9673}{\angstrom}
    \end{split}
    \begin{split}
        &\epsilon/\kappa = \SI{10.8}{\K}\\
        &C_6= \num{1.37732412}\\
        &C_8= \num{0.4253785}\\
        &C_{10}= \num{0.178100}\\
    \end{split}
\end{align}
Both potentials grow rapidly for small $r$, and tend to $0$ for large $r$. The
interesting sections of both potentials are shown
in~\cref{fig:helium-potentials-plot}. The potentials are very similar, with the
main difference being the depth of the well and how sharply the potential dies
off.

\begin{figure}[h]
  \centering
  \input{illustrations/helium-potentials.tex}
  \caption[Lennard-Jones and HFDHE2 potentials]{Lennard-Jones and HFDHE2 potentials used to model the potential
    between pairs of $^4$He atoms. Both potentials grow rapidly towards infinity
  when $r\to0$ and approach zero when $r\to\infty$.\citesource{writing/illustrations/helium-potentials.tex}}
  \label{fig:helium-potentials-plot}
\end{figure}

\subsubsection{A Note About Units}

In the literature it is common to express the energies in Kelvin per particle,
and lengths in angstrom~\cite{Kalos-1981, Aziz-hfdhe2, ruggeri2018}. In order to convert energies to temperatures we
divide by the Boltzmann constant, $\kappa$, because it has the unit of Joules per
Kelvin. The Hamiltonian becomes:
\begin{align}
  \hat H &= -\sum_{i=1}^N \frac{\hbar^2}{2m\kappa}\laplacian_i + \sum_{i<j}\frac{1}{\kappa}V(r_{ij}).
\end{align}

If we use SI units for the constants involved we get:
\begin{align}
  \frac{\hbar^2}{2m\kappa} = \SI{6.059651974e-20}{\metre^2\kelvin} = \SI{6.059651974}{\angstrom^2\kelvin},
\end{align}
which turns out to be a reasonably sized number when we use angstrom as units for
lengths.\footnote{Note that $\laplacian$ has units of $\text{length}^{-2}$, so
  the units work out to Kelvin.} We will use these values in the implementation,
and simply refer to energies in Kelvin when we study this system. However, if
the reader ever wants to convert the units, for comparison with other works
perhaps, simply multiplying with the value of $\kappa$ in the unit system of
choice should yield the corresponding energy.

\subsubsection{Minimum Image}

Because we assume a periodic structure we must take this into account when
calculating distances. Consider two particles, A and B, located at opposite
corners of the simulation box. What is the distance between them? The intuitive
answer is $\norm{\vb r_A - \vb r_B} = \sqrt{3}\,L$, i.e.\ the length of the
diagonal of the cubic box. Nevertheless, the answer we should use is zero. The
reason is that there is a periodic copy of the box stacked such that A and the
periodic B copy are located at the same corner. This way of calculating
distances is called minimum image, and says that we should use the shortest
possible distance. In general, if two particles have a distance of $\Delta x =
\flatfrac{L}{2} + \delta_x$ ($\delta_x\geq 0$, each spatial coordinate handled
individually), the minimum image distance is $\Delta x_{\mathit{min}} = \Delta x
- L = \flatfrac{L}{2} - \delta_x$.

In our implementation, whenever we need a distance between two particles, we use
the following prescription (example in Python):

\begin{lstlisting}[language=Python]
import numpy as np

# Example coordinates.
L = 5.0
p1, p2 = np.array([0, 0, 0]), np.array([2, 3, 4])

diff = p2 - p1  # [2, 3, 4]
diff_minimum = diff - L * np.round(diff / L)  # [2, -2, -1]
\end{lstlisting}
The last variable, \texttt{diff\_minimum} represents the minimum image distance
vector and this is the one used for any further calculations.

\subsubsection{Correcting for Periodicity in Potentials}

The potential $V(r_{ij})$ depend on the inter-particle distances. However,
there is an infinite amount of particle pairs if we consider the system as a
whole. We use periodic boundary conditions, and shall only consider pairs where
both particles are in the simulation box (but still respecting the minimum image
convention). This limitation excludes any interactions that act on length scales
larger than $\flatfrac{L}{2}$, and this can have a significant impact on the
total system.

In an attempt to limit this effect, we modify the potentials slightly. First we
explicitly truncate the potential to be zero for large distances, and shift it
slightly so that the function remains continuous. That is, considering $V(r)$
from~\cref{eq:Lennard-Jones-def}, we change it as follows:

\begin{align}
  \label{eq:Lennard-Jones-truncated-def}
  V_\mathit{trunc}(r) &=
                          \begin{cases}
                            V(r) - V(\flatfrac{L}{2}) & \qfor r \leq \flatfrac{L}{2}\\
                            0 & \qotherwise
                          \end{cases}.
\end{align}
Note that in order for this truncation to be sensible, we must use a
sufficiently large box so that $V(\flatfrac{L}{2})$ is sufficiently close to
zero. What exactly \emph{sufficiently} means is left rather vague, but we
mention it as a potential source of error.\\

The truncation obviously leads to slightly less precise results, but this can
partially be corrected for with so-called \emph{tail corrections}. The approach
is to model the potential contribution of all particles further away than
$\flatfrac{L}{2}$ in a mean-field manner. The result is simply adding a constant
term, and acts only to shift the total potential in a given direction. As the
purpose of this thesis is not to obtain the most realistic results possible, and
rather a \emph{relative} comparison of methods, we will not spend more time on
specific ways of implementing such corrections.

\end{document}


\section{The Empirical Dust Attenuation Framework} \label{sec:dem}
In this section, we describe the Empirical Dust Attenuation (\eda)
framework and present the \eda~prescription used in this work to apply
dust attenuation to our simulated galaxies.
%For each simulated galaxy, the \eda~assigns a dust attenuation
%curve that is parameterized as a function of the galaxy's properties
%($M_*$, ${\rm SSFR}$), the \eda~parameters, and randomly
%sampled inclination. With the \eda, we can apply a wide variety of dust
%attenuation that include correlation between dust attenuation and physical
%galaxy properties.
% Later, we demonstrate that we can accurately reproduce SDSS observations with the \eda~and use it to test galaxy formation models and shed light on dust in galaxies.
We begin by defining the dust attenuation curve, $A(\lambda)$, as
\begin{equation} \label{eq:full_atten}
    F_o (\lambda) = F_i (\lambda) 10^{-0.4 A(\lambda)}
\end{equation}
where $F_o$ is the observed flux and $F_i$ is the intrinsic flux. We normalize
the attenuation to the $V$ band attenuation,
\begin{equation}
    A(\lambda) = A_V \frac{k(\lambda)}{k_V}
\end{equation}
so that $A_V$ determines the amplitude of the attenuation, while $k(\lambda)$
determines the wavelength dependence.
The \eda~assigns a $A_V$ and $k(\lambda)$ for each simulated galaxy.
For $A_V$, we use the slab model~\citep[\eg][]{somerville1999, somerville2012},
where $A_V$ is a
%The \eda~framework assigns $A(\lambda)$ to every galaxy in the simulations using some flexible prescription. For the \eda~prescription in this work, we assign $A_V$ for each galaxy using the slab model, where $A_V$ is a
function of galaxy inclination, $i$, and galaxy properties: %its optical depth, $\tau_V$:
\begin{equation} \label{eq:slab}
    A_V = -2.5 \log \left[ \frac{1 - e^{-\tau_V\,\sec i}}{\tau_V\,\sec i} \right].
\end{equation}
$\tau_V$ is the $V$-band optical depth that depends linearly on $M_*$ and
$\ssfr$:
%We parameterize $\tau_V$ using a linear $M_*$ and $\ssfr$ dependence:
\begin{equation} \label{eq:tauv}
    \tau_V(M_*, \sfr) = \mtaum \log \left(\frac{M_*}{10^{10} M_\odot}\right) +
    \mtaus \log \left(\frac{\ssfr}{10^{-10}yr^{-1}}\right) + c_\tau.
\end{equation}
$\mtaum$, $\mtaus$, and $c_\tau$ represent the $M_*$ dependence, the $\ssfr$
dependence, and amplitude of $\tau_V$. Since $\tau_V$ is optical depth, we
impose a $\tau_V \ge 0$ limit.
For each galaxy, we uniformly sample $\cos i$ from 0 to 1 to introduce
stochasticity.
This produces significant variance in $A_V$ so galaxies with the same
properties do not have identical dust attenuation.

Our $\tau_V$ parameterization is based on correlations between dust attenuation
and galaxy properties that have been established by
observations~\citep[\eg~][]{garn2010, battisti2016, salim2020}.
Previous works have parameterized dust attenuation based on other galaxy properties
such as gas density, gas metallicity, or star-gas geometry, motivated by
the fact that dust attenuation on small scales depends on local stellar and gas
properties~\citep[\eg][]{somerville1999, somerville2012, steinacker2013,
camps2015, narayanan2018, trayford2020, vogelsberger2020}.
Galaxies in the SIMBA, TNG, and EAGLE, however, have
substantially different gas masses and metallicites~\citep[][Maller \etal~in prep.]{dave2020}.
If we were to parameterize $\tau_V$ using these properties, their differences
would dominate any comparison of dust attenuation.
%Instead, our parameterization for $\tau_V$ is based on the correlation between dust attenuation and galaxy properties that have been established by observations~\citep[\eg~][]{garn2010, battisti2016, salim2020}.
In Appendix~\ref{sec:slab}, we confirm the correlation between $A_V$ and
the properties $M_*$ and $\ssfr$ in the \cite{salim2018} GSWLC2 sample
(Figure~\ref{fig:dep}).
%We therefore include in Eq.~\ref{eq:tauv} the correlation between $A_V$ and galaxy $M_*$ and $\ssfr$.

In our \eda, we use the slab model because it provides a simple
prescription for generating a distribution of $A_V$ that depends on
randomly sampled $i$, with loose physical motivations.
For star-forming galaxies, which typically have disc-like morphologies, the
slab model produces $A_V$ that is correlated with $i$ in a way consistent
with observations: edge-on galaxies have higher $A_V$ than face-on
galaxies~\citep[\eg][]{conroy2010, wild2011, battisti2017, salim2020}.
Nevertheless, the slab model is a simplification.
In reality, $A_V$ depends on the detailed star-to-dust geometry.
Furthermore, we assign $A_V$ to all galaxies, not just star-forming.
For quiescent galaxies, which typically have elliptical morphologies, the
slab model serves only as an \emph{empirical} prescription for statistically
sampling $A_V$.
The~\eda~seeks to assign an accurate distribution of dust
attenuation curves for an ensemble of galaxies --- \emph{not} to accurately
model dust attenuation for individual galaxies.
In this regard, we demonstrate in Appendix~\ref{sec:slab} that the slab model
can match the observed distribution of $A_V$, even for samples that
include quiescent galaxies.

For the wavelength dependence of the attenuation curve, $k(\lambda)$, we
use \cite{noll2009} parameterization:
\begin{equation} \label{eq:noll}
    k(\lambda) = \left(k_{\rm Cal}(\lambda) + D(\lambda)\right) \left(
    \frac{\lambda}{\lambda_V} \right)^\delta.
\end{equation}
Here $k_{\rm Cal}(\lambda)$ is the \cite{calzetti2001} curve:
\[
    k_{\rm Cal}(\lambda) =
    \begin{cases}
        2.659 (-1.857 + 1.040/\lambda) + R_V, & 6300 A \le \lambda \le
        22000 A \\
        2.659 (-2.156 + 1.509/\lambda - 0.198/\lambda^2 + 0.011/\lambda^3) +
        R_V & 1200 A \le \lambda \le 6300 A
    \end{cases}
\]
where $\lambda_V = 5500 A$ is the $V$ band wavelength and $\delta$ is the slope
offset of the attenuation curve from $k_{\rm Cal}$. Since $\delta$ correlates
with galaxy properties~\citep[\eg][see also Appendix~\ref{sec:slab}]{wild2011, battisti2016, leja2017, salim2018},
we parameterize $\delta$ with a similar $M_*$ and $\ssfr$ dependence as
$\tau_V$:
\begin{align} \label{eq:delta}
    \delta(M_*, \sfr) &= \mdeltam \log \left(\frac{M_*}{10^{10}
    M_\odot}\right) + \mdeltas \log \left(\frac{\ssfr}{10^{-10}yr^{-1}}\right)
    + c_\delta.
\end{align}
% Although a number of works have found correlation between the attenuation
% curve slope and inclination~\citep{wild2011, chevallard2013, battisti2017b},
% \cite{salim2020}, most recently, found that the driver of this trend is the
% relationship between $A_V$ and slope. We therefore do not include an
% inclination dependence in $\delta$.
$D(\lambda)$ in Eq.~\ref{eq:noll} is the UV dust bump, which we parameterize using
the standard Lorentzian-like Drude profile:
\begin{equation}
    D(\lambda) = \frac{E_b(\lambda~\Delta \lambda)^2}{(\lambda^2 -
    \lambda_0^2)^2 + (\lambda~\Delta \lambda)^2}
\end{equation}
where $\lambda_0 = 2175 \AA$, $\Delta \lambda = 350\AA$, and $E_b$ are the
central wavelength, full width at half maximum, and strength of the bump,
respectively.
We include the UV dust bump since we use UV color as one of our observables.
\cite{kriek2013} and \cite{tress2018} find that $E_b$ correlates with $\delta$ for star-forming galaxies at $z{\sim}2$.
\cite{narayanan2018} confirmed this dependence in simulations.
Hence, we assume a fixed relation between $E_B$ and $\delta$: $E_b =
-1.9~\delta + 0.85$~\citep{kriek2013}.
Allowing the slope and amplitude
of the $E_B$ and $\delta$ relation to vary does {\em not} impact our results;
however, we also do not derive any meaningful constraints on them. In
Table~\ref{tab:free_param}, we list and describe all of the free parameters of
our \eda~prescription.

%In $\tau_V$ we include the correlation between $A_V$ and the galaxy's properties , found in both observations and simulations~\citep[\eg][]{narayanan2018, salim2020}.

$\ssfr$ of galaxies are used to calculate $\tau_V$ and $\delta$ in
Eqs.~\ref{eq:tauv} and~\ref{eq:delta}. However, due to mass and temporal resolution limits,
some galaxies in the simulations have $\sfr=0$ --- \ie~an unmeasurably low
SFR~\citep{hahn2019c}. They account for 17, 19, 9\% of galaxies
in SIMBA, TNG, and EAGLE, respectively. Since Eqs.~\ref{eq:tauv}
and~\ref{eq:delta} depend on $\log\ssfr$, they cannot be used in the equations
to derive $\tau_V$ and $\delta$ for these galaxies. To account for this issue,
we assign $\sfr_{\rm min}$, the minimum non-zero $\sfr$ in each simulation, to
$\sfr=0$ galaxies when calculating $\tau_V$ and $\delta$. For SIMBA, TNG, and
EAGLE, $\sfr_{\rm min}=0.000816$, $0.000268$, and $0.000707 M_\odot/yr$,
respectively. Although
this assumes that $\sfr=0$ galaxies have similar dust properties as the galaxies
with $\sfr = \sfr_{\rm min}$, since the simulations have very low $\sfr_{\rm min}$
we expect galaxies with $\sfr = \sfr_{\rm min}$ to have little recent
star-formation and low gas mass, similar to $\sfr=0$ galaxies.

%Since $\sfr=0$ galaxies do not account for a large fraction of our simulated galaxies, we directly sample their observables ($G, R, NUV$, and $FUV$) from the distribution of observables for SDSS quiescent galaxies. This way, we ensure that the attenuation of $\sfr=0$ galaxies does not impact the rest of the \eda~parameters. In Appendix~\ref{sec:res}, we discuss the resolution effects in more detail and demonstrate that our results are \emph{not} impacted by other prescriptions for attenuating $\sfr=0$ galaxies.

In summary, to apply the \eda~to a simulated galaxy population, we first
assign a randomly sampled $i$ to each galaxy ($\cos i$ uniformly sampled from 0 to 1).
$\tau_V$ and $\delta$ are calculated for
the galaxy based on its $M_*$,
$\ssfr$ and the \eda~parameters.
We then calculate $A_V$ and $k(\lambda)$ to determine $A(\lambda)$ for each galaxy.
Afterwards, we attenuate the galaxy SEDs using Eq.~\ref{eq:full_atten} and use
the attenuated SEDs to calculate the observables: $g, r, NUV$, and $FUV$
absolute magnitudes.
In Figure~\ref{fig:dem_av}, we present attenuation curves, $A(\lambda)$,
generated by the \eda~for galaxies with different $\sfr$ and $M_*$ values.
We present star-forming galaxies with $\{M_*, \sfr\} = \{10^{10}M_\odot,
10^{0.5}M_\odot/yr\}$ (blue), $\{10^{11}M_\odot, 10^{1} M_\odot/yr\}$
(green) and a quiescent galaxy with $\{10^{11}M_\odot, 10^{-2}M_\odot/yr\}$
(red).
We use an arbitrary set of \eda~parameters ($\mtaum, \mtaus, c_\tau,
\mdeltam, \mdeltas, c_\delta$) within the prior range listed in
Table~\ref{tab:free_param}.
We set $i=0$ (edge-on) for all $A(\lambda)$ in Figure~\ref{fig:dem_av} for
simplicity.
%In practice the \eda~uniformly samples $\cos i$ from 0 to 1 for each galaxy.
For comparison, we include the \cite{calzetti2001} attenuation curve.
The \eda~produces attenuation curves with a wide range of amplitudes and slopes
for galaxies based on their physical properties.

\begin{figure}
\begin{center}
    \includegraphics[width=0.6\textwidth]{figs/dems.pdf}
    \caption{\label{fig:dem_av}
    Attenuation curves, $A(\lambda)$, assigned by our Empirical Dust
    Attenuation (\eda) prescription to edge-on galaxies with different $\sfr$ and
    $M_*$ values for an arbitrary set of \eda~parameters. We include
    $A(\lambda)$ for star-forming galaxies with $\{M_*, \sfr\} =
    \{10^{10}M_\odot, 10^{0.5}M_\odot/yr\}$ (blue), $\{10^{11}M_\odot, 10^{1}
    M_\odot/yr\}$ (green) and a quiescent galaxy with $\{10^{11}M_\odot,
    10^{-2}M_\odot/yr\}$ (red). We set $i=0$ for
    all the galaxies in the figure for simplicity but in practice the
    \eda~uniformly samples $\cos i$ from 0 to 1 for each galaxy.
    For comparison, we include the \cite{calzetti2001} attenuation curve.
    {\em The \eda~provides a flexible prescription for assigning dust
    attenuation to galaxies based on their physical properties ($M_*$ and
    $\ssfr$) and the \eda~parameters.}
    }
\end{center}
\end{figure}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% table of free parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{table}
    \caption{Free parameters of the Empirical Dust Attenuation Model}
    \begin{center}
        \begin{tabular}{ccc} \toprule
            Parameter & Definition & prior\\[3pt] \hline\hline
            %\multicolumn{3}{c}{DEM with slab model}\\ \hline
            $\mtaum$ & $M_*$ dependence of the optical depth, $\tau_V$ & flat $[-5., 5.]$\\
            $\mtaus$ & $\ssfr$ dependence of $\tau_V$  & flat $[-5., 5.]$\\
            $c_{\tau}$ & amplitude of $\tau_V$ & flat $[0., 6.]$\\
            %\hline
            %\multicolumn{3}{c}{DEM with $\mathcal{N}_T$ model}\\ \hline
            %$m_{\mu,1}$ & Slope of the $\log M_*$ dependence of optical depth,
            %$\tau_V$ & flat $[-5., 5.]$\\
            %$m_{\mu,2}$ & Slope of the $\log {\rm SFR}$ dependence of optical
            %depth, $\tau_V$ & flat $[-5., 5.]$\\
            %$c_{\mu}$ & amplitude of the optical depth, $\tau_V$ & flat $[0., 6.]$\\
            %$m_{\sigma,1}$ & Slope of the $\log M_*$ dependence of optical depth, $\tau_V$ & flat $[-5., 5.]$\\
            %$m_{\sigma,2}$ & Slope of the $\log {\rm SFR}$ dependence of optical depth, $\tau_V$ & flat $[-5., 5.]$\\
            %$c_{\sigma}$ & amplitude of the optical depth, $\tau_V$ & flat $[0.1, 3.]$\\
            %\hline
            $\mdeltam$ & $M_*$ dependence of $\delta$, the attenuation curve slope offset & flat $[-4., 4.]$\\
            $\mdeltas$ & $\ssfr$ dependence of $\delta$ & flat $[-4., 4.]$\\
            $c_{\delta}$ & amplitude of $\delta$ & flat $[-4., 4.]$\\
            %$f_{\rm neb}$ & nebular attenuation fraction & flat $[1., 4.]$\\
            \hline
        \end{tabular} \label{tab:free_param}
    \end{center}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mhchem}
\usepackage{stmaryrd}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\graphicspath{ {./images/} }
\usepackage{bbold}
\usepackage{hyperref}
\hypersetup{colorlinks=true, linkcolor=blue, filecolor=magenta, urlcolor=cyan,}
\urlstyle{same}

\begin{document}
\section{Contents}
1 Convolutional Neural Networks $\ldots \ldots \ldots \ldots \ldots \ldots \ldots$

$1.1$ Convolutional operations $\ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots$

1.1.1 Images as matrix $\ldots \ldots \ldots \ldots \ldots . . . . . . . . . . . . . . . . .$

1.1.2 Convolution operation with one channel $\ldots \ldots \ldots \ldots \ldots .$

1.1.3 Convolution with stride (one channel) $\ldots \ldots \ldots \ldots \ldots \ldots .$

1.1.4 Convolutional operations with multi-channel $\ldots \ldots \ldots \ldots .6$

$1.1 .5$ Pooling operation in CNNs $\ldots \ldots . \ldots . . . . . . . . . . . . . . . . .$

$1.2$ Examples of convolution filters and performance $\ldots \ldots \ldots \ldots, \ldots$

1.2.1 Calculation with convolutions .............................. 8

$1.2 .2 \quad$ Image convolution examples $\ldots \ldots \ldots \ldots . \ldots . . . . . . . . . .$

1.2.3 Line detection by 1D Laplacian $\ldots \ldots \ldots . \ldots . . . . . . . . .$

1.2.4 Edge detection by 2D Laplacian operator $\ldots \ldots \ldots \ldots \ldots .12$

1.2.5 The Laplacian of Gaussian $\ldots \ldots \ldots \ldots . . . . . . . . . . . .$

1.2.6 Other examples with ReLU activation $\ldots \ldots \ldots \ldots \ldots .15$

1.2.7 Some other examples $\ldots \ldots \ldots \ldots \ldots \ldots \ldots . . . . . . . . . . . . . . . . . . .$

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-01}

References $\ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots \ldots$

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-02}

\section{Convolutional Neural Networks}
\subsection{Convolutional operations}
\subsubsection{Images as matrix}
An image can be viewed as a piecewise constant function on a grid. Images with different resolutions can then be viewed as functions on grids of different sizes. The use of such multiple-grids is a main technique used in the standard multigrid method for solving discretized partial differential equations, and it can also be interpreted as a main ingredient used in convolutional neural networks (CNN) for image calssification.

An image can be viewed as a function on a grid [6] on a rectangle domain $\Omega \in \mathcal{R}^{2}$. Without loss of generality, we assume that the grid, $\mathcal{T}$, is of size
$$
m=2^{s}, \quad n=2^{t}
$$
for some integers $s, t \geq 1$. Starting from $\mathcal{T}_{1}=\mathcal{T}$, we consider a sequence of coarse grids with $J=\min (s, t)$ (as depicted in Fig. 1.1.1 with $J=4)$ :
$$
\mathcal{T}_{1}, \mathcal{T}_{2}, \ldots, \mathcal{T}_{J}
$$
such that $\mathcal{T}_{\ell}$ consist of $m_{\ell} \times n_{\ell}$ grid points, with
$$
m_{\ell}=2^{s-\ell+1}, \quad n_{\ell}=2^{t-\ell+1} .
$$
Here, please note that each element in this grid can be viewed as a pixel or an image or an element in a matrix.

\subsubsection{Convolution operation with one channel}
For simplicity of exposition, we denote
$$
m=m_{1}=2^{s}, \quad n=n_{1}=2^{t} .
$$
\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-04}

Fig. 1.1. multilevel grids for piecewise constant functions (images)

Definition 1. A convolution defined on $\mathbb{R}^{m \times n}$ is a linear mapping $K *: \mathbb{R}^{m \times n} \mapsto \mathbb{R}^{m \times n}$ defined with padding, for any $g \in \mathbb{R}^{m \times n}$ by:
$$
[K * g]_{i, j}=\sum_{p, q=-k}^{k} K_{p, q} g_{i+p, j+q}, \quad i=1: m, j=1: n
$$
Here we note that the indices for the entries in $K$ are given un a special way. For example, if $k=1, K \in \mathbb{R}^{3 \times 3}$, and
$$
K=\left(\begin{array}{ccc}
K_{-1,-1} & K_{-1,0} & K_{-1,1} \\
K_{0,-1} & K_{0,0} & K_{0,1} \\
K_{1,-1} & K_{1,0} & K_{1,1}
\end{array}\right)
$$
for we may have the following 2D Laplacian kernel
$$
K=\left(\begin{array}{ccc}
0 & -1 & 0 \\
-1 & 4 & -1 \\
0 & -1 & 0
\end{array}\right)
$$
The coefficients in (1.17) constitute a kernel matrix
$$
K \in \mathbb{R}^{(2 k+1) \times(2 k+1)}
$$
where $k$ is often taken as a small integer. Here padding means how $g_{i+p, j+q}$ is defined when $(i+p, j+q)$ is out of $1: m$ or $1: n$. The following three choices are often used
$$
g_{i+p, j+q}=\left\{\begin{array}{lll}
0, & & \text { zero padding, } \\
f_{(i+p)} & (\bmod m),(s+q) & (\bmod n), & \text { periodic padding } \\
f_{|i-1+p|,|j-1+q|}, & & \text { reflected padding }
\end{array}\right.
$$
if
$$
i+p \notin\{1,2, \ldots, m\} \text { or } j+q \notin\{1,2, \ldots, n\}
$$
Here $d(\bmod m) \in\{1, \cdots, m\}$ means the remainder when $d$ is divided by $m$.

Here is a diagram for convolution with one channel (and also stride one).

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-05}

\subsubsection{Convolution with stride (one channel)}
Definition 2. Convolution with stride 2 is defined as
$$
\left[K *_{2} g\right]_{i, j}=\sum_{p, q=-k}^{k} K_{p, q} g_{2 i+p-1,2 j+q-1}, \quad i=1:\left\lfloor\frac{m+1}{2}\right\rfloor, j=1:\left\lfloor\frac{n+1}{2}\right\rfloor
$$
We note that, in general, for any given integer $s \geq 1$, a convolution with stride $s$ for $g \in \mathbb{R}^{m \times n}$ can be defined as:
$$
\left[K *_{s} g\right]_{i, j}=\sum_{p, q=-k}^{k} K_{p, q} g_{s(i-11)+p+1, s(j-1)+q+1}, \quad i=1:\left\lfloor\frac{m+1}{s}\right\rfloor, j=1:\left\lfloor\frac{n+1}{s}\right\rfloor .
$$
Here $\left\lfloor\frac{m}{s}\right\rfloor$ denotes the biggest integer that less than $\frac{m}{s}$. The following is a diagram for stride 2 .

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-05(1)}

Lemma 1. The convolution with stride 2 can be written as:
$$
K *_{2} g=\mathcal{S}(K * g),
$$
where $\mathcal{S}$ is a stride operator defined by:
$$
\mathcal{S}: \mathbb{R}^{m \times n} \mapsto \mathbb{R}^{\frac{m+1}{2} \times \frac{n+1}{2}},
$$
with
$$
[\mathcal{S}(g)]_{i, j}=g_{2 i-1,2 j-1}, \quad i=1:\left\lfloor\frac{m+1}{2}\right\rfloor, j=1:\left\lfloor\frac{n+1}{2}\right\rfloor
$$
Example 1. The so-called average pooling with kernel size $3 \times 3$ and stride 2 means
$$
K *_{2},
$$
where
$$
K=\frac{1}{9}\left(\begin{array}{lll}
1 & 1 & 1 \\
1 & 1 & 1 \\
1 & 1 & 1
\end{array}\right)
$$

\subsubsection{Convolutional operations with multi-channel}
One important class of linear mapping is the so-called convolution:
$$
\theta: \mathbb{R}^{c \times m \times n} \mapsto \mathbb{R}^{h \times m \times n},
$$
where $m \times n$ is called the spatial dimension or resolution, $c$ and $h$ are corresponding to input and output channels. The operation is defined by
$$
[\theta(f)]_{s}=\sum_{t=1}^{c} K_{s, t} *[f]_{t}+b_{s} \mathbf{1} \in \mathbb{R}^{m \times n}, \quad s=1: h,
$$
where $1 \in \mathbb{R}^{m \times n}$ is a $m \times n$ matrix with all elements being 1 , and for $[f], \in \mathbb{R}^{m \times n}$ represent for the $t$-th channel
$$
\left[K_{s, t} *[f]_{t}\right]_{i, j}=\sum_{p, q=-k}^{k} K_{s, t ; p, q} f_{t ; i+p, j+q}, \quad i=1: m, j=1: n
$$
The coefficients kernel $K_{s, t}$ in (1.17) constitute a kernel matrix
$$
K_{s, t} \in \mathbb{R}^{(2 k+1) \times(2 k+1)}
$$
where $k$ is often taken as small integers.

Here a more compact notation for multi-channel convolution can be written as
$$
\theta(f)=K * f+\mathbf{b}
$$
where
$$
f=\left(\begin{array}{c}
{[f]_{1}} \\
{[f]_{2}} \\
\vdots \\
{[f]_{c}}
\end{array}\right), \quad K=\left(\begin{array}{cccc}
K_{1,1} & K_{1,2} & \cdots & K_{1, c} \\
K_{2,1} & K_{2,2} & \cdots & K_{2, c} \\
\vdots & \vdots & \ddots & \vdots \\
K_{h, 1} & K_{h, 2} & \cdots & K_{h, c}
\end{array}\right), \quad \mathbf{b}=\left(\begin{array}{c}
b_{1} \mathbf{1} \\
b_{2} \mathbf{1} \\
\vdots \\
b_{h} \mathbf{1}
\end{array}\right)=b \otimes 1
$$
Furthermore, we have the following natural extension of convolution with stride for multi-channel by
$$
[\theta(f)]_{s}=\sum_{t=1}^{c} K_{s, t} *_{2}[f]_{t}+b_{s} 1 \in \mathbb{R}^{\tilde{m} \times \tilde{n}}, \quad s=1: h,
$$
where
$$
\tilde{m}=\left\lfloor\frac{m+1}{2}\right\rfloor, \quad \tilde{n}=\left\lfloor\frac{n+1}{2}\right\rfloor
$$

\subsubsection{Pooling operation in CNNs}
Finally, we introduce another type of important operation in CNNs - pooling. The key purpose for pooling operator is to reduce the spatial resolution of images (features) in a typical CNN models. Basically, pooling is an operator
$$
T: \mathbb{R}^{c_{1} \times m_{1} \times n_{1}} \mapsto \mathbb{R}^{c_{2} \times m_{2} \times n_{2}} .
$$
where
$$
m_{2}=\left\lfloor\frac{m+1}{s}\right\rfloor, \quad n_{2}=\left\lfloor\frac{n+1}{s}\right\rfloor
$$
for any choice of $c_{2} \geq 1$. Here $s$ is also called the stride in pooling operations. There are generally two types of pooling

\section{Convolution with stride s as pooling}
In this case, it often happens that
$$
T=R *_{s}, \quad(s=2 \text { for the main case }) .
$$
Here $R$ can be learned or fixed such as average pooling as we discussed before.

\section{Nonlinear pooling}
The most commonly used nonlinear pooling is called max-pooling, a max pooling with kernel size $(2 k+1) \times(2 k+1)$ and stride $s$ is is defined as
$$
\left[R_{\max }(f)\right]_{t ; i, j}=\max \left\{f_{t ; s i+p-1, s j+q-1} \mid-k \leq p, q \leq k\right\}
$$
here $t$ means channel and $c_{2}=c_{1}$ in this case.

Here is an example for max-pooling with kernel size $2 \times 2$ and stride 2 .

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-07}

\subsection{Examples of convolution filters and performance}
In this section, we will give a brief description how convolution operations are used for image processing. One useful description can be found in the following link:

\href{http://aishack.in/tutorials/image-convolution-examples/}{http://aishack.in/tutorials/image-convolution-examples/}

Convolutions is a technique for general signal processing. People studying electrical/electronics will tell you the near infinite sleepless nights these convolutions have given them. Entire books have been written on this topic. And the questions and theorems that need to be proved are [insurmountable]. But for computer vision, we'll just deal with some simple things.

A convolution lets you do many things, like calculate derivatives, detect edges, apply blurs, etc. A very wide variety of things. And all of this is done with a "convolution kernel"

\subsubsection{Calculation with convolutions}
The most direct way to compute a convolution would be to use multiple for loops. But that causes a lot of repeated calculations. And as the size of the image and kernel increases, the time to compute the convolution increases too (quite drastically).

Techniques haves been developed to calculate convolutions rapidly. One such technique is using the Discrete Fourier Transform. It converts the entire convolution operation into a simple multiplication. Fortunately, you don't need to know the math to do this in OpenCV. It automatically decides whether to do it in frequency domain (after the DFT) or not.

\subsubsection{Image convolution examples}
A convolution is very useful for signal processing in general. There is a lot of complex mathematical theory available for convolutions. For digital image processing, you don't have to understand all of that. You can use a simple matrix as an image convolution kernel and do some interesting things!

\subsubsection{Line detection by 1D Laplacian}
With image convolutions, you can easily detect lines. Here are four convolutions to detect horizontal, vertical and lines at 45 degrees:

Here's $0,90,45,135$ lines detection that I got on an image:
$$
\begin{array}{|c|c|c|}
\hline-1 & -1 & -1 \\
\hline 2 & 2 & 2 \\
\hline-1 & -1 & -1 \\
\hline
\end{array}
$$
$$
\begin{array}{|c|c|c|}
\hline-1 & 2 & -1 \\
\hline-1 & 2 & -1 \\
\hline-1 & 2 & -1 \\
\hline
\end{array}
$$
$$
\begin{array}{|c|c|c|}
\hline-1 & -1 & 2 \\
\hline-1 & 2 & -1 \\
\hline 2 & -1 & -1 \\
\hline
\end{array}
$$
\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-09}

(a) image
$$
\left(\begin{array}{ccc}
-1 & -1 & -1 \\
2 & 2 & 2 \\
-1 & -1 & -1
\end{array}\right)
$$
(b) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-09(1)}

(c) result

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-09(2)}

(d) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-09(3)}

(e) result

Fig. 1.2. A horizontal line detection done with convolutions

In Lena, the black background is the original result, the white background is obtained by subtracting the original result from 255, the same below.

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-10}

(a) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-10(1)}

(d) image $\left(\begin{array}{lll}-1 & 2 & -1 \\ -1 & 2 & -1 \\ -1 & 2 & -1\end{array}\right)$

(b) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-10(2)}

(c) result

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-10(3)}

(e) result

Fig. 1.3. A vertical line detection done with convolutions

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-10(4)}

(a) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-10(5)}

(b) filter (c) result

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-10(6)}

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-11}

(d) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-11(1)}

(e) result

Fig. 1.4. A 45 degress line detection done with convolutions

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-11(2)}

(a) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-11(3)}

(d) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-11(4)}

(b) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-11(5)}

(c) result

Fig. 1.5. A 135 degress line detection done with convolutions

\subsubsection{Edge detection by 2D Laplacian operator}
The laplacian is the second derivative of the image. It is extremely sensitive to noise, so it isn't used as much as other operators. Unless, of course you have specific requirements.

\begin{tabular}{|c|c|c|}
\hline
0 & $-1$ & 0 \\
\hline
$-1$ & 4 & $-1$ \\
\hline
0 & $-1$ & 0 \\
\hline
\end{tabular}

\begin{tabular}{|c|c|c|}
\hline
$-1$ & $-1$ & $-1$ \\
\hline
$-1$ & 8 & $-1$ \\
\hline
$-1$ & $-1$ & $-1$ \\
\hline
\end{tabular}

The laplacian operator

(include diagonals)

Here's the result with the convolution kernel without diagonals:

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-12}

(a) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-12(1)}

(d) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-12(2)}

(b) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-12(3)}

(c) result

Fig. 1.6. A laplace operator done with convolutions

The result with the convolution kernel with diagonals:

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-13}

(a) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-13(1)}

(d) image
$$
\left(\begin{array}{ccc}
-1 & -1 & -1 \\
-1 & 8 & -1 \\
-1 & -1 & -1
\end{array}\right)
$$
(b) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-13(2)}

(c) result

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-13(3)}

(e) result

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-13(4)}

Fig. 1.7. A laplace operator include diagonals done with convolutions

\subsubsection{The Laplacian of Gaussian}
The laplacian alone has the disadvantage of being extremely sensitive to noise. So, smoothing the image before a laplacian improves the results we get. This is done with a $5 \times 5$ image convolution kernel.

\begin{tabular}{|c|c|c|c|c|}
\hline
0 & 0 & $-1$ & 0 & 0 \\
\hline
0 & $-1$ & $-2$ & $-1$ & 0 \\
\hline
$-1$ & $-2$ & 16 & $-2$ & $-1$ \\
\hline
0 & $-1$ & $-2$ & $-1$ & 0 \\
\hline
0 & 0 & $-1$ & 0 & 0 \\
\hline
\end{tabular}

The result on applying this image convolution was:

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-14}

(a) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-14(1)}

(d) image\\

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-14(2)}

(b) filter

(c) result

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-14(3)}\\

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-14(4)}

Fig. 1.8. A Laplacian of Gaussian operator done with convolutions

\subsubsection{Other examples with ReLU activation}
\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-15}
$$
\left(\begin{array}{ccccc}
0 & 0 & -1 & 0 & 0 \\
0 & -1 & -2 & -1 & 0 \\
-1 & -2 & 16 & -2 & -1 \\
0 & -1 & -2 & -1 & 0 \\
0 & 0 & -1 & 0 & 0
\end{array}\right)
$$
(b) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-15(1)}

(c) convolution result

(a) input image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-15(2)}

(d) result after ReLU $\left(\begin{array}{lll}\frac{1}{9} & \frac{1}{9} & \frac{1}{9} \\ \frac{1}{9} & \frac{1}{9} & \frac{1}{9} \\ \frac{1}{9} & \frac{1}{9} & \frac{1}{9}\end{array}\right)$

(e) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-15(3)}

(f) result after average

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-15(4)}

(g) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-15(5)}

(j) ReLU
$$
\left(\begin{array}{ccccc}
0 & 0 & -1 & 0 & 0 \\
0 & -1 & -2 & -1 & 0 \\
-1 & -2 & 16 & -2 & -1 \\
0 & -1 & -2 & -1 & 0 \\
0 & 0 & -1 & 0 & 0
\end{array}\right)
$$
(h) filter

$\left(\begin{array}{lll}\frac{1}{9} & \frac{1}{9} & \frac{1}{9} \\ \frac{1}{9} & \frac{1}{9} & \frac{1}{9} \\ \frac{1}{9} & \frac{1}{9} & \frac{1}{9}\end{array}\right)$

(k) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-15(6)}

(1) average

\subsubsection{Some other examples}
\section{Edge detection}
The above kernels are in a way edge detectors. Only thing is that they have separate components for horizontal and vertical lines. A way to "combine" the results is to merge the convolution kernels. The new image convolution kernel looks like this:

\begin{tabular}{|r|l|l|}
\hline
$-1$ & $-1$ & $-1$ \\
\hline
$-1$ & 8 & $-1$ \\
\hline
$-1$ & $-1$ & $-1$ \\
\hline
\end{tabular}

Below result I got with edge detection:

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-16}

(m) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-16(1)}

(p) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-16(2)}

(n) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-16(3)}

(o) result

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-16(4)}

(q) result

Fig. 1.9. A edge detection done with convolutions

\section{The Sobel Edge Operator}
The above operators are very prone to noise. The Sobel edge operators have a smoothing effect, so they're less affected to noise. Again, there's a horizontal component and a vertical component.

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-17}

\begin{tabular}{|c|c|c|}
\hline
$-1$ & $-2$ & $-1$ &  &  \\
\hline
0 & 0 & 0 &  &  \\
\hline
1 & 2 & 1 &  &  \\
\hline
\multicolumn{2}{|c|}{Horizontal} & $-1$ & 0 & 1 \\
\hline
$-2$ & 0 & 2 &  &  \\
\hline
$-1$ & 0 & 1 &  &  \\
\hline
\end{tabular}

On applying horizontal component in image, the result was:

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-17(1)}

(a) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-17(2)}

(d) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-17(3)}

(b) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-17(4)}

(c) result

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-17(5)}

(e) result

Fig. 1.10. A horizontal sobel edge operator done with convolutions

On applying vertical component in image, the result was:

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-18}

(a) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-18(1)}

(d) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-18(2)}
$$
\left(\begin{array}{lll}
-1 & 0 & 1 \\
-2 & 0 & 2 \\
-1 & 0 & 1
\end{array}\right)
$$
(b) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-18(3)}

(c) result\\

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-18(4)}

(e) result

Fig. 1.11. A vertical sobel edge operator done with convolutions

Fig. 1.11. A vertical sobel edge operator done with convolutions

\section{Simple box blur}
${ }^{1}$ Here's a first and simplest. This convolution kernel has an averaging effect. So you end up with a slight blur. The image convolution kernel is:
$$
\begin{array}{|l|l|l|}
\hline 1 / 9 & 1 / 9 & 1 / 9 \\
\hline 1 / 9 & 1 / 9 & 1 / 9 \\
\hline 1 / 9 & 1 / 9 & 1 / 9 \\
\hline
\end{array}
$$
Note that the sum of all elements of this matrix is $1.0$. This is important. If the sum is not exactly one, the resultant image will be brighter or darker.

Here's a blur that I got on an image:

$\overline{{ }^{1} \text { The following examples are from the website, http://aishack.in/tutorials/image- }}$ convolution-examples/

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-19}

(a) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-19(1)}

(b) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-19(2)}

(c) result

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-19(3)}

(d) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-19(4)}

(e) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-19(5)}

(f) result

Fig. 1.12. A simple blur done with convolutions

\section{Gaussian blur}
Gaussian blur has certain mathematical properties that makes it important for computer vision. And you can approximate it with an image convolution. The image convolution kernel for a Gaussian blur is:

\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
0 & 0 & 0 & 5 & 0 & 0 & 0 \\
\hline
0 & 5 & 18 & 32 & 18 & 5 & 0 \\
\hline
0 & 18 & 64 & 100 & 64 & 18 & 0 \\
\hline
5 & 32 & 100 & 100 & 100 & 32 & 5 \\
\hline
0 & 18 & 64 & 100 & 64 & 18 & 0 \\
\hline
0 & 5 & 18 & 32 & 18 & 5 & 0 \\
\hline
0 & 0 & 0 & 5 & 0 & 0 & 0 \\
\hline
\end{tabular}

Here's a result that I got:

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-20}

(a) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-20(1)}

(d) image

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-20(2)}

(b) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-20(3)}

(e) filter

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-20(4)}

(c) result

\includegraphics[max width=\textwidth]{2022_01_06_b5ce182ed1bd5f482e5bg-20(5)}

(f) result

Fig. 1.13. A Gaussian blur done with convolutions

\subsubsection{Summary}
You got to know about some important operations that can be approximated using an image convolution. You learned the exact convolution kernels used and also saw an example of how each operator modifies an image. I hope this helped!

\section{References}
[1] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. Imagenet: A largescale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248-255. Ieee, 2009.

[2] J. He, Y. Chen, and J. Xu. Constrained linear data-feature mapping for image classification. arXiv preprint arXiv: $1911.10428,2019 .$

[3] $\mathrm{K}$. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 770-778, 2016 .

[4] K. He, X. Zhang, S. Ren, and J. Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision, pages 630-645. Springer, $2016 .$

[5] A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, $2009 .$

[6] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pages $1097-1105,2012$.

[7] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, $86(11): 2278-2324,1998 .$

[8] K. Simonyan and A. Zisserman. Very deep convolutional networks for largescale image recognition. arXiv preprint arXiv: $1409.1556,2014 .$

[9] J. Xu and L. Zikatanov. Algebraic multigrid methods. Acta Numerica, 26:591$721,2017 .$

\end{document}


% chap9.tex (Chapter 9 of the thesis)

%\chapter[NOMENCLATURE]{NOMENCLATURE}
% Overwrite TOC chapter title
\chapter*{NOMENCLATURE}
\addcontentsline{toc}{chapter}{NOMENCLATURE}
\label{nomenclature}

% -----------------------------------------------------------------------------------------------------------------
% Greek symbols
% -----------------------------------------------------------------------------------------------------------------

% GENERAL CONSTANTS
\nomtypeG{\( \lambda \)}{Full scale to model scale ratio}{$\frac{L_{s}}{L_{m}}$}{-}
\nomtypeG{\( \delta \)}{Boundary layer thickness}{-}{m}
\nomtypeG{\( \rho \)}{Mass density of fluid}{-}{Kg/m\textsuperscript{3}}
\nomtypeG{\( \nu \)}{Kinematic viscosity}{$\frac{\mu}{\rho}$}{m\textsuperscript{2}/s}
\nomtypeG{\( \mu \)}{Viscosity}{$\frac{\mu}{\rho}$}{Kg/ms}

% -----------------------------------------------------------------------------------------------------------------
% Dimensionless numbers
% -----------------------------------------------------------------------------------------------------------------

\nomtypeD{\( \mathcal A_r \)}{Archimedes number}{\(\displaystyle\frac{d^3g\rho_c\abs{\Delta\rho}}{\mu_c^2} = \sqrt{\frac{\mathcal E_0^3}{\mathcal M_0}} \)}

% -----------------------------------------------------------------------------------------------------------------
% Roman symbols
% -----------------------------------------------------------------------------------------------------------------

% AREAS
\nomtypeR[AN]{A\textsubscript{N}}{Nozzle discharge area}{-}{m\textsuperscript{2}}
\nomtypeR[AS]{A\textsubscript{S}}{Cross sectional area at station $s$}{-}{m\textsuperscript{2}}
\nomtypeR[SS]{S\textsubscript{S}}{Wetted surface area}{-}{m\textsuperscript{2}}

% DIMENSIONS
\nomtypeR[T]{T}{Draft}{-}{$m$}
\nomtypeR[LOA]{L\textsubscript{OA}}{Length overall}{-}{m}
\nomtypeR[LWL]{L\textsubscript{WL}}{Length waterline}{-}{m}
\nomtypeR[B]{B}{Moulded breadth}{-}{m}
\nomtypeR[Bhullm]{B\textsubscript{hull, m}}{Beam of model hull}{-}{m}

\printnomenclature[6em]
%\printnomenclature[2cm]