text:
\documentclass{article}

\usepackage{style/preamble}
\usepackage{style/mytikz}
\usepackage{parskip}

\newcounter{dip}

\begin{document}
  \title{Problem Set 2 - Ramification}
  \date{}
  \maketitle

\section{Meromorphic functions on $\bbp^1$}

The last step in completing the proof of the theorem that proves that all meromorphic functions on $\bbp^1$ are rational functions is the following.

Let $f: \bbp^1 \rightarrow \bbp^1$ be a meromorphic function.
Let $\calz = f^{-1}(0) \cap \bbc$ and $\calp = f^{-1}(\infty) \cap \bbc$. (I had forgotten to add ``$\cap \bbc$'' last time. This is necessary as we do not know how to multiply or divide by $\infty$.)
The elements of $\calz$ are the zeroes and the elements of $\calp$ are the poles of $f$ inside $\bbc$.

\begin{proposition}
  \label{thm:Theorem1}
  The function
  \begin{align*}
    g(z) = f(z) \cdot \dfrac{(z-p_1)^{k_1} \dots (z-p_n)^{k_n}}{(z-z_1)^{\ell_1} \dots (z-z_m)^{\ell_m}}
  \end{align*}
  is meromorphic and has no zeroes or poles in $\bbc$, for some positive integers $k_1, \dots, k_n$ and $\ell_1, \dots, \ell_m$.
\end{proposition}

The proof is by induction on $m + n$. If $m + n = 0$ i.e. there are no poles or zeroes in $\bbc$ we are done.

\begin{definition}
  The order of a zero $z_i$ is the smallest positive integer $k$ such that the $k^{th}$ derivative $f^{(k)}(z_i)$ does not equal $0$.
\end{definition}

\begin{definition}
  The order of a pole $p_i$ is the smallest positive integer $\ell$ such that the $\ell^{th}$ derivative $(f \circ \varphi_2^{-1})^{(\ell)}(p_i)$ does not equal $0$.
\end{definition}

\begin{qbox}
  Suppose $f(z)$ has a zero $z_i$ of order $k$. Show that
  \begin{align*}
    g(z) = \begin{cases}
        \dfrac{f(z)}{(z - z_i)^k} & \mbox{ if }z \neq z_i \\
        \lim \limits_{z \rightarrow z_i} \dfrac{f(z)}{(z - z_i)^k} & \mbox{ if } z = z_i
    \end{cases}
  \end{align*}
  has no zero at $z_i$.\hint{Look at the Taylor series expansion of $f$ at $z_i$.}
  Further argue that the set of zeroes and poles of $g(z)$ in $\bbc$ are $\calz \setminus \set{z_i}$ and $\calp$, respectively.
\end{qbox}

\begin{qbox}
  Suppose $f(z)$ has a pole $p_i$ of order $\ell$. Show that
  \begin{align*}
    g(z) = \begin{cases}
        f(z) (z - p_i)^\ell & \mbox{ if }z \neq p_i \\
        \lim \limits_{z \rightarrow p_i} f(z) (z - p_i)^\ell & \mbox{ if } z = p_i
    \end{cases}
  \end{align*}
  has no pole at $p_i$.\hint{Look at the Taylor series expansion of $f \circ \varphi_2^{-1}$ at $\varphi_2(p_i)$.}
  Further argue that the set of zeroes and poles of $g(z)$ in $\bbc$ are $\calz$ and $\calp \setminus \set{p_i}$, respectively.
\end{qbox}

\begin{qbox}
  Complete the proof of Proposition \ref{thm:Theorem1}.
\end{qbox}

Once we see that $g(z)$ has no zeroes or poles in $\bbc$, the only zero or pole of $g(z)$ can be at $\infty$. But $\infty$ can be either a zero or a pole but not both.
Hence the image of $g(z)$ is not surjective. By the exercises, from yesterday $g(z)$ is a constant.

\section{Riemann Surfaces}
\begin{definition}
  A \emph{Riemann surface} is a (nice) topological spaces $X$ along with
  \begin{enumerate}
    \item a covering of open sets
    \begin{align*}
      X = U_1 \cup U_2 \cup \dots
    \end{align*}
    \item continuous injections $\varphi_i: U_i \rightarrow \bbc$ for each $U_i$ in the open cover. (We need injectivity to make sense of $\varphi_i^{-1}$.)
    \item A condition on the \emph{transition functions}.
  \end{enumerate}
  The pair $(U_i, \varphi_i: U_i \rightarrow \bbc)$ is called a \emph{chart} and the collection of charts $\set{(U_i, \varphi_i)}$ is called an \emph{atlas}.
  A \emph{Riemann surface} is a \emph{complex manifold of dimension 1}.
\end{definition}

To understand what the third condition should be we need to understand maps between Riemann surfaces.

\begin{definition}
  A continuous map $f:X \rightarrow Y$ between two Riemann surfaces $X$ and $Y$ with atlases $(U_i, \varphi_i)$ and $(V_j, \psi_j)$, respectively, is \emph{complex differentiable} if
  \begin{align*}
    \psi_j \circ f \circ \varphi_i^{-1}
  \end{align*}
  (appropriately restricted) is holomorphic at $z$ whenever $z \in U_i$ and $f(z) \in V_j$.
\end{definition}

Because the open sets $U_i$ cover $X$ many of these will intersect.
\begin{definition}
  For a Riemann surface $X$ with an atlas $\set{(U_i, \varphi_i)}$, the functions $\varphi_i \circ \varphi_j^{-1}$ are called the \emph{transition} functions or the \emph{change of coordinate} functions.
\end{definition}

Note that the domain of $\varphi_i \circ \varphi_j^{-1}$ is $\varphi_j(U_i \cap U_j)$ and the codomain is $\varphi_i(U_i \cap U_j)$.

\begin{qbox}
  Show that the identity function $\id: X \rightarrow X$ is complex differentiable if and only if all the transition functions are holomorphic.
\end{qbox}

We DO want the identity function to be complex differentiable, which then becomes the third condition in the definition of a Riemann surface:
\begin{enumerate}
  \item[3.] All the transition functions $\varphi_i \circ \varphi_j^{-1}$ are holomorphic.
\end{enumerate}

\begin{qbox}
  Check that the transition functions for $\bbp^1$ are holomorphic.
\end{qbox}

We can think of a function between Riemann surfaces as being a ``piece-wise function'' built by gluing holomorphic functions. Thus, understanding the local structure of complex differentiable functions between Riemann surfaces is equivalent to understanding the local structure of holomorphic functions. On the other hand, understanding the global structure of maps between Riemann surfaces is a much harder question and lies at the heart of complex geometry.

\section{Ramification}
Consider the function \begin{align*}
  f(z) = \dfrac{z^2}{z+1}
\end{align*}
We can solve $ \dfrac{z^2}{z+1} = w $ to see that
\begin{align*}
  z = \dfrac{w \pm \sqrt{w^2 + 4z}}{2}
\end{align*}
For $w \neq 0, -4, \infty$ $f^{-1}(z)$ consists of two points $\set{\dfrac{w + \sqrt{w^2 + 4z}}{2}, \dfrac{w - \sqrt{w^2 + 4z}}{2}}$.
Even for $\infty$, we see that $f^{-1}(\infty) = \set{\infty, -1}$.
But for 0 and 4 we get $f^{-1}(0) = \set{0}$, $f^{-1}(-4) = \set{-2}$.

It is even easier to see this phenomenon for
\begin{align*}
  f(z) = z^n
\end{align*}
In this case every point except $0$ and $\infty$ have exactly $n$ pre-images. We can imagine $z^n$ as the Riemann sphere winding around itself $n$ times.

\begin{definition}
  A continuous map $f: X \rightarrow Y$ between topological spaces is called a (finite) \emph{ramified covering (or a branched covering)} of order $n$ if there exists an isolated collection of points $\set{z_i} \subseteq Y$ such that $f$ restricted to the complement $X \setminus \set{z_i}$ is an $n:1$ map. (To be very precise, we require the restricted map $f|_{X \setminus \set{z_i}}$ to be a covering map.)

  If $f$ is an $n:1$ ramified covering and $w \in Y$ is a point such that $|f^{-1}(w)| \neq n$ we say that $w$ is a \emph{branch point} and the points in $f^{-1}(w)$ are called the \emph{ramified points}.
  The set of all branch points is called the \emph{branch locus} (subset of $Y$) and the set of all ramified points is called the \emph{ramification locus} (subset of $X$).
\end{definition}

\begin{qbox}
  Find the branch and ramification loci in the two examples given above.
\end{qbox}

\begin{qbox}
  \textbf{Fact:} The cubic $x^3 + px + q = 0$ has repeated roots if and only if the discriminant $\Delta = – 4p^3 – 27q^2$ is 0.

  Find the branch and ramification loci of the following function
  \begin{align*}
    f: \bbp^1 &\longrightarrow \bbp^1 \\
    z &\longmapsto z^3 - 3 z
  \end{align*}
\end{qbox}
We are missing one more piece of the story, the ramification index. But for this we need to understand holomorphic functions better.

\section{Local structure of holomorphic functions}
\begin{theorem}
  \label{thm:LocalStructure}
  For an open subset $U \subseteq \bbc$, let $f: U \rightarrow \bbc$ be a non-constant holomorphic function and let $z_0 \in U$.
  Suppose the Taylor series of $f$ near $z_0$ is
  \begin{align*}
    f(z) - f(z_0) = a_k (z - z_0)^k + a_{k+1} (z - z_0)^{k+1} + a_{k+2} (z - z_0)^{k+2} + \dots
  \end{align*}
  with $a_k \neq 0$.
  Then there exists a biholomorphic function $g(z)$ defined in a neighborhood of $f(z)$ such that
  \begin{align*}
    g \circ f (z) = a_k(z - z_0)^k
  \end{align*}
\end{theorem}
\todo[inline]{The statement of this theorem is wrong. Corrected in PSet04.}
\begin{proof}[``Proof'']
  \begin{align*}
    f(z) - f(z_0)
    &=
    a_k (z - z_0)^k + a_{k+1} (z - z_0)^{k+1} + a_{k+2} (z - z_0)^{k+2} + \dots \\
    &=
    a_k (z - z_0)^k \left(1 + \dfrac{a_{k+1}}{a_k} (z - z_0) + \dfrac{a_{k+2}}{a_k} (z - z_0)^{2} + \dots \right) \\
    &\approx a_k (z - z_0)^k
  \end{align*}
  we are done by engineer's induction.
  $g$ is the inverse of the function $1 + \dfrac{a_{k+1}}{a_k} (z - z_0) + \dfrac{a_{k+2}}{a_k} (z - z_0)^{k+2} + \dots $.
\end{proof}

  \begin{definition}
    The $k$ in Theorem \ref{thm:LocalStructure} is called the \emph{ramification index} of $f$ at $z_0$, denoted
    \begin{align*}
      \mathrm{index}_{f}(z_0) = k.
    \end{align*}
  \end{definition}

  \begin{qbox}
    Show that the $\mathrm{index}_{f}(z_0)$ is the smallest integer $k > 0$ such that $f^{(k)}(z_0) \neq 0$, where $f^{(k)}$ denotes the $k^{th}$ derivative.
  \end{qbox}

  \begin{qbox}
    Find the ramification indices of all the points in $\bbc$ for the function $f(z) = z^n$.
  \end{qbox}

  \begin{qbox}
    Use the notation in Theorem \ref{thm:LocalStructure} and restrict $f$ to a sufficiently small neighborhood $V$ and consider $f: V \rightarrow f(V)$.
    Use the previous problem to answer the following.
    \begin{enumerate}
      \item Show that $f$ is a ramified covering of order $k$.
      \item Show that if $k = 1$ then there are no ramification points and if $k > 1$ then the only ramification point is $z_0$.
    \end{enumerate}
  \end{qbox}
  \begin{qbox}
    Let $f: U \rightarrow f(U) \subseteq \bbc$ be a holomorphic function.
    \begin{enumerate}
      \item Show that ramification and branch loci of $f$ are isolated.
      \item Show that if $U$ is compact then the ramification and branch loci of $f$ are finite.
    \end{enumerate}
  \end{qbox}

  \begin{qbox}
    Find the ramification indices of all the points in $\bbc$ for the two examples in the previous section.
  \end{qbox}

  \begin{definition}
    For a non-constant holomorphic function $f: U \rightarrow \bbc$ define the total degree at $w \in \bbc$
    \begin{align*}
      \mathrm{deg}_f(w) = \sum_{z \in f^{-1}(w)} \mathrm{index}_f(z).
    \end{align*}
  \end{definition}

  \begin{qbox}
    Find the total degrees of all the points in $\bbc$ for the function $f(z) = z^n$.
  \end{qbox}

  \begin{qbox}
    Find the total degrees of all the points in $\bbc$ for the two examples in the previous section.
  \end{qbox}

  We will next extend these definitions to all maps between Riemann surfaces.

  \begin{figure}[t]
  \centering
    % \includegraphics[width=0.5\textwidth]{example-image}
    \includegraphics[width=0.4\textwidth]{images/sqrt.png}
    \hfill
    \includegraphics[width=0.4\textwidth]{images/cube_root.png}
    \hfill
    \includegraphics[width=0.4\textwidth]{images/4th_root.png}
    \caption{This is what $z \mapsto z^n$ looks like for $n = 2, 3, 4$ around $z = 0$.}
  \end{figure}

  \begin{figure}
    \centering
    \vspace{5cm}
    \caption{Qualitative diagram of the ramified covering of $f(z) = \dfrac{z^2}{z+1}$. (Caution: Removing ramified points does not disconnect the Riemann sphere. Use this diagram carefully.) }
  \end{figure}

\end{document}

ext: tex


text:
\documentclass{article}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage[section]{placeins}
\usepackage{hyperref}
\hypersetup{
	colorlinks=true,
	linkcolor=blue,
	filecolor=magenta,
	urlcolor=cyan,
}
\urlstyle{same}
\usepackage{caption}
\usepackage{listings}

\title{\Huge \bfseries \emph{Assignment 1}}
\author{Vathana Him}
\date{September 12, 2021}

\begin{document}
\maketitle

\begin{multicols}{2}

\section{Abstract}
	The purpose of this assignment was to begin the introduction to data preprocessing as a preparation step for machine learning and deep learning. This assignment utilized images from UCI respository as sample datasets that will be used to train a machine learning model. Images that were processed represented three fruits spanish pear, fuji apple, watermelon.

	The data for these images were processed using the OpenCV python library. The main goals for this assignment were to process the data for each respective images into their appropriate feature space and feature vector, analyze thess datasets to see if there were any imbalance, explore if any standardization was needed, and export these data into appropriate .csv format to be used as training datasets for machine learning.

\section{Setting Up}
The developing environment was installed by going to the anaconda website and downloading anaconda. Then anaconda was launched. Once it was launched, navigate to the environment tab, then the create button was pressed in order to create the new working environment. The enviroment was named as MSIA. Within the environment, python 3.7 was installed. Subsequently, pip was used to install a list of python libraries. These libraries included Opencv, Pandas, Plotly, Matplotlib, and Numpy.

\subsection{Section 1 Figures}

	\begin{center}
		\captionof{figure}{environment}
		\includegraphics[scale=0.1]{../screenshots/environment.png}

	\end{center}

	\captionof{figure}{Pip Command}
	\begin{verbatim}
		Ex.
		pip install pandas
		pip install opencv
	\end{verbatim}

\section{Choosen Images}
The choosen images were gathered from the UCI data respository. The link for these images can be found \href{https://www.ic.unicamp.br/~rocha/pub/downloads/}{here} \footnote[1]{https://www.ic.unicamp.br/~rocha/pub/downloads/}. This dataset contains a variety of fruits and vegatables but only three images were choosen for this assignment. These image were spanish pear, fuji apple, and watermelon. Each of these images respresent a fuji apple, spanish pear,
and watermelon respectively. These images were chosen due to the nature of their color as apple was a bright red color, spanish pear was a bright yellow, and watermelon was green. Intuitively, the human eyes was able to distinguish the differences betweent these colors easily. In correlation, computer vision should be able to distinguish the same differences due to its difference in RGB value. Subsequently, these images also have consistent dimensions which makes scaling and resizing of images more consistent.

\subsection{Section 3 Figures}
\centering
\captionof{figure}{Image Folders}
\includegraphics[scale=0.3]{../screenshots/image_folder.png}

\centering
\captionof{figure}{Spanish Pear}
\includegraphics[scale=0.3]{../data/spanish_pear_001.jpg}

\centering
\captionof{figure}{Fuji Apple}
\includegraphics[scale=0.3]{../data/fuji_apple_001.jpg}

\centering
\captionof{figure}{Watermelon}
\includegraphics[scale=0.3]{../data/watermelon_001.jpg}

\section{Task 3}

The code to display the three chosen images using python and opencv library is displayed below.

\subsection{Task 3 Results}

\centering
\captionof{figure}{Apple RGB}
\includegraphics[scale=0.3]{../screenshots/RGB_1.png}

\centering
\captionof{figure}{Pear RGB}
\includegraphics[scale=0.3]{../screenshots/RGB_2.png}

\centering
\captionof{figure}{Watermelon RGB}
\includegraphics[scale=0.3]{../screenshots/RGB_3.png}

\centering
\captionof{figure}{Gray scale}
\includegraphics[scale=0.3]{../screenshots/gray.png}

\end{multicols}

\subsection{Code}

\centering

\begin{lstlisting}[language=Python]
	import cv2 as cv
	import sys
	import matplotlib.pyplot as plt
	import matplotlib.image as mpimg
	import numpy as np
	import pandas as pd
	img_apple = cv.imread("../data/fuji_apple_001.jpg")
	img_pear = cv.imread("../data/spanish_pear_001.jpg")
	img_watermelon = cv.imread("..data/watermelon_001.jpg")

	img_list = [img_apple, img_pear, img_watermelon]

	title = ["apple","pear","watermelon"]

	color_channel = ["B_channel", "G_channel", "R_channel"]

	num = 0
	for i in img_list:
	n = 0
	#split color channel of each image by B, G, R
	for j in cv.split(i):
	plt.figure()
	plt.imshow(j)
	plt.title(title[num]+"_"+color_channel[n])
	n = n+1
	num = num+1

	img_list_gray = []
	for i in img_list:
	img = cv.cvtColor(i, cv.COLOR_BGR2GRAY)
	img_list_gray.append(img)
	plt.figure()
	plt.imshow(img, cmap='gray')
	plt.title("dimension {}".format(img.shape))
\end{lstlisting}

\begin{multicols}{2}
	\section{Task 4}
	The grayscale images were then resized and their new dimensions were displayed through matplotlib. There was a function that was used to help create this gray scale image so it can be generalized for future use.
	\subsection{Task 4 Result}
	\pagebreak
	\centering
	\captionof{figure}{Gray scale}
	\includegraphics[scale=0.25]{../screenshots/gray_resized.png}
\end{multicols}
	\subsection{Code}
	\begin{lstlisting}[language=Python]
	gray_imgresize = []

	for i in img_list_gray:
	temp_img = img_resize(344, 256, i)
	gray_imgresize.append(temp_img)
	for i in gray_imgresize:
	plt.figure()
	plt.imshow(i, cmap='gray')
	plt.title("resized gray image dimension {}".format(i.shape))
	\end{lstlisting}

\begin{multicols}{2}
	\section{Task 5}
	The grayscale images were then divided into blocks of 8X8 pixels image. Each feature was then assigned a label respectively to identify them.
	\subsection{Task 5 Results}
	\centering
	\captionof{figure}{Feature Vector Output}	\includegraphics[scale=0.2]{../screenshots/feature_vector88.png}

	\centering
	\captionof{figure}{CSV Output}	\includegraphics[scale=0.25]{../screenshots/88csv.png}
	\end{multicols}

	\pagebreak
	\subsection{Code}
	\begin{lstlisting}[language=Python]
	#convert each image into blocks of 8X8 and store them in a list
	img_blocks = []
	for i in gray_imgresize:
	img_blocks.append(con_to_img_blocks(i))
	#convert to dictionary of feature value for each image and store all image in a list
	img_feature_list = []
	for i in img_blocks:
	img_feature_list.append(label_feature(i))
	#convert each feature of size 64 vectirs into csv
	for i in range(len(img_feature_list)):
	if (i==0):
	s='img_0'
	elif (i==1):
	s="img_1"
	else:
	s="img_2"
	temp_df = to_dataframe(img_feature_list[i])
	temp_df.to_csv("img_csvs/"+"{}.csv".format(s))
	\end{lstlisting}

\begin{multicols}{2}
	\section{Task 6}
	After being divided into 8X8 pixel blocks, the grayscale images were then divided into sliding block of 8X8 pixels. Each feature was then assigned a label respectively to identify them. Two helper functions were used for this task, sliding blocks feature function which converts an image into sliding image blocks given an image object, and label feature function which create feature labels for each image given a list that contains the array of sliding images.

	\subsection{Task 6 Results}
	\centering
	\captionof{figure}{Feature Vector Output}	\includegraphics[scale=0.2]{../screenshots/sliding88.png}

	\centering
	\captionof{figure}{CSV Output}	\includegraphics[scale=0.25]{../screenshots/sliding88csv.png}
\end{multicols}

\pagebreak
\subsection{Code}
\begin{lstlisting}[language=Python]
#convert each image into sliding blocks of 8X8 and store them in a list each index of list contains all blocks of each image
sliding_block_list = [sliding_blocks(i)for i in gray_imgresize]

#convert to dictionary of feature value for each image in sliding block and store all image in a list
sliding_img_feature_list = [label_feature(i) for i in sliding_block_list]
\end{lstlisting}

\begin{multicols}{2}
	\section{Task 7}
		\setlength{\parindent}{10ex}
		The dimension of the gray images were resized
		to height of 256 and width of 344.
		The purpose for these choosen dimensions was to keep
		its aspect ratio. Additionally, the resized height and
		width must also be divible by eight since this project
		divided the targeted image into sliding blocks of 8 by 8
		height and width. The feature vector that was constructed
		from these images created 3400 feature vectors and each
		feature vector lies a 8 by 8 pixels who's value lies
		between 0-255 of the gray image scale.
		The features of each feature vector was then flatten to
		64 features for each respective feature vector.

		\setlength{\parindent}{10ex}
		The mean of each feature lies between 189-190 for
		img0 apple, img1 177-178 pear, and img2 148-151 watermelon.
		This data does not need normalization as its mean feature
		values seem to correlate to the color of each fruit that
		belong to their respective image. For example,
		both the color for apple and pear are brighter than
		that of the color for watermelon, therefore, it should
		intuitively be true that the mean of each feature in the
		watermelon image should be lower than that of the brighter
		colored images. Subsequently,
		the standard deviation value of each image was
		normally distributed according to the histogram.
		The mean and variance of img1 and img2 were relatively
		similar, this indicates that normalization may not be needed.
		However, normalization may be needed for img0 because its
		histogram seemed to have a two tail distribution. Its mean and
		variance values also deviated from the subsequent two images.
		For img1 and img2 normalization was not
		needed since their values were normally distributed.
		This suggests that the data of feature value across
		all feature vectors was consistent and balanced,
		thus data transformation may not be needed.

	\subsection{Task 7 Results}
	\centering
	\captionof{figure}{img0 summary stats}	\includegraphics[scale=0.2]{../screenshots/img_0_sum.png}

	\centering
	\captionof{figure}{img1 summary stats}	\includegraphics[scale=0.2]{../screenshots/img_1_sum.png}

	\centering
	\captionof{figure}{img2 summary stats}	\includegraphics[scale=0.2]{../screenshots/img_2_sum.png}

	\centering
	\captionof{figure}{Histogram}
	\includegraphics[scale=0.3]{../screenshots/histogram.png}
\end{multicols}

\subsection{Code}
\begin{lstlisting}[language=Python]
import matplotlib.pyplot as plt
import plotly.express as px
for i in sliding_block_list:
print(i.shape)
#function to calculate mean, var, std of each feature for each immage, convert it to df for each image respectively and put them in dictionary
def get_stats_img(feature_list):
stat_dic_img = {}
for i in range(len(feature_list)):
temp_df = to_dataframe(feature_list[i])
temp_df_mean = temp_df.mean().to_frame().reset_index()
temp_df_std = temp_df.std().to_frame().iloc[:,0].values
temp_df_var = temp_df.var().to_frame().iloc[:,0].values
temp_df_mean['std'],temp_df_mean['var'] = [temp_df_std, temp_df_var]
temp_df_mean.columns = ['features', 'mean', 'std', 'var']
stat_dic_img['img_{}'.format(i)] = temp_df_mean
return stat_dic_img
stat_dic_img = get_stats_img(sliding_img_feature_list)
for i in stat_dic_img.keys():
fig = px.histogram(stat_dic_img[i], x=stat_dic_img[i]['mean'], title="mean {}".format(str(i)))
fig.show()
\end{lstlisting}

\begin{multicols}{2}
	\section{Task 8}
	The csvs of image0 and image1 were merged to create a feature space of these images. Similary, a feature space of image0, image1, and image2 was also created by merging their cvs together. Each of these feature spaces were then randomized so it could be used to train a machine learning model for the next assginment.

	\subsection{Task 8 Results}
	\centering
	\captionof{figure}{Merge img01}
	\includegraphics[scale=0.2]{../screenshots/merge01.png}

	\centering
	\captionof{figure}{Merge img012}	\includegraphics[scale=0.25]{../screenshots/merge012.png}
\end{multicols}

\subsection{Code}
\begin{lstlisting}[language=Python]
	img_0 = pd.read_csv('../data/sliding_img_csvs/sliding_img_0.csv',
	index_col=0)
	img_1 = pd.read_csv('../data/sliding_img_csvs/sliding_img_1.csv',
	index_col= 0)
	img_2 = pd.read_csv('../data/sliding_img_csvs/sliding_img_2.csv',
	index_col=0)
	img_0['img'] = "img_0"
	img_1['img'] = "img_1"
	img_2['img'] = "img_2"
	image01 = pd.concat([img_0, img_1]).sample(frac=1)
	image012 = pd.concat([img_0,img_1,img_2]).sample(frac=1)
	image01.to_csv('../data/combined_img_csvs/image01.csv')
	image012.to_csv('../data/combined_img_csvs/image012.csv')
\end{lstlisting}

\begin{multicols}{2}
	\section{Task 9}
	The 2-d feature space plot that showed
	observations for image0 and image1 indicated
	that each of their respective feature value was similar.
	One explaination for this could be that the intensity
	of their gray color channels were alike. Additionally,
	there were also some observations that fell out of the
	mean cluster of the plot. It could be interpreted that
	these observations represent the color of the different
	fruits, whereas the observations in the mean of the cluster
	represent the white spaces of the images. Similarly,
	when three features of image0 and image1 were selected,
	there were some observations that fell out the mean cluster,
	while most observations were within. This relationship supported
	the earlier analysis that was stated.

	In order to further understand this relationship,
	a feature space of three class label was plotted.
	The 2-d feature space plot for the three class labels
	of their three respective images showed a similar
	relationship to the two class label plots.
	The majority of observations within each class
	lied within the mean cluster as some observations
	lied outside the mean. Futhermore, this behavior
	was also observed in the 3-d three features plot
	where most observations lied within the mean cluster
	and some observations were outside the mean cluster.
	This indicated that the majority of the observations
	between each image had similar color on the gray color
	scale as the outliers could represent the color on the
	gray color scale that were indicative to the actual color
	of each fruits. Thus, further supporting the initial analysis.

	Finally, it can be concluded that a feature selection method may be
	needed in order to eliminate features that are correlated based on evidence displayed in figure 22 and figure 24.

	\subsection{Task 9 Results}
	\centering
	\captionof{figure}{2-D Feature Space img01}
	\includegraphics[scale=0.2]{../screenshots/2d01.png}

	\centering
	\captionof{figure}{3-D Feature Space img01}	\includegraphics[scale=0.25]{../screenshots/3d01.png}

	\centering
	\captionof{figure}{2-D Feature Space img012}
	\includegraphics[scale=0.2]{../screenshots/2d012.png}

	\centering
	\captionof{figure}{3-D Feature Space img012}	\includegraphics[scale=0.25]{../screenshots/3d012.png}
\end{multicols}

\subsection{Code}
\begin{lstlisting}[language=Python]
fig = px.scatter(df_image01, x='0', y='10', color='img', labels={'10':'feature 10', '0':'feature 1'})
fig.show()
fig = px.scatter_3d(df_image01, x='0', y='10', z='15', color='img',
labels={'10':'feature 10', '0':'feature 1', '15':'feature 15'})
fig.show()
fig = px.scatter(df_image012, x='0', y='10', color='img',
labels={'10':'feature 10', '0':'feature 1'})
fig.show()
fig = px.scatter_3d(df_image012, x='0', y='10', z='15', color='img',
labels={'10':'feature 10', '0':'feature 1', '15':'feature 15'})
fig.show()
\end{lstlisting}

\begin{multicols}{2}
	\section{Task 10}
	Below lists a set of helper functions that can read any number of images from a folder, resize image, convert each image to blocks of 8X8, convert each image to sliding blocks of 8X8, create a dataframe for the feature vectores of each image, and generate the appropriate cvs. These functions was created so that it can be generally used by passing in a python object and it would generate the desired result.
\end{multicols}
\subsection{Code}
\begin{lstlisting}[language=Python]
#helper function

#def get image from given directory
def get_img(path:str):
img_paths = glob.glob(path+"*.jpg")
return img_paths
#read image given a path
def read_img(path:str):
img = cv.imread(path)
return img
#resize image given image object and its width and height
def img_resize(width, height, img):
dim = (width, height)
resized = cv.resize(img, dim, interpolation = cv.INTER_AREA)
return resized

#divide image into 8 by 8 blocks
def con_to_img_blocks(img):
blocks = np.array([img[i:i+8, j:j+8] for j in range(0,344,8) for i in range(0,256,8)]) #iteratre over height and then width
return blocks

#divide image into sliding blocks
def sliding_blocks(img):
step = 5
(w_height, w_width) = (8,8)
slidingblocks = np.array([img[i:i+w_height, j:j+w_width] for j in range(0, img.shape[1]-w_width, step) for i in range(0,img.shape[0]-w_height, step)])
return slidingblocks

#convert each feature of an image into a list of 64 values and add it dictionary with key:feature# and value:list of values of length 64
#return a dictionary of an image with each key as a feature of that image
def label_feature(img):
block_dic = {}
for i in range(len(img)):
block_dic["feature vector {}".format(i)] = img[i].ravel()
return block_dic

#convert a dictionary of an image into pandas dataframe
def to_dataframe(img_dic):
df = pd.DataFrame(img_dic).T
return df

#generate csv given list of dataframe
def to_csv(df_list):
for i in range(len(df_list)):
if (i==0):
s='img_0'
elif (i==1):
s="img_1"
else:
s="img_2"
temp_df = to_dataframe(df_list[i])
temp_df.to_csv("sliding_img_csvs/"+"{}.csv".format(s))
\end{lstlisting}

\begin{multicols}{2}
	\section{Task 11}
	The dimension of original gray images were 256H by 344W. Once divided into sliding blocks, their dimensions were reduced to 8H by 8W of 3400 feature vectors. The pixels representing these blocks were then converted into a one-dimensional array that contains 64 features. Therefore, each feature vectors contain 64 features. These new dimensions were also labeled to represent their images respectively. The conversion of these dimensions to a feature space represented by 64 features would allow machine learning models to distinguish unique features among these images. Classification methods used would allow machine learning modes to understand the differences between the color scale of each pixels within each feature in relation to each feature space and the feature space that belong to their respective image. It would allow machine learning models to understand the differences between each image based on their feature and feature space. Therefore, enabling it to classify future images based on commonality of characteristics from each unique features.
\end{multicols}

\end{document}


text:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[xcolor=x11names,compress, handout]{beamer}

\definecolor{CoolBlack}{rgb}{0.0, 0.18, 0.39}
\definecolor{byellow}{rgb}{0.55037, 0.38821, 0.06142}
%% General document %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{Tabbing}
\usetikzlibrary{decorations.fractals}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Beamer Layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\useoutertheme[subsection=false,shadow]{miniframes}
\useinnertheme{default}
\usefonttheme{serif}
\usepackage{palatino}
\usepackage{tabu}

% addition of color
\usepackage{xcolor}
\definecolor{dgreen}{rgb}{0.,0.6,0.}
\definecolor{RawSienna}{cmyk}{0,0.72,1,0.45}

\setbeamerfont{title like}{shape=\scshape}
\setbeamerfont{frametitle}{shape=\scshape}

\setbeamercolor*{lower separation line head}{bg=CoolBlack}
\setbeamercolor*{normal text}{fg=black,bg=white}
\setbeamercolor*{alerted text}{fg=dgreen}
\setbeamercolor*{example text}{fg=black}
\setbeamercolor*{structure}{fg=black}

\setbeamercolor*{palette tertiary}{fg=black,bg=black!10}
\setbeamercolor*{palette quaternary}{fg=black,bg=black!10}

% Links
\usepackage{hyperref}
\definecolor{links}{HTML}{003262}
\hypersetup{colorlinks,linkcolor=,urlcolor=links}

% columns
\renewcommand{\(}{\begin{columns}}
\renewcommand{\)}{\end{columns}}
\newcommand{\<}[1]{\begin{column}{#1}}
\renewcommand{\>}{\end{column}}

% adding slide numbers
\addtobeamertemplate{navigation symbols}{}{%
    \usebeamerfont{footline}%
    \usebeamercolor[fg]{footline}%
    \hspace{1em}%
    \insertframenumber/\inserttotalframenumber
}

% equation stuff
\newcommand{\Macro}{\ensuremath{\Sigma}}
\newcommand{\Sn}{\ensuremath{S_N} }
\newcommand{\vOmega}{\ensuremath{\hat{\Omega}}}
\usepackage{mathrsfs}
\usepackage[mathcal]{euscript}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{epsfig}
\usepackage{amsmath}

\newcommand{\ve}[1]{\ensuremath{\mathbf{#1}}}
\newcommand{\micro}{\ensuremath{\sigma}}
\newcommand{\detR}{\ensuremath{\Sigma}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\title{Solving Shielding Challenges:}
\subtitle{Self-Shielding and Strong Anisotropies}
\author{\includegraphics[height=2cm]
{../bk-eps-converted-to}\\R.\ N.\ Slaybaugh, UC Berkeley \\ S.\ C.\ Wilson, ORNL}
\date{11 June 2015 \\ Oak Ridge National Laboratory}
\titlepage
\end{frame}

% As you prepare your presentation, keep in mind that most of the students won’t have a radiation transport background so a couple slides on “what radiation transport is”, “why it's needed”, and “where it’s used” would be nice :).

% --------------------------------------------------------------
\begin{frame}[fragile]{Outline}
  \frametitle{Outline}

\begin{columns}
  \begin{column}{0.6\textwidth}
    \begin{itemize}
    \item Hybrid methods overview
    \begin{itemize}
    		\item Motivation
		\item CADIS and FW-CADIS
		\item Challenges
    \end{itemize}
    	\item MC importances with space and energy self-shielding
	\begin{itemize}
    		\item Cross section processing
		\item Problem investigation
		\item Resonance factor method
		\item Results and wrap-up
  	\end{itemize}
	\item MC importances with strong anisotropies
  \end{itemize}
  \end{column}
  \begin{column}{0.4\textwidth}
  	\begin{figure}
  	\begin{center}
  		\includegraphics[height=2in,clip]{../figs/psu-reactor}
	\end{center}
  	\end{figure}
  \end{column}
\end{columns}

\end{frame}

% --------------------------------------------------------------
% --------------------------------------------------------------
\section{\scshape Hybrid Methods}
%\subsection{Motivation}
\begin{frame}[fragile]
  \frametitle{Boltzmann transport equation}

\textit{Where} are all the neutrons? \textit{Why} do we care?
\pause
\begin{align}
\vOmega \cdot \nabla \psi(\vec{r}, E, \vOmega) &+
\Sigma_t \psi(\vec{r}, E, \vOmega) = S(\vec{r}, E, \vOmega) \:+\nonumber\\
%
& \int_{4\pi} d\vOmega' \int_0^{\infty} dE'\: \Sigma_s(E', \vOmega' \rightarrow E, \vOmega) \psi(\vec{r}, E', \vOmega') \nonumber
\end{align}

\begin{itemize}
\item $\psi(\vec{r}, E, \vOmega)$ is the angular neutron flux in neutrons per unit length squared per steradian,
\item $\Sigma$s are the probabilities of interaction (total or scattering) with units of inverse length,
\item $S(\vec{r}, E, \vOmega)$ is a fixed source, and
\item $\phi(\vec{r}, E)$ (used later) is the scalar neutron flux
\end{itemize}

\end{frame}

% --------------------------------------------------------------
%\section{\scshape Hybrid Methods}
%\subsection{Motivation}
\begin{frame}[fragile]
  \frametitle{Project motivation}

\begin{columns}
  \begin{column}{0.55\textwidth}
	\begin{itemize}
	\item Need to accurately model radiation for shielding
	\item \alert{Challenging}: dense shields; streaming paths; multigroup x-secs
	\item Current methods are insufficient
	\item \alert{Goal}: accurate solutions in reasonable time
	\end{itemize}
  \end{column}
  \begin{column}{0.45\textwidth}
  	\begin{figure}
  	\begin{center}
  		\includegraphics[height=1.25in,clip]{../figs/isfsi}
		\caption{Used fuel storage pad}
	\end{center}
  	\end{figure}
  \end{column}
\end{columns}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Solving the TE}
%
\begin{columns}
  \begin{column}{0.5\textwidth}
  \begin{center}
  \underline{Monte Carlo}
  \end{center}
	\begin{itemize}
	\item Solution has statistical error
	\item \textit{Continuous} phase space: ``gold standard answers"
	\item Long compute times
	\item Optically thick = \textit{slow}
	\item Good for streaming
	\end{itemize}
  \end{column}
  \begin{column}{0.5\textwidth}
  \begin{center}
  \underline{Deterministic}
  \end{center}
	\begin{itemize}
	\item Solution equally valid everywhere
	\item \textit{Discretized} phase space: drives solution quality
	\item Can be fast
	\item Streaming = \textit{ray effects}
	\item Good for optically thick
	\end{itemize}
  \end{column}
\end{columns}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Speeding up MC}
  \begin{itemize}
  	\item To use MC in many applications, we need to \alert{improve} it
	\item Variance reduction is designed to increase the FOM:
  \end{itemize}
\begin{align}
\text{FOM} = \frac{1}{\text{R}^2\text{t}}\:,
 \qquad & \text{R = relative error} \nonumber \\
& \text{t = time} \nonumber
\end{align}
  \begin{itemize}
  \pause
  	\item \underline{Idea}: can we use deterministic and Monte Carlo methods together to lessen the weaknesses of each?
  \end{itemize}
  \pause
  $\rightarrow$ \textbf{Hybrid Methods}

\end{frame}

% --------------------------------------------------------------
%\subsection{CADIS}
\begin{frame}[fragile]
  \frametitle{Forward-adjoint relationship}
Define response with function $f(\ve{r}, E)$ in volume $V_r$ as
%
\begin{equation}
 R = \int_E \int_{V_r} f(\ve{r}, E) \phi(\ve{r}, E) dV dE
 \label{eq:Response}
\end{equation}\pause
%
\begin{columns}
  \begin{column}{0.5\textwidth}
	\begin{align}
  	H\phi &= q \quad \text{(forward)}\nonumber \\
  	%
  	H^{\dagger} \phi^{\dagger} &= q^{\dagger} \quad
  	\text{(adjoint)}\nonumber
  	\end{align}
  \end{column}
  \begin{column}{0.5\textwidth}
  	\begin{align}
  	\langle H\phi, \phi^{\dagger} \rangle &= \langle H^{\dagger} \phi^{\dagger}, \phi \rangle \:, \text{and therefore} \nonumber \\
  	%
  	\langle q, \phi^{\dagger} \rangle &= \langle q^{\dagger}, \phi \rangle \nonumber
  	\end{align}
  \end{column}
\end{columns}
\vspace*{1 em}
\pause
If we let $q^{\dagger} = f(\ve{r}, E)$, then
%
\begin{equation}
 \langle q^{\dagger}, \phi \rangle = \langle f, \phi \rangle = R = \langle q, \phi^{\dagger} \rangle
 \label{eq:ResponseRedef}
\end{equation}
%
Eq.\ \eqref{eq:ResponseRedef} expresses that $\phi^{\dagger}$ represents the expected contribution of a source particle to the response.

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{CADIS \cite{Wagner2007}}

  \begin{enumerate}
  \item Define $q^{\dagger}$ as the local response of interest\\
  \item Coarse deterministic calculation to get $\phi^{\dagger}$ and $R$
  \end{enumerate}
%
\begin{align*}
  imp(\ve{r}, E) &= \frac{\phi^{\dagger}(\ve{r}, E)}{\langle q(\ve{r}, E), \phi^{\dagger}(\ve{r}, E) \rangle} = \frac{\phi^{\dagger}(\ve{r}, E)}{R} \\
  %
  \hat{q}(\ve{r}, E) &= \frac{\phi^{\dagger}(\ve{r}, E) q(\ve{r}, E)}{R} \\
  %
  w_0(\ve{r}, E) &= \frac{q(\ve{r}, E)}{\hat{q}(\ve{r}, E)} = \frac{R}{\phi^{\dagger}(\ve{r}, E)}
  \label{eq:Importance}
\end{align*}

Birth weights match weight targets: \underline{C}onsistent \underline{A}djoint \underline{D}riven \underline{I}mportance \underline{S}ampling \underline{M}ethod

\end{frame}

% --------------------------------------------------------------
%\subsection{FW-CADIS}
\begin{frame}[fragile]
  \frametitle{FW-CADIS \cite{Wagner2007}}

\begin{itemize}
\item We often want to optimize solutions in \textbf{all} of phase space\\
\item Then, the adjoint source needs to be a global forward solution: \underline{F}orward \underline{W}eighted-CADIS
\end{itemize}\pause
%
\begin{columns}
  \begin{column}{0.5\textwidth}
  \begin{center}
  \alert{To Optimize}
  \end{center}
	\begin{align}
  	&\phi(\ve{r}, E)\nonumber \\
  	%
  	\int&\phi(\ve{r}, E)\sigma_d(\ve{r}, E)\nonumber
  	\end{align}
  \end{column}
  %
  \begin{column}{0.5\textwidth}
  \begin{center}
  \alert{Adjoint Source}
  \end{center}
  	\begin{align}
  	f(\ve{r}, E) &= \frac{1}{\phi(\ve{r}, E)}\nonumber \\
  	%
  	f(\ve{r}, E) &= \frac{\sigma_d(\ve{r}, E)}{\int\phi(\ve{r}, E)\sigma_d(\ve{r}, E)} \nonumber
  	\end{align}
  \end{column}
\end{columns}
\vspace*{1 em}
For example
%
\begin{equation}
 R = \int_E \int_{V_f} f(\ve{r}, E) \phi(\ve{r}, E) dV dE = \int_E \int_{V} \frac{1}{\phi(\ve{r}, E)} \phi(\ve{r}, E) dV dE \approx 1 \nonumber
\end{equation}

\end{frame}

% --------------------------------------------------------------
%\subsection{Challenges}
\begin{frame}[fragile]
  \frametitle{Challenges}

	FW-CADIS works well for \textbf{most} shielding problems...
	%
	\begin{columns}
  	\begin{column}{0.5\textwidth}
  	\begin{figure}
  	\begin{center}
  		\includegraphics[height=1.9in,clip]{../figs/dlvn}
		\caption{Dog Legged Void Neutron shielding benchmark}
	\end{center}
  	\end{figure}
  	\end{column}
 	%
 	\begin{column}{0.5\textwidth}
 	\begin{figure}
  	\begin{center}
  		\includegraphics[height=1.9in,clip]{../figs/dlvn-lowVR}
  		\caption{MC 95\% CI RE using FW-CADIS, DLVN \cite{Slaybaugh2013}}
  	\end{center}
  	\end{figure}
  	\end{column}
	\end{columns}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Challenges}

	...but not \textbf{all} of them
	%
	\begin{columns}
  	\begin{column}{0.45\textwidth}
  	\begin{center}
  	\begin{figure}
  		\includegraphics[height=2in,clip]{../figs/plate-badVR}
  		\caption{MC 95\% CI RE using FW-CADIS, plate \cite{Wilson2015}}
  	\end{figure}
	\end{center}
  	\end{column}
 	%
 	\begin{column}{0.5\textwidth}
  	\begin{center}
  	\begin{itemize}
  		\item An example case:
		\begin{itemize}
		    \item Energy self-shieding +
		    \item Spatial self-shielding
		\end{itemize}
		\item High relative error through location of interest \vspace*{0.5 em}
		\pause
		\item FW-CADIS only includes space and energy, \textit{not angle} \vspace*{0.5 em}
		\pause
		\item We're also using multigroup x-secs
	\end{itemize}
  	\end{center}
  	\end{column}
	\end{columns}

\end{frame}

% --------------------------------------------------------------
%% --------------------------------------------------------------
\section{\scshape Self-Shielding}
\begin{frame}[fragile]
  \frametitle{Self-shielding (quick aside)}

	\begin{itemize}
	\item \underline{Spatial self-shielding} occurs at interface locations between materials with different absorption/transport properties. There is a reduction in flux in the absorbing material, which results in fewer total absorptions in that spatial location; the location \textit{shields} itself. \vspace*{1em}

	\item \underline{Energy self-shielding} occurs at resonance peaks. There is a reduction in flux due to the large absorption cross section. This results in fewer total absorptions over that energy range (flux is depressed). Thus, the resonance peak \textit{shields} itself.
%Reference https://www.physicsforums.com/threads/energy-self-shielding.724795/
	\end{itemize}

\end{frame}

% --------------------------------------------------------------
%\subsection{Cross Section Processing}
\begin{frame}[fragile]
  \frametitle{Cross section processing \cite{Bondarenko1964}}

	\begin{itemize}
	\item General Case
	\begin{equation}
  	\micro_{x,g}^{(j)} = \frac{\langle \micro_x^{(j)}(u) W(u)\rangle}
	{\langle W(u)\rangle} \:, \quad W(u) = \phi_{\infty}(u) \nonumber
 	 \label{eq:baseBondarenko}
 	\end{equation}

 	\pause
 	\item Bondarenko method uses a background cross section
 	\begin{equation}
  	\micro_0^{(j)} = \frac{1}{N_j} \sum_{m \ne j} \micro_{t}^{(m)} N_m
  	%\label{eq:bgxsec}
  	\:, \quad \micro_{x,g}^{(j)}(\micro_0^{(j)}) = \frac{\langle
  	 \micro_{x}^{(j)}(u) \frac{\phi_{\infty}(u)} {\micro_{t}^{(j)}(u)
  	 + \micro_0^{(j)}} \rangle}
  	 { \langle \frac{\phi_{\infty}(u)}{\micro_{t}^{(j)}(u) +
  	 \micro_0^{(j)}}\rangle} \nonumber
  \label{eq:ssfact}
	\end{equation}
	\item W(u) changed to include the  spectral difference assumption and effect of other isotopes
	\end{itemize}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Cross section processing}

	\begin{itemize}
	\item When a nuclide is dilute, $\sigma_0^{(j)} >>
	 \sigma_t^{(j)}$, $W(u) \rightarrow$ uncorrected
		\begin{itemize}
		\item Large $\sigma_0$ = infinitely dilute case
		\end{itemize}

	\item When a nuclide is concentrated, $\sigma_0^{(j)} <<
	 \sigma_t^{(j)}$, resonances have a larger impact
		\begin{itemize}
		\item Small $\sigma_0$ = resonance case
		\end{itemize}
	\end{itemize}

    \pause
	\begin{itemize}
	\item Add correction for `thin slab' of resonance material in
	`thick slab' of moderator
	\begin{align}
  	&\sigma_0^{*,(j)} = \frac{1}{N_j} \sum_{m \ne j} \sigma_{t}^{(m)} N_m
	+ \frac{1}{N_j \bar{l}} \nonumber\\
  	&\text{\textcolor{byellow}{thin slab:}}\:\bar{l} \approx \frac{4V}{S} \qquad \text{\textcolor{byellow}{no effect:}}\:\bar{l} \approx \text{large} \nonumber
	\end{align}
	\end{itemize}

\end{frame}

% --------------------------------------------------------------
%\subsection{Problem Investigation}
\begin{frame}[fragile]
  \frametitle{Problem investigation}
  	\begin{columns}
  	\begin{column}{0.4\textwidth}
  	\begin{figure}
  		\includegraphics[height=2in,clip]{../figs/plate-geometry}
  		\caption{Shielding Stack Up}
  	\end{figure}
  	\end{column}
 	%
 	\begin{column}{0.6\textwidth}
	\begin{itemize}
	\item 53 cm $\times$ 50 cm $\times$ 140 cm
	\item Uniform in x except plate (25-28 cm in x; 30-130 cm in z)
	\item Uniform in y
	\item U-235 fission spectrum; homogenized U, Zr, and H$_2$O
	\vspace*{1 em}
	\item MC21, MCNP, and PARTISN
	\item ENDF/B-VII data (all codes)
	\item Processed by TRANSX (multigroup)
	\end{itemize}
  	\end{column}
	\end{columns}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Base calculation parameters}
  \begin{table}[p]
  \label{tab:calcParams}
  \begin{center}
    \begin{tabu}{| X | X | X |}\hline
      Variable & PARTISN & MC21\\\hline\hline
	Deterministic Mesh & 0.5 cm unif; 0.25 cm in x over 24 to 29 cm & 1 cm uniform \\\hline
	Tally mesh & N/A & 1 cm uniform \\\hline
	N particles & N/A & $1 \times 10^{10}$\\\hline
	Energy structure & 58 grps & 27 grps / cont.\\\hline
	Angular quad & QR-18-252 & QR-8-36\\\hline
	Scattering order & $P_3$ & $P_3$\\\hline
	Convergence & 0.01 & 0.05\\\hline
	TRANSX settings & $\bar{l}$ = 10,000 & $\bar{l}$ = 10,000\\\hline
	Dose Conv.\ Facs. & 58 grps & 27 grps \\\hline
    \end{tabu}
  \end{center}
\end{table}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Errors in plate}
 \begin{figure}[p]
   \begin{center}
     \includegraphics[height=2 in,clip]{../figs/NSE13-109R1-PlateDRandRE}
   \end{center}
   \caption{Base-case FW-CADIS MC21 dose rate (left) and 95CI RE (right) (xz-slice through y=25 cm)}
   \label{fig:Plate}
 \end{figure}
\end{frame}

%% --------------------------------------------------------------
%\begin{frame}[fragile]
%  \frametitle{Correct Without Plate}
% \begin{figure}[p]
%   \begin{center}
%     \includegraphics[height=2in,clip]{../figs/NSE13-109R1-NoPlateDRandRE}
%   \end{center}
%   \caption{No-Plate MC21 dose rate (left) and 95CI RE (right) (xz-slice through y=25 cm)}
%   \label{fig:noPlate}
% \end{figure}
%\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Deterministic MC mismatch}
 \begin{figure}[p]
   \begin{center}
     \includegraphics[width=3.8in,clip]{../figs/NSE13-109R1-PlateFluxExcel}
   \end{center}
   \caption{Plate non-thermal flux (left axis) and method ratios (right axis) down the x-y centerline}
   \label{fig:PlateFlux}
 \end{figure}
\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Correct without plate}
 \begin{figure}[p]
   \begin{center}
     \includegraphics[width=3.8in,clip]{../figs/NSE13-109R1-NoPlateFluxExcel}
   \end{center}
   \caption{Plate non-thermal flux (left axis) and method ratios (right axis) down the x-y centerline}
   \label{fig:noPlateFlux}
 \end{figure}
\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Deterministic MC mismatch}
 \begin{figure}[p]
   \begin{center}
     \includegraphics[width=3.8in,clip]{../figs/NSE13-109R1-PlateExitSpectra}
   \end{center}
   \caption{Plate flux spectra (left axis) and PARTSN/MC21 (right axis) at start of air region (z = 130.5 cm)}
   \label{fig:PlateExit}
 \end{figure}
\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Investigation}

	\begin{itemize}
	\item Parameters
	\begin{tabbing}
	* Mean chord length: \hspace*{2em} \= $\bar{l} = \frac{4V}{S}$ vs.\ $\bar{l} = 10,000$ \\
	* Angular quadrature: \> CMG-591 vs.\ QR-18-252 \\
	* Scattering expansion: \> P$_{5}$ vs.\ P$_{3}$ \\
	* Importance mesh: 	\> 0.25 cm (x), 0.5 cm (y,z) \\ \> in plate vs. 1 cm \\
	* Energy Structure: 	\> 58 vs.\ 27 groups
	\end{tabbing}

	\item CADIS in 2 cm area following plate
%	\end{itemize}
%	%
%	\begin{columns}
%  	\begin{column}{0.6\textwidth}
%	\begin{itemize}
	\item Physics
		\begin{itemize}
		\item Polyethylene follow-on
		\item Cr plate (diff.\ res.\ mat.)
		\item Air in plate (no res.\ mat.)
		\end{itemize}
	\end{itemize}
%  	\end{column}
%  	%
% 	\begin{column}{0.35\textwidth}
% 	\begin{align}
% 	\text{FOM}_{\min} &= \frac{1}{R_{\max}^2t} \nonumber \\
% 	\text{FOM}_{\max} &= \frac{1}{R_{\min}^2t} \nonumber
% 	\end{align}
% 	\end{column}
%	\end{columns}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Parameters results}

  	\begin{itemize}
  	\item Geometric chord length $\rightarrow$ PARTISN flux \textit{farther} from correct, especially in plate
  	\item Angular quadrature $\rightarrow$ \textit{no differences} with impact
	\item Scattering order $\rightarrow$ (nearly) \textit{no change}
  	\end{itemize}

  \begin{center}
    \begin{tabu}{|l|r|r|r|r|r|r|}\hline
      Case & N & CPU-hrs & Max RE & Avg RE & Min F & Avg F\\\hline
      %%
Base      & 1e10 & 849.77    & 0.810 & 1.02e-2 & 1.79e-3 & 11.3\\
%
1e11 & 1e11 & 8,543.47  & 0.164 & 3.28e-3 & \alert{4.33e-3} & 10.9\\
%
58 g & 1e10 & 954.89    & 0.522 & 9.33e-3 & \alert{3.85e-3} & 12.0\\
%
Fine & 1e10 & 905.34    & 1.55  & 1.71e-2 & 4.63e-4 & 3.78\\
%
F2e11 & 2e11 & 18,367.67 & 0.343 & 4.00e-3 & 4.62e-4 & 3.40\\\hline
    \end{tabu}
  \end{center}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{CADIS, poly follow}
 \begin{figure}[p]
   \begin{center}
     \includegraphics[width=3.8in,clip]{../figs/cadis-poly}
   \end{center}
 \end{figure}
\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Resonance streaming}
   \begin{figure}[p]
   \begin{center}
     \includegraphics[width=3.8in,clip]{../figs/NSE13-109R1-CrAir}
   \end{center}
   \caption{Cr plate (left) and air plate (right) FW-CADIS MC21 dose rate 95CI RE (xz-slice through y=25 cm)}
   \label{fig:CrAir}
 \end{figure}
\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{MAVRIC}

  \begin{itemize}
  \item We also ran this problem with and without the plate in MAVRIC (a multigroup MC code in SCALE)
  \item MAVRIC has more advanced cross section processing options
  \item Used 27 g and 200 g; in one 200 g case the plate had tailored x-secs every 10-cm \vspace*{0.5em}
  \pause
  \item Without plate case was correct
  \item 27 g $\rightarrow$ completely \textit{missed} the behavior
  \item Both 200 g cases $\rightarrow$ \textit{same} high relative error
  \end{itemize}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Investigation summary}

	\begin{itemize}
	\item Behavior is related to space and energy self-shielding
	\pause
	\item These items did not improve PARTISN:
	 \begin{itemize}
	 \item finer quadrature
	 \item higher scattering order
	 \item more theoretically-accurate mean chord length
	 \end{itemize}
	\pause
	\item These items in imp.\ map creation did not reduce REs:
	 \begin{itemize}
	 \item finer spatial mesh in plate
	 \item finer energy group structure
	 \end{itemize}
	\pause
	\item The high RE in and following the plate is present when using different codes and different methods to produce VR parameters, and exists when a different resonance material is used.
	\end{itemize}

A sufficiently-accurate PARTISN solution would be better (probably), but prohibitively expensive.

\end{frame}

% --------------------------------------------------------------
%\subsection{Resonance Factor Method}
\begin{frame}[fragile]
  \frametitle{Resonance factor method \cite{Wilson2015}}

  \alert{New Method} developed to deal with this.
  \vspace{0.5 em}

  	Apply renormalization factor to FW-CADIS source $q^{\dagger}_{FWC}$:
	%
	\begin{equation}
   	q^{\dagger}(\ve{r},E) = \Bigl(\frac{\phi_{res(\micro_0)}(\ve{r},E)}{\phi_{dilute(\micro_0)}(\ve{r},E)}\Bigr)^M q^{\dagger}_{FWC}  \nonumber
  	 \label{eq:newQ}
	\end{equation}
	%
	where
	\begin{itemize}
  	\item M is problem-dependent constant
 	 \item $\phi_{res(\micro_0)}(\ve{r},E)$ is forward flux with small background x-sec
 	 \item $\phi_{dilute(\micro_0)}(\ve{r},E)$ is forward flux with large background x-sec
	\end{itemize}
	\pause
	\vspace*{1 em}
	The resulting adjoint flux is used to make importances

	%Implementation: use $\phi_{res(\micro_0)}(\ve{r},E)$  in all locations where $\phi$ would be used in the FW-CADIS method

\end{frame}

%% --------------------------------------------------------------
%\begin{frame}[fragile]
%  \frametitle{Resonance factor method}
%
%	Example: optimize the space- and energy-dependent flux
%
%	\vspace*{1 em}
%	$q^{\dagger}_{FWC} = 1 / \phi$ and results in this corrected response:
%	%
%	\begin{align}
% 	R &= \int_E \int_{V} \Bigl(\frac{\phi_{res(\micro_0)}(\ve{r},E)}{\phi_{dilute(\micro_0)}(\ve{r},E)}\Bigr)^M \frac{1}{\phi_{res(\micro_0)}(\ve{r}, E)} \phi_{res(\micro_0)}(\ve{r}, E) dV dE \nonumber
% 	\label{eq:newResponse} \\
%  	 &\approx \int_E \int_{V} \Bigl(\frac{\phi_{res(\micro_0)}(\ve{r},E)}{\phi_{dilute(\micro_0)}(\ve{r},E)}\Bigr)^M dV dE \nonumber
%	\end{align}
%	\pause
%	The expanded version of importance map in plate becomes:
%	%
%	\begin{equation}
% imp(\ve{r},E)= \frac{\phi_{res(\micro_0)}^{\dagger}(\ve{r},E)}{\int_E \int_{V} \bigl(\frac{\phi_{res(\micro_0)}(\ve{r},E)}{\phi_{dilute(\micro_0)}(\ve{r},E)}\bigr)^M dV dE} \nonumber
% 	 \label{eq:newImp}
%	\end{equation}
%
%\end{frame}

% --------------------------------------------------------------
%\subsection{Results}
\begin{frame}[fragile]
  \frametitle{Results}
    \begin{center}
  \includegraphics[width=4in,clip]{../figs/m1-vs-58g}
  \end{center}
\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Results}

	\begin{table}[p]
 	 \label{tab:comparison}
  	\begin{center}
    \begin{tabular}{|l|r|r|r|r|r|}\hline
      Case & CPU-hrs & Max RE & Avg RE & Min FOM & Avg FOM\\\hline
      %%
base & 849.77 & 0.810 & 1.02e-2 & 1.79e-3 & 11.3\\
%
58 g & 954.89 & 0.522 & 9.33e-3 & 3.85e-3 & 12.0\\
%
M = 1 & \alert{534.80} & 0.269 & 2.44e-2 & \alert{2.58e-2} & 3.13\\\hline
    \end{tabular}
 	 \end{center}
	\end{table}

	\begin{itemize}
	\item M = 1.0 used same deterministic parameters as base case
	\item FOM$_{\min}$ $\sim$10x better than best FW-CADIS case
	\item FOM$_{\min}$ and FOM$_{\text{avg}}$ are $\sim$100x closer together than best FW-CADIS case
	\end{itemize}

\end{frame}

% --------------------------------------------------------------
%\subsection{Summary and Conclusions}
\begin{frame}[fragile]
  \frametitle{Resonance factor wrap-up}

  \begin{itemize}
  \item Space and energy self-shielding make VR difficult

  \item Caused by multigroup x-secs in angle-independent implementation

  \item Not resolved by
   \begin{itemize}
   \item Finer spatial mesh, energy group structure, or angular quadrature; higher order scattering expansion; or Bondarenko method
   \end{itemize}
  \pause
  \item New method
   \begin{itemize}
  	\item Adds a factor accounting for resonances to FW-CADIS adjoint source
  	\item Tunable based on degree of problem manifestation
	\item \alert{Lowers FOM$_{\min}$ and brings FOM$_{\min}$ closer to FOM$_{\text{avg}}$}
	\item More work, but useful in these pathological cases
   \end{itemize}
  \end{itemize}

\end{frame}

% --------------------------------------------------------------
% --------------------------------------------------------------
\section{\scshape Strong Anisotropies}
\begin{frame}[fragile]
  \frametitle{Anisotropy: a computational challenge}

	\begin{columns}
  	\begin{column}{0.5\textwidth}
	\begin{itemize}
	\item Many important nuclear applications have strong anisotropies:
	 \begin{itemize}
	 \item Used fuel casks
	 \item Reprocessing facilities
	 \item Reactor facilities
	 \item Active interrogation
	 \end{itemize}
	\pause
	\item Difficult to capture with current tools:
	 \begin{itemize}
	 \item Ray effects with deterministic
	 \item Too slow with analog MC
	 \item Insufficient acceleration of MC with current hybrid
	 \end{itemize}
	\end{itemize}
  	\end{column}
 	%
 	\begin{column}{0.5\textwidth}
 	 \begin{center}
 	 \begin{figure}
 	 \includegraphics[height=2in,clip]{../figs/pwr}
 	 \caption{PWR relative error \cite{Pantelias2013}}
 	 \end{figure}
 	 \end{center}

  	\end{column}
	\end{columns}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Current hybrid methods are insufficient}

	\begin{itemize}
	\item MC VR parameters created from adjoint deterministic scalar flux that is a function of \textit{space and energy only} \vspace*{1 em}
	\item Angular dependence of the importance function is not retained, otherwise the map would be
	\begin{itemize}
	  \item very large (tens or hundreds of GB) and
	  \item  more costly and complex to use in the MC simulation
	\end{itemize}
	\item Drawback: within a given space/energy cell, the map provides the average importance of a particle moving in \textit{any direction} through the cell -- excluding information about how particles move \alert{toward the objective}
	\end{itemize}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Current hybrid methods are insufficient}

	\begin{columns}
  	\begin{column}{0.5\textwidth}
 	 \begin{center}
 	 \begin{figure}
 	 \includegraphics[height=2in,clip]{../figs/boat-interrogation}
 	 \caption{Spherical boat model with source on left and fissionable material at center}
 	 \end{figure}
 	 \end{center}
  	\end{column}
 	%
 	\begin{column}{0.5\textwidth}
 	 \begin{center}
 	 \begin{figure}
 	 \includegraphics[height=2in,clip]{../figs/boat-map}
 	 \caption{Target weight window values for 14.1 MeV neutrons}
 	 \end{figure}
 	 \end{center}
  	\end{column}
	\end{columns}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Many attempts at resolution $\rightarrow$ \\
  \hspace*{3em} Limited Success}

	\begin{itemize}
	\item Automatic WW generator in MCNP \cite{MCNP2008}
	\item AVATAR \cite{vanRiper1997}
	%in many cases in which anisotropies are important, including angular information will improve calculation efficiency. However, these results also showed that the simple angular CADIS implementation is not accurate enough to provide the improvement necessary to be able to efficiently execute the used fuel cask calculations we would like to perform to improve facility monitoring design and operation.
	\item LIFT \cite{Turner1997}
	%derived from the zero-variance method and  uses an approximation of the adjoint flux that is piecewise continuous in angle. LIFT only captures linearly anisotropic scattering, which is not enough for our needs and is somewhat difficult to use
	\item Cooper and Larsen's global weight windows \cite{Cooper2001}
	\item FW/CADIS
	\item Resonance Factor method
	\end{itemize}
    All of these have worked in \textit{some} situations\\
    They often require \textit{significant} user expertise

    \vspace*{1 em}
    \underline{Better hybrid methods are needed}: \alert{two ideas}.

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Integration weighting}

    Different integration plan captures angles in scalar flux creation
	\begin{align*}
		\phi^{\dagger}(\ve{r},E) &= \int \psi^{\dagger}(\vOmega,
		\ve{r},E) d\vOmega \qquad  \qquad \qquad \text{original}\\
		 %
		\phi^{\dagger}(\ve{r},E) &= \frac{\int \psi(\vOmega, \ve{r},E)
		 \psi^{\dagger}(\vOmega, \ve{r},E) d\vOmega}{\int \psi(\vOmega,
		 \ve{r},E)  d\vOmega} \qquad \text{\alert{new}}
	\end{align*}
%Note that these two calculations can be completed concurrently. Then, the adjoint scalar fluxes will be computed by angularly integrating the product of the forward and adjoint angular fluxes to account for the directions in which the particles will actually be traveling at any given location/energy:
%will provide importance values that more accurately reflect the average importance of particles that will be transported in the final Monte Carlo calculation, yielding faster Monte Carlo run times.

    \pause
    Major challenges and areas of investigation:
	\begin{enumerate}
	\item Data storage and handling (many GBs)
	\item More, less, or differently sensitive to
	  \begin{itemize}
	  \item quality of the discrete ordinates calculation?
	  \item ray effects?
	  \end{itemize}
	\end{enumerate}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Lagrange discrete ordinate equations}

    Use a formulation that is more flexible in the ways
	it handles quadrature: new LDO equations \cite{Ahrens2014}
	\vspace*{1 em}

	\begin{itemize}
	\item Re-derivation of $S_N$ with an \alert{interpolatory quadrature framework}
	\item Allows evaluation at directions not on quadrature set
	\item Can use \alert{asymmetric angles}
	\item No need to store spherical harmonic moments
	\item May be useful for more accurately capturing strong anisotropies
	\end{itemize}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[fragile]
  \frametitle{Method implementation}

  	\begin{itemize}
    \item The space- and energy-dependent importance map will be normalized and
     source biasing parameters will be generated in the \alert{same ways} as
     the current implementation of FW/CADIS \vspace*{1 em}
	\item Immediately useful; widely applicable \vspace*{1 em}
	\item We will study both strategies and characterize the impact\vspace*{1 em}
	\item Will be available in SCALE \cite{SCALE} and ADVANTG \cite{Pantelias2013}
	\end{itemize}

\end{frame}

% --------------------------------------------------------------
% --------------------------------------------------------------
\section*{}
\begin{frame}[fragile]
  \frametitle{Questions?}
  \begin{center}
  \includegraphics[height=3in,clip]{../questions-comic}
  \end{center}

\end{frame}

% --------------------------------------------------------------
\begin{frame}[allowframebreaks]{References}
	\bibliographystyle{unsrt}
	\bibliography{2015-06-ornl}
\end{frame}

\end{document}

max_stars_repo_name: rachelslaybaugh/presentations

max_issues_repo_name: rachelslaybaugh/presentations

max_forks_repo_name: rachelslaybaugh/presentations


text:
%Intro to intro
This thesis examines the opportunity and possibility to connect an embedded IoT device to a Eclipse Arrowhead framework local cloud.
This project uses the STM32 B-L4S5I-IOT01A IoT discovery node as a development board, running the Mbed-OS 6.
\section{Background}
%Setting
According to Artemis-IA, the world is undergoing a new industrial revolution, moving towards a more decentralized and software-oriented means of production\cite{Artemis2021}.
This fourth new, and in some sense planned, industrial revolution is called Industry 4.0 according to Lasi\cite{Lasi2014}.
%Technologies
Cyber-Physical systems act as a bridge between the data-rich cybernetic world and the technology-rich physical world Artemis-IA means\cite{Artemis2021}.
Artemis-IA claims that a differentiating factor between traditional embedded systems and Cyber-Physical systems is their size and scope, where traditional embedded systems have a more limited capacity.
Cyber-Physical system, on the other hand, has a much larger scope, including interconnected embedded systems, human-, and socio-technological systems as well Artemis-IA adds.

%Economic incentives.
The larger economies of the world all have incentives promoting Industry 4.0, for instance, China’s Made in China 2025.
If Europe is to compete with the larger economies, European industries need to invest in the technologies mentioned above according to Artemis-IA\cite{Artemis2021}.
A shift away from proprietary solutions towards collaborative solutions  Artemis-IA claim need to happen in their report Embedded intelligence.

\section{Motivation}
%Solve problem presented in the background.
The need for a European incentive promoting Industry 4.0 is clear.
According to their website, the Arrowhead Tools project aims for digitalization and automation solutions for the European industries\cite{AT2021}.
The Arrowhead Tools project uses the open-source Eclipse Arrowhead framework, further contributing to the collaborative solutions needed for the European economy defined in the previous section\cite{Github2021}.

%What is there now?
The Eclipse Arrowhead framework contains many examples in various programming languages.
Python, C\#, and C++ have client libraries and example code developed for them, which you can find on the project’s GitHub page.\cite{AC2021}

%What is needed?
However, there is no client library or code example for a specific piece of hardware to connect to an Eclipse Arrowhead framework local cloud fast and easy, showcasing the capabilities of this project.
Therefore, a project with the clear intent to showcase both the capabilities and possibilities of Cyber-Physical systems and the Eclipse Arrowhead framework is needed.

%Conclussion to motivation
This thesis examines the possibilities of having a ready-made example to compile and run on a specific hardware platform that connects to an Eclipse Arrowhead framework local cloud as a proof of concept.
Much like the ‘Getting started with’ examples from Amazon Web Services and Microsoft Azure.\cite{Guide2020,AZURE2021}
\section{Problem definition}
%This is good; if deleting the other paragraph, expand this.
This project aims to investigate the possibilities, benefits, and limitations of using the Eclipse Arrowhead framework on embedded devices in contrast to commercially available solutions such
as Amazon Web Services and Microsoft Azure.
\begin{figure}[h!]
    \centering
    \includegraphics[width=\textwidth, height=10cm]{Pictures/board.pdf}
    \caption{STM32 B-L4S5I-IOT01A IoT discovery node with relevant sensors and modules.}
    \label{STM32 B-L4S5I-IOT01A IoT discovery node}
\end{figure}
\newpage

%Maybe remove, how to measure??
\section{Equality and ethics}
%Expand
The ability to own and control your data is becoming rarer and rarer these days, with giant corporations establishing their cloud services.
As a consumer, one always takes a risk when pushing sensitive data to a cloud owned by someone else. Corporations should not infringe the right to possess your data.
The Eclipse Arrowhead framework and the use of local clouds move the storage of your data from giant corporations to your own.
The Eclipse Arrowhead framework also promotes cooperation between different local clouds owned by various stakeholders.
\section{Sustainability}
The use of small embedded devices instead of monolithic machines provides a much-needed decrease in energy consumption for more immense industries.
The IoT devices can save energy by vigorously monitoring industrial processes and knowing when it is the most cost-effective to run them.
By using sensor data to determine when and how it is most efficient to run a process, IoT devices can contribute to the optimization of industrial processes.
We know that optimization leads to less energy consumption.
On a greater scale, the use of IoT devices would also enable preventive maintenance of components, reducing both the cost and materials required for maintenance later on.
\section{Delimitations}
\subsection{Security}
%Expand
This thesis does not cover a solution to the numerous security risks and issues associated with IoT devices described in chapter \ref{ch2}.
\subsection{Core systems}
%Expand
This thesis does not cover more than using the three core systems of the Eclipse Arrowhead framework, presented in chapter \ref{ch2}. The core systems are the service registry, authorization, and orchestrator.
The STM32 B-L4S5I-IOT01A IoT discovery node will not host the Arrowhead framework on the board itself since the Arrowhead framework is too resource-heavy for such a small device.
Instead, the board will connect to an Eclipse Arrowhead framework local cloud hosted by another computer in the same network.
\subsection{Intercloud connection}
%Expand
This thesis does not cover the connection connecting between multiple clouds, intercloud connections.
This thesis is limited to the connection within the same local Arrowhead cloud, intracloud connection.
Intercloud connection requires two more Arrowhead systems, gateway and gatekeeper, to operate and the configuration of those systems is beyond the scope of this thesis.

\section{Thesis structure}
Chapter \ref{ch2} presents related work and conducts a literature review of IoT, Industry 4.0, security, and the Eclipse Arrowhead framework.
Chapter \ref{ch3} covers theory, describing what technologies and scientific methods this thesis uses.
Chapter \ref{ch4} covers the implementation, describing the design of different systems used in this thesis from a software engineering perspective.
Chapter \ref{ch5} presents an evaluation of the experiment conducted.
Chapter \ref{ch6} contains a discussion about the solution to the problem stated in chapter \ref{ch1}, possible alternative solutions, and how the results affect the industry.
Chapter \ref{ch7} presents the conclusion of the work done in this thesis. Chapter \ref{ch7} also describes how to investigate further the questions raised in this thesis.
Chapter \ref{ch9} presents the funding for this thesis.
In chapter \ref{ch8}, there is a list of references used in this thesis.


text:
\documentclass[11pt]{amsart}
\usepackage{amsmath,amsfonts,amsthm,amssymb, amsaddr}

\title{Line and Surface Integrals}

\author{Joe Bentley}

\date{\today}

\begin{document}

\maketitle

\newpage

\section{3D Curves and Polar Coordinate Review}

We can represent a 3D curve as a vector function of a single parameter $\mathbf{r} = \mathbf{r}(u)$ for some interval $u_1 \leq u \leq u_2$. A curve such as this can be represented generally as,

\begin{align*}
  \mathbf{r}(u) = x(u)\hat{\imath} + y(u)\hat{\jmath} + z(u)\hat{k}
\end{align*}

A quick recap of polar coordinates. For example, with a flat circle in the xy plane of radius $a$, we can represent the cartesian coordinates as,

\begin{align*}
  x &= a\cos{\theta} \\
  y &= a\sin{\theta} \\
  z &= 0
\end{align*}

for $0 \leq \theta \leq 2\pi$.

\section{Integral Over a Line}

Diagram of line.

For a function $\mathbf{r}(u)$ giving a value at a point $u$ on a line, we can say that there is a small change along the line which we call $d\mathbf{r}$ corresponding to a change in $u$. When $u$ increases to $u + du$, then $\mathbf{r}(u)$ changes to,

\begin{align*}
  \mathbf{r}(u + du) = \mathbf{r}(u) + d\mathbf{r} = \mathbf{r}(u) + \frac{d\mathbf{r}}{du} du
\end{align*}

The integral of a vector field $\mathbf{F}(\mathbf{r})$ along a curve $C$ defined by the vector function $\mathbf{r}(u)$ is given by,

\begin{align*}
  \int_C \mathbf{F}\cdot d\mathbf{r} = \int_{u_1}^{u_2} \mathbf{F}(\mathbf{r}(u)) \cdot \frac{d\mathbf{r}}{du} du
\end{align*}

A physical example of this is the work done $W$ performed by a force $\mathbf{F}$ in moving an object along a path $C$,

\begin{align*}
  W = \int_C \mathbf{F} \cdot d\mathbf{r}
\end{align*}

\section{Example: Integral Over a Line}

In this section we will take a simple example of an integral over a closed line of a function $\mathbf{F}(\mathbf{r}) = -y\hat{\imath} + x\hat{\jmath}$. The integral we need to evaluate is $\oint_C \mathbf{F} \cdot d\mathbf{r}$. $C$ is a circle with radius $a$ in the xy plane which will be travered by $\theta$ anti-clockwise. We define a point $\mathbf{r}$ on the circumference on the circle as,

\begin{align*}
  \mathbf{r} =
    \begin{pmatrix}
      x \\
      y \\
      z
    \end{pmatrix} =
    \begin{pmatrix}
      a \cos{\theta} \\
      a \sin{\theta} \\
      0
    \end{pmatrix}
\end{align*}

where $0 \leq \theta \leq 2\pi$.

We can see that $d\mathbf{r} = \frac{d\mathbf{r}}{d \theta} d\theta$, so we can use this to evaluate our integral. First we need to take the dot product, $\mathbf{F} \cdot d\mathbf{r}$,

\begin{align*}
  \mathbf{F} \cdot d\mathbf{r} &=
  \begin{pmatrix}
    -a \sin{\theta} \\
    a \cos{\theta} \\
  \end{pmatrix} \cdot
  \begin{pmatrix}
    -a \sin{\theta} \\
    a \cos{\theta}
  \end{pmatrix} d\theta \\
  &= a^2 \left(\sin^2{\theta} + \cos^2{\theta}\right)d\theta \\
  &= a^2 d\theta
\end{align*}

Now the integral can be evaluated,

\begin{align*}
  \oint_C \mathbf{F} \cdot d\mathbf{r} = \int_0^{2\pi} a^2 d\theta = 2\pi a^2
\end{align*}

So we have now evaluated the integral of our function over the circle $C$.

\section{Kinetic Energy}

Suppose a body of mass $m$ moves along a trajectory $\mathbf{r}(t)$ under the influence of some force $\mathbf{F}(\mathbf{r})$. We know that the work done moving from $\mathbf{r}(t_1)=\mathbf{r_1}$ at time $t_1$, to point $\mathbf{r}(t_2)=\mathbf{r_2}$ at time $t_2$ is,

\begin{align*}
  W &= \int_C \mathbf{F} \cdot d\mathbf{r} \\
    &= \int_C m \frac{d\mathbf{v}}{dt} \cdot d\mathbf{r} \\
    &= \int_{t_1}^{t_2} m \frac{d\mathbf{v}}{dt} \cdot \frac{d\mathbf{r}}{dt} dt \\
    &= \int_{t_1}^{t_2} m \frac{d\mathbf{v}}{dt} \cdot \mathbf{v} dt \\
    &= \int_{t_1}^{t_2} \frac{d}{dt} \left(\frac{1}{2}m \mathbf{v} \cdot \mathbf{v}\right) dt \\
  W &= \frac{1}{2}m v_2^2 - \frac{1}{2}m v_1^2
\end{align*}

arriving at an expression for the work done moving through a force between two points. This can be called the kinetic energy of a body. If the force is derived from a potential energy $V$, then $\mathbf{F} = -\nabla V$,

\begin{align*}
  W &= \int_C \mathbf{F} \cdot d\mathbf{r} \\
    &= \int_{t_1}^{t_2} -\nabla V \cdot \frac{d\mathbf{r}}{dt} dt
\end{align*}

\section{Surface Integrals}

A surface can be represented by a vector function of two parameters,

\begin{align*}
  \mathbf{r} = \mathbf{r}(u, v) = x(u, v)\hat{\imath} + y(u, v)\hat{\jmath} + z(u, v)\hat{k}
\end{align*}

For example, we can describe a sphere of radius $a$ centered at the origin by the following parameterisation,

\begin{align*}
  x &= a\sin{\theta}\cos{\theta} \\
  y &= a\sin{\theta}\sin{\phi} \\
  z &= a\cos{\theta} \\
  0 \leq \theta \leq \pi \\
  0 \leq \phi \leq 2\pi
\end{align*}

so in this case $\mathbf{r}$ can be represented as,

\begin{align*}
  \mathbf{r} = a
  \begin{pmatrix}
    \sin{\theta}\cos{\theta} \\
    \sin{\theta}\sin{\phi} \\
    \cos{\theta}
  \end{pmatrix}
\end{align*}

To evaluate a surface integral, we need an expression for a small element of surface area $dS$. We form this by considering points $\mathbf{r}(u, v)$ when $u$ ranges from $u$ to $u + du$ and $v$ ranges from $v$ to $v + dv$. This element is a parallelogram with sides $d\mathbf{r_1}$ and $d\mathbf{r_2}$ given by,

\begin{align*}
  d\mathbf{r_1} &= \frac{\partial \mathbf{r}}{\partial u} du \\
  d\mathbf{r_2} &= \frac{\partial \mathbf{r}}{\partial v} dv
\end{align*}

The area of this small element $dS$ is given by the cross product, $\mathbf{A} = ab\sin{\theta}\hat{n} = \mathbf{a} \times \mathbf{b}$.

\section{Changing Variable in the Double Integral}

We can view the double integral,

\begin{align*}
  \iint_S f(x, y) dx dy
\end{align*}

as a surface integral over a surface $S$ in the $xy$ plane. We can parameterise the surface $S$ by a function of two variables, $\mathbf{r} = \mathbf{r}(u, v)$. This is equivalent to changing the variables $x, y \to u, v$. For the surface $S$ we can do this as follows,

\begin{align*}
  d\mathbf{S} &= \frac{\partial \mathbf{r}}{\partial u} \times \frac{\partial \mathbf{r}}{\partial v} du dv \\
              &=
  \begin{pmatrix}
    \frac{\partial x}{\partial u} \\[4pt]
    \frac{\partial y}{\partial u} \\[4pt]
    0
  \end{pmatrix} \times
  \begin{pmatrix}
    \frac{\partial x}{\partial v} \\[4pt]
    \frac{\partial y}{\partial v} \\[4pt]
    0
  \end{pmatrix} \\
  &= \left[ \frac{\partial x}{\partial u} \frac{\partial y}{\partial v} - \frac{\partial x}{\partial v} \frac{\partial y}{\partial u} \right] \hat{k} du dv
\end{align*}

Since $d\mathbf{S} = \hat{k} dx dy$ it follows that,

\begin{align*}
  dx dy = \left[ \frac{\partial x}{\partial u} \frac{\partial y}{\partial v} - \frac{\partial x}{\partial v} \frac{\partial y}{\partial u} \right] du dv
\end{align*}

Just like for a line integral paramterisation $dx = \frac{dx}{du} du$, here $dx dy = J du dv$ where $J$ is the differential term in square brackets above. This term $J$ is called the Jacobian determinant, as we see that it is the determinant of a 2$\times$2 matrix,

\begin{align*}
  \frac{\partial(x, y)}{\partial(u, v)} =
  \begin{vmatrix}
    \frac{\partial x}{\partial u} & \frac{\partial x}{\partial v} \\[4pt]
    \frac{\partial y}{\partial u} & \frac{\partial y}{\partial v}
  \end{vmatrix}
\end{align*}

The formula for changing variables in a double integrals is thus given by,

\begin{align*}
  \iint_S f(x, y) dx dy = \iint_S f\left(x(u, v), y(u, v)\right) \frac{\partial (x, y)}{\partial (u, v)} du dv
\end{align*}

\section{Example: 2D Polars}

We know that the $x$ and $y$ components can be parameterized in terms of $r$ and $\theta$,

\begin{align*}
  x &= r\cos\theta
  y &= r\sin\theta
\end{align*}

Then we can calculate the Jacobian as follows,

\begin{align*}
  \frac{\partial(x, y)}{\partial(r, \theta)} &=
  \begin{vmatrix}
    \frac{\partial x}{\partial r} & \frac{\partial x}{\partial \theta} \\[4pt]
    \frac{\partial y}{\partial r} & \frac{\partial y}{\partial \theta}
  \end{vmatrix} =
  \begin{vmatrix}
    \cos\theta & -r\sin\theta \\
    \sin\theta & r\cos\theta
  \end{vmatrix} \\
  &= r\cos^2\theta + r\sin^2\theta = r
\end{align*}

Therefore we have an expression for $dx dy$,

\begin{align*}
  dx dy = r dr d\theta
\end{align*}

This is what we expect when we parameterize to evaluate the double integral. For example, we will use this to evaluate, by way of parameterisation,

\begin{align*}
  & \iint e^{-(x^2 + y^2)} dx dy \\
  &= \int_{-\infty}^\infty e^{-x^2} dx \int_{-\infty}^{\infty} e^{-y^2} dy \\
  &= \int_0^\infty r dr \int_0^{2\pi} e^{-r^2} d\theta \\
  &= \int_0^\infty 2\pi re^{-r^2} dr = {\left[-\pi e^{-r^2}\right]}_0^\infty = \pi \\
  &\implies \int_{-\infty}^\infty e^{-x^2} dx = \sqrt{\pi}
\end{align*}

\section{Changing Variable in the Triple Integral}

We already know how to perform volume integrals as it is equivalent to simply taking the triple integral over a region $V$,

\begin{align*}
  \iiint_V f(x, y, z) dx dy dz
\end{align*}

We can parameteries the volume $V$ by some vector function $\mathbf{r}(u, v, w)$ for $uvw$ in some region $\overline{V}$ in $uvw$-space. Therefore we are just changing the variables again from $x, y, z \to u, v, w$. The element of volume is a parallelepiped given by the vectors $d\mathbf{r_1}$, $d\mathbf{r_2}$, $d\mathbf{r_3}$,

\begin{align*}
  d\mathbf{r_1} = \frac{\partial \mathbf{r}}{\partial u} du
  \qquad d\mathbf{r_2} = \frac{\partial \mathbf{r}}{\partial v} dv
  \qquad d\mathbf{r_3} = \frac{\partial \mathbf{r}}{\partial w} dw
\end{align*}

Now we can represent an element of volume (as given by the formula for the volume of the parallelepiped) as,

\begin{align*}
  dV &= d\mathbf{r_1} \cdot \left(d\mathbf{r_2} \times d\mathbf{r_3}\right) \\
     &= \frac{\partial \mathbf{r}}{\partial u} \cdot \left(\frac{\partial \mathbf{r}}{\partial v} \times \frac{\partial \mathbf{r}}{\partial w}\right) du dv dw
\end{align*}

Here we have the scalar triple product, and since the scalar triple product can be written as a determinant, we now have the Jacobian determinant in three dimensions,

\begin{align*}
  \frac{\partial \mathbf{r}}{\partial u} \cdot \left(\frac{\partial \mathbf{r}}{\partial v} \times \frac{\partial \mathbf{r}}{\partial w}\right) =
  \begin{vmatrix}
    \frac{\partial x}{\partial u} & \frac{\partial x}{\partial v} & \frac{\partial x}{\partial w} \\[6pt]
    \frac{\partial y}{\partial u} & \frac{\partial y}{\partial v} & \frac{\partial y}{\partial w} \\[6pt]
    \frac{\partial z}{\partial u} & \frac{\partial z}{\partial v} & \frac{\partial z}{\partial w}
  \end{vmatrix}
\end{align*}

\end{document}

max_stars_repo_name: unanimousarc/physics

max_issues_repo_name: unanimousarc/physics

max_forks_repo_name: unanimousarc/physics