\chapter*{\LaTeX~ suggestions}

\begin{center}
\bfseries
\color{red}{REMOVE THIS CHAPTER BEFORE SUBMISSION}
\end{center}

\noindent In this file there are listed some tips you may find useful. Some of the shortcuts shown are custom, so I suggest you to have a look at what's next even if you are expert in LaTeX.

\section*{Math}

All the fonts supported by the template provide a math variant for the formulas. You can use the standard math commands of LaTeX plus the following additions:
\begin{itemize}
\item Argmin/max: $\argmin_i$, $\argmax_i$, and their rendering in centered equations
$$\argmin_i \quad \argmax_i$$
\item Variance: $\var$, $\Var{p}$
\item Expected value: $\ev$, $\Ev{p}$
\end{itemize}

\section*{Custom commands}

We provide two commands you may find useful.

The command \texttt{\textbackslash blankpage} adds a blank page. Differently from \texttt{\textbackslash newpage}, the added page is completely blank and the text resume from the page after.

The command \texttt{\textbackslash todo} let you add the \todo symbol in the text. You can use it whenever you have text to be revisioned after.

\section*{Environments}

The thesis package provide three useful packages you may need for the theoretical part.

\subsection*{Definition}

Definitions are used for introducing a concept and its theoretical meaning for the first time. Do not use it just for clarifying the notation. Definitions are numbered within the chapter, such that the first definition of chapter 2 is 2.1. The syntax is the following:
\begin{verbatim}
\begin{definition}[NAME (optional)]
\label{def:LABEL}
DEFINITION
\end{definition}
\end{verbatim}

\noindent Example:

\begin{definition}[$(\alpha, \beta)$-approximation]
\label{def:alphabetaapprox}
An $(\alpha, \beta)$\textit{-approximation} algorithm outputs with success probability $\beta$ a solution which is at least $\alpha$ fraction of the optimal solution, for some $\alpha, \beta \leq 1$.
\end{definition}

\subsection*{Theorem}

Theorems are numbered incrementally within the thesis, regardless of the chapter they are declared in. The syntax is the following:
\begin{verbatim}
\begin{theorem}
\label{thm:LABEL}
THEOREM
\end{theorem}
\end{verbatim}

\noindent Example:

\begin{theorem}
\label{thm:approximation}
For a non-negative, monotone, submodular function $f(\cdot)$, let $S_k$ be a set obtained by selecting $k$ elements one at a time, each time choosing an element that provides the largest marginal increase in the function value. Let $S_k^*$ be a set that maximizes the value of $f(\cdot)$ over all $k$-sized sets. Then,
$$f(S_k) \geq \left( 1-\frac{1}{e} \right) \cdot f(S_k^*).$$
\end{theorem}

\subsection*{Lemma}
Lemma are like theorems. The syntax is the following:
\begin{verbatim}
\begin{lemma}
\label{thm:LABEL}
LEMMA
\end{lemma}
\end{verbatim}

\noindent Example:

\begin{lemma}
\label{thm:lemma}
This is a lemma.
\end{lemma}

\subsection*{Proposition}
Propositions are like lemmas but they are numbered within the chapter. The syntax is the following:
\begin{verbatim}
\begin{proposition}
\label{thm:LABEL}
PROPOSITION
\end{proposition}
\end{verbatim}

\noindent Example:

\begin{proposition}
\label{thm:chernoff}
If the diffusion process starting with $S$ is simulated independently at least $r=\Omega\left(\frac{n^2}{\varepsilon^2}\ln\left(\frac{1}{\delta}\right)\right)$ times, then the average number of activated nodes over these simulations is a $(1 \pm \varepsilon)$-approximation to $\sigma(S)$, with probability at least $1 - \delta$.
\end{proposition}

\subsection*{Algorithm}
The algorithm environment is used to show pseudocodes. The syntax, which follows the same paradigm of table/tabular combo, is the following:
\begin{verbatim}
\begin{algorithm}[FLOATING OPTIONS]
\caption{CAPTION}
\label{alg:LABEL}
\begin{algorithmic}[1 if you want the lines to be numbered]
ALGORITHM
\end{algorithmic}
\end{algorithm}
\end{verbatim}

\noindent Example:

\begin{algorithm}[H]
\caption{Combinatorial Thompson Sampling}
\label{alg:cts}
\begin{algorithmic}[1]
\Require Directed graph $G(V,E)$, budget constraint $k$, time horizon $T$
\For {$i = 1$ \textbf{to} $|E|$}
\State $\alpha_i = 1, \beta_i = 1$ \Comment{Assign a Beta distribution Beta(1,1) to each edge}
\EndFor

\For {$t = 1$ \textbf{to} $T$}
\State For each arm $i$, draw a sample $\theta_i(t) \sim$ Beta$(\alpha_i, \beta_i)$
\State Let $\boldsymbol{\theta}(t) = \left(\theta_1(t), \ldots, \theta_m(t) \right)$
\State $S_t \gets$ \texttt{oracle}$(G(V,E,\boldsymbol{\theta}(t)), k)$
\State Run cascade with $S_t$ as the seed set and collect the feedback $F_t$
\State Update the Beta distributions of the edges involved using $F_t$
\EndFor
\end{algorithmic}
\end{algorithm}

\section*{Referencing}

All the declared environments above can be referenced using the \texttt{{\textbackslash autoref}} command. \autoref{def:alphabetaapprox}, \autoref{thm:approximation}, \autoref{thm:chernoff}, \autoref{alg:cts}.


%!TEX root = ../../dissertation.tex

\section{Features and parameter values}

We describe some of the salient features of the model
and the benchmark parameter values we use later on.

\subsection{Features}

{\textit Consumption frontier.\/}
The resource constraints define a possibilities frontier for consumption.
We picture several examples in Figure \ref{fig:consumption-frontier}
with $z_{1t} = z_{2t} = 1$.
In each case, we compute the maximum quantity
$c_{1t}$ consistent with a given quantity $c_{2t}$,
the resource constraints (\ref{eq:resource-a},\ref{eq:resource-b}),
and the Armington aggregators (\ref{eq:armington-1},\ref{eq:armington-2}).
The shape depends on the aggregator.
When $\omega = 1/2$, the two final goods are the same and the tradeoff is linear.
When $\omega \neq 1/2$, the frontier is concave.
The degree of concavity depends on the elasticity of substitution $ 1/(1-\sigma)$
in the Armington aggregator.

In a competitive equilibrium, the slope of the consumption frontier
is (minus) the relative price of consumption in the two countries, $p_{2t}/p_{1t} = e_t$,
the real exchange rate.
From the figure, we can imagine variation in this price
produced either by moving along the frontier or by changing the frontier through
movements in the quantities of intermediate goods.

{\textit Marginal rates of substitution.\/}
Competitive equilibria and Pareto optima equate agents' marginal rates of substitution.
With recursive preferences, the intertemporal marginal rate of substitution of agent $j$ is
\begin{eqnarray}
    m_{jt+1} &=& \beta \left( \frac{c_{jt+1}}{c_{jt}}\right)^{\rho-1}
              \left( \frac{U_{jt+1}}{\mu_{t}(U_{jt+1})} \right)^{\alpha-\rho} .
              \label{eq:mrs}
\end{eqnarray}
The last term summarizes the impact of recursive preferences.
If $\alpha=\rho$, preferences are additive and the term disappears.
Otherwise anything that affects future utility can play a role in the marginal rate
of substitution, hence in allocations.
For example, a change in risk affects future utility which, in turn, alters optimal consumption allocations and market clearing prices.
Persistence is critical here, because more persistent shocks have a larger
impact on future utility.
The discount factor $\beta$ is similar:  the larger it is, the greater the weight on
future utility and the greater the impact on the marginal rate of substitution.

Note, too, the dynamics built into the recursive term.
Its log is a risk adjustment plus white noise.
The log of the numerator is
\begin{eqnarray*}
    \log U_{jt+1} &=&  E_t (\log U_{jt+1}) + \big[\log U_{jt+1} - E_t (\log U_{jt+1})\big] ,
\end{eqnarray*}
the mean plus a white noise innovation.
The log of the denominator is
\begin{eqnarray*}
    \log \mu_t (U_{jt+1})
            &=&
            \alpha^{-1} \log E_t (e^{\alpha \log U_{jt+1}})   \\
                        &=& E_t (\log U_{jt+1}) +
            \alpha^{-1} \big[ \log E_t (e^{\alpha \log U_{jt+1}}) - E_t (\alpha \log U_{jt+1}) \big] .
%            \underbrace{\mbox{risk adjustment}}_{\alpha \mbox{Var}_{t} (\log U_{t+1})/2}
\end{eqnarray*}
The term in square brackets is the entropy of $U_{jt+1}^\alpha$ and is positive.
We multiply by $\alpha$ to get what we term the risk adjustment, which is negative if $\alpha$ is.
The difference then is the innovation minus the risk adjustment.
The innovation increases the volatility of the intertemporal marginal rate of substitution,
which is the primary source of success in asset pricing
applications.

The marginal rate of substitution (\ref{eq:mrs}) is measured in units of agent $j$'s consumption good,
whose price is $p_{jt}$.
We refer to the relative price of the two consumption goods as the real exchange rate:
$ e_t = p_{2t}/p_{1t} $.
The two marginal rates of substitution are then connected by
$ m_{2t+1} = (e_{t+1}/e_t) m_{1t+1}$.
We'll derive this in the next section,
but it should be evident here that the dynamics of the exchange rate reflect the
marginal rates of substitution.
If the two marginal rates of substitution are close to white noise, as we suggested,
then the depreciation rate $e_{t+1}/e_t$ has the same property.

{\textit Productivity dynamics.\/}
One way to think about our log productivity process (\ref{eq:lom-z})
is that their average is a martingale and their difference is stable.
Denote half the sum and half the difference by
\begin{eqnarray*}
    \log \bar{z} &=& (\log z_1 + \log z_2)/2 \\
    \log \wh{z}  &=& (\log z_1 - \log z_2)/2  .
\end{eqnarray*}
Then we can express the underlying productivities
by $\log z_1 = \log \bar{z} + \log \wh{z}$ and $\log z_2 = \log \bar{z} - \log \wh{z} $.
Equation (\ref{eq:lom-z}) implies that half the sum,
\begin{eqnarray*}
    \log \bar{z}_{t+1} &=& \log g + \log \bar{z}_t + (v_t^{1/2} w_{1t+1} + v^{1/2} w_{2t+1})/2 ,
\end{eqnarray*}
is a martingale with drift.
The difference,
\begin{eqnarray}
    \log \wh{z}_{t+1}  &=& (1-2\gamma) \log \wh{z}_t + (v_t^{1/2} w_{1t+1} - v^{1/2} w_{2t+1})/2 ,
    \label{eq:lom-zhat}
\end{eqnarray}
is stable, which tells us $\log z_{1t}$ and $\log z_{2t}$ are cointegrated.
Given the linear homogeneity of the model, changes in $\bar{z}$ affect consumption
quantities proportionately, with no effect on their relative price, the exchange rate.
Changes in relative productivity $\wh{z}$, however,
affect consumption quantities differentially and therefore affect the real exchange rate
as well.

{\textit Pareto problems.\/}
We compute competitive equilibria in this environment by finding
Pareto optimal allocations and their supporting prices.
 In a two-agent Pareto problem,
we maximize one agent's utility subject to
(i)~the other agent getting at least some promised level of utility
(the promise-keeping constraint)
and (ii)~the productive capacity of the economy (the resource constraints and shocks).
The Lagrangian for this problem is
\begin{eqnarray*}
 \mathcal{L} &=& U_{1t} + \lambda_{t} (U_{2t} - \overline{U}) + \mbox{resource constraints and shocks} ,
\end{eqnarray*}
with $\lambda_t$ the multiplier on the promise-keeping constraint.
If utility functions are strictly concave,
this is equivalent to traditional Mantel-Negishi maximization of their weighted average,
\begin{eqnarray*}
    \theta_{1t} U_{1t} + \theta_{2t} U_{2t} ,
\end{eqnarray*}
with positive Pareto weights ($\theta_{1t}, \theta_{2t})$.
Evidently $\lambda_t$ in the previous problem plays the same role as $ \theta_{2t}/\theta_{1t}$.
We refer to $\lambda_t$ as the Pareto weight,
although in terms of the latter version we might call it the relative Pareto weight.

{\textit Transforming utility.\/}
We find it convenient to use an hd1 time aggregator, but with additive preferences
(the special case $\rho = \alpha$)
it's more common to transform utility to
$ {U}^{*}_{jt} = U_{jt}^\rho/\rho$.
With this transformation, equation (\ref{eq:time-agg}) becomes
\begin{eqnarray}
    {U}^{*}_{jt} &=& (1-\beta) c_{jt}^\rho/\rho
            + \beta \big[ E_t (U_{jt+1}^{* \alpha/\rho}) \big]^{\rho/\alpha} .
    \label{eq:utility-additive}
\end{eqnarray}
When $\rho=\alpha$ this takes the familiar additive form.

The transformation also changes the look of derivatives.
When we represent preferences with $U_{jt}$, marginal utility is
\begin{eqnarray*}
    \partial U_{jt} /\partial c_{jt} &=& U_{jt}^{1-\rho} (1-\beta) c_{jt}^{\rho-1} .
\end{eqnarray*}
When we use ${U}^*_{jt}$, marginal utility takes the simpler form
\begin{eqnarray*}
    \partial {U}^*_{jt} /\partial c_{jt} &=&  (1-\beta) c_{jt}^{\rho-1} .
\end{eqnarray*}
We'll use this insight later on to simplify some of the expressions we get
using the hd1 form of the time aggregator.
This includes the Pareto weight, which is defined for a specific
utility function.

\subsection{Parameter values}

We make only a modest effort to use realistic parameter values.
The goal instead is to highlight the effects of recursive preferences and
stochastic volatility with parameter values in the ballpark of those used
elsewhere in the literature.
We summarize these choices in Table \ref{tab:benchmark}.
The time interval is one quarter.

{\textit Preferences.\/}
We use $\rho=-1$ (implying an IES of one-half)
and $\alpha = -9$ (implying risk aversion of 10).
The former is a common value in business cycle modeling; \citet{Kydland1982-xy}, for example.
The latter is widely used in asset pricing; \citet{Bansal2004-mb} is the standard reference.
The key feature of this configuration is that $\alpha-\rho < 0$.
We set $\beta = 0.98$.

{\textit Technology.\/}
The Armington aggregator plays a central role here,
specifically the elasticity of substitution $1/(1-\sigma)$
between foreign and domestic intermediate goods.
A wide range of elasticities have been used in the literature.
Some earlier work used elasticities greater than one.
\citet{Colacito2011-zp,Colacito2013-yq} and \citet{Kollmann2015-sy} use an elasticity of one.
\citet[Section 3.2]{Heathcote2002-aw}, \citet[Table 1]{Tretvoll2018-dj}, and \citet[Table 3]{Tretvoll2015-lo} suggest
smaller values.
We start with an elasticity of one ($\sigma = 0$),
but consider other values, particularly when we explore the interaction
of the elasticity and the dynamics of the Pareto weight.

Given a choice of $\sigma$, we set the share parameter $\omega$ like this.
First-order conditions equate prices to marginal products:
\begin{eqnarray*}
    p_{1t} &=& c_{1t}^{1-\sigma} (1-\omega) a_{1t}^{\sigma-1} \\
    p_{2t} &=& c_{1t}^{1-\sigma} \omega b_{1t}^{\sigma-1}
\end{eqnarray*}
In a symmetric steady state with import share $s_m = b_1/(a_1 + b_1)$
and relative price $ p_{2t}/p_{1t} = 1$,
the ratio of these two equations implies
\begin{eqnarray}
    \left( \frac{1-\omega}{\omega} \right) &=& \left( \frac{1-s_m}{s_m} \right)^{1-\sigma} .
    \label{eq:share-calculation}
\end{eqnarray}
We set $s_m = 0.1$.  Given a value for $\sigma$, the import share nails down $\omega$.
One consequence of this calculation is that the parameter $\omega$ approaches one-half
as $\sigma$ approaches one (and the elasticity of substitution approaches infinity).

{\textit Shocks.}
The mean growth rate is $\log g = 0.004 $:  0.4\% per quarter.
The number comes from \citet[Table 4]{Tallarini2000-xx} and is estimated with US data.
We set the persistence parameter $\gamma$ that governs productivity dynamics equal to 0.1,
which implies an autocorrelation of $1-2\gamma = 0.8$ for $\log \wh{z}$.
\citet[Table 5]{Rabanal2011-pm} estimate $\gamma$ to be less
than 0.01, which implies significantly greater persistence.
The stochastic volatility process (\ref{eq:lom-v}) is based on \citet{Jurado2015-hy}
as described in \citet[Section 5.3]{Backus2015-yx}.


\documentclass{memoir}
\usepackage{notestemplate}

%\logo{~/School-Work/Auxiliary-Files/resources/png/logo.png}
%\institute{Rice University}
%\faculty{Faculty of Whatever Sciences}
%\department{Department of Mathematics}
%\title{Class Notes}
%\subtitle{Based on MATH xxx}
%\author{\textit{Author}\\Gabriel \textsc{Gress}}
%\supervisor{Linus \textsc{Torvalds}}
%\context{Well, I was bored...}
%\date{\today}

\begin{document}

% \maketitle

% Notes taken on 05/10/21

We can summarize our characterization thus far by a set of equivalences. The following are equivalent:
\begin{itemize}
	\item A finite field extension \(K / F\) is Galois
	\item \(\left| \textrm{Aut}(K / F) \right| = [K:F]\)
	\item \(K / F\) is the splitting field of a separable polynomial over \(F\)
	\item \(K / F\) is normal and separable
	\item \(F = K^{\textrm{Aut}(K / F)}\)
\end{itemize}

\section{Fundamental Theorem of Galois Theory}
\label{sec:fundamental_theorem_of_galois_theory}

\begin{thm}[Fundamental Theorem of Galois Theory]
	Let \(K / F\) be Galois and set \(G:= \textrm{Gal}(K / F)\). Then there exists a bijection between the subfields \(E\subset K\) with \(F\subset E\) and the subgroups \(H \leq G\) given by
\begin{align*}
	E \mapsto \textrm{Aut}(K / E)\\
	H \mapsto K^{H}
\end{align*}
and these maps are inverses of each other. Furthermore, this bijection has some additonal properties:
\begin{itemize}
	\item If \(E_1 \leftrightarrow H_1\) and \(E_2 \leftrightarrow H_2\), then \(E_1 \subset E_2 \iff H_2 \leq H_1\).
	\item If \(E \leftrightarrow H\), then \([K:E] = \left| H \right| \) and \([E:F] = [G:H]\).
	\item \(K / E\) is always Galois for \(F \subset E \subset  K\).
	\item \(E / F\) is Galois if and only if \(H \triangleleft G\). In this case, \(\textrm{Gal}(E / F) \cong G / H\).
	\item If \(E_1 \leftrightarrow H_1\) and \(E_2 \leftrightarrow H_2\), then \(E_1 \cap E_2 \leftrightarrow \langle H_1,H_2 \rangle \) and \(E_1E_2 \leftrightarrow H_1 \cap H_2\).
\end{itemize}
\end{thm}
Remember that \(H \triangleleft G\) is equivalent to \(\textrm{Aut}(K / E) \triangleleft \textrm{Aut}(K / F)\). Also recaall that \(\langle H_1,H_2 \rangle \) is the smallest subgroup of \(G\) that contains \(H_1,H_2\), and \(E_1E_2\) is the smallest subfield of \(K\) containing \(E_1,E_2\). They are not necessarily equivalent!

% Examples here

% Proof here

\vspace{5mm}

\end{document}

Abstract Algebra - Introductory/Algebra II/Notes/source/Lecture28 - FundThmGalThry.tex


\subsection{NL* Execution}
\label{sec:nl-exec}
\begin{enumerate}
  \item \begin{minipage}{0.3\textwidth}
          \begin{tabular}{c||c}
            $T_1$              & $\E$ \\
            \hline\hline
            *$\E$\footnotemark & 1    \\
            \hline\hline
            *b                 & 1    \\
            *a                 & 0    \\
          \end{tabular}
        \end{minipage} \footnotetext{Prime rows are indicated by a leading asterisk} \quad
        \begin{minipage}{0.6\textwidth}
          The table is not closed, because $row(a) = 0$ but there is no $s \in S$ such that $row(s) \subseteq 0$ . $a$ will be promoted.
        \end{minipage}

  \item \begin{minipage}{0.3\textwidth}
          \begin{tabular}{c||c}
            $T_2$ & $\E$ \\
            \hline\hline
            *$\E$ & 1    \\
            *a    & 0    \\
            \hline\hline
            *b    & 1    \\
            *ab   & 0    \\
            *aa   & 1    \\
          \end{tabular}
        \end{minipage}\quad
        \begin{minipage}{0.6\textwidth}
          $T_2$ is not consistent: $row(a) \sqsubseteq row(\E)$ but $row(a \cdot a) \not\sqsubseteq row(\E \cdot a)$. Column $a$ is going to be added because $T(a \cdot a \cdot \E) \neq row(\E \cdot a \cdot \E)$.
        \end{minipage}

  \item \begin{minipage}{0.3\textwidth}
          \begin{tabular}{c||c |c}
            $T_3$ & $\E$ & a \\
            \hline\hline
            *$\E$ & 1    & 0 \\
            *a    & 0    & 1 \\
            \hline\hline
            *b    & 1    & 1 \\
            *ab   & 0    & 0 \\
            *aa   & 1    & 1 \\
          \end{tabular}
        \end{minipage}\quad
        \begin{minipage}{0.6\textwidth}
          $T_3$ is not closed since $row(ab) = 00$ but $\nexists x \in S$ such that $x \sqsubseteq row(ab)$
        \end{minipage}

  \item \begin{minipage}{0.3\textwidth}
          \begin{tabular}{c||c |c}
            $T_4$ & $\E$ & a \\
            \hline\hline
            *$\E$ & 1    & 0 \\
            *a    & 0    & 1 \\
            *ab   & 0    & 0 \\
            \hline\hline
            b     & 1    & 1 \\
            aa    & 1    & 1 \\
            abb   & 1    & 1 \\
            *aba  & 0    & 0 \\
          \end{tabular}
        \end{minipage}\quad
        \begin{minipage}{0.6\textwidth}
          $T_4$ is not consistent: $row(ab) \sqsubseteq row(a)$ but $row(ab \cdot b) \not\sqsubseteq row(a \cdot b)$. Column $b$ is going to be added because $T(ab \cdot b \cdot \E) \neq row(a \cdot b \cdot \E)$.
        \end{minipage}

  \item \begin{minipage}{0.3\textwidth}
          \begin{tabular}{c||c |c|c}
            $T_5$ & $\E$ & a & b \\
            \hline\hline
            *$\E$ & 1    & 0 & 1 \\
            *a    & 0    & 1 & 0 \\
            *ab   & 0    & 0 & 1 \\
            \hline\hline
            b     & 1    & 1 & 1 \\
            aa    & 1    & 1 & 1 \\
            abb   & 1    & 1 & 1 \\
            *aba  & 0    & 0 & 0 \\
          \end{tabular}
        \end{minipage}\quad
        \begin{minipage}{0.6\textwidth}
          $T_5$ is not closed since $row(aba) = 000$ but $\nexists x \in S$ such that $x \sqsubseteq row(aba)$.\\
          $aba$ will be promoted.
        \end{minipage}

  \item \begin{minipage}{0.3\textwidth}
          \begin{tabular}{c||c |c|c}
            $T_6$ & $\E$ & a & b \\
            \hline\hline
            *$\E$ & 1    & 0 & 1 \\
            *a    & 0    & 1 & 0 \\
            *ab   & 0    & 0 & 1 \\
            *aba  & 0    & 0 & 0 \\
            \hline\hline
            b     & 1    & 1 & 1 \\
            aa    & 1    & 1 & 1 \\
            abb   & 1    & 1 & 1 \\
            *abab & 0    & 0 & 0 \\
            *abaa & 0    & 0 & 0 \\
          \end{tabular}
        \end{minipage}\quad
        \begin{minipage}{0.6\textwidth}
          $T_6$ is closed and consistent.\\
          The conjecture will be sent.
        \end{minipage}

  \item \begin{minipage}{0.3\textwidth}
          \input{sections/automata/NL_aut1.tex}
        \end{minipage}\quad\\
        \begin{minipage}{1\textwidth}
          Construction of this automaton:
          \begin{enumerate}
            \item $Q = {101,010,001,000}$ which are the Prime rows in $S$;
            \item $Q_I = {101,001,000}$ which are all the rows that are covered by $row(\E)$;
            \item $F = {101}$ which is the only prime row having a $1$ in the column of $\E$;
            \item Transitions are more complicated to analyze, we will only describe those starting from the state $101$. We have $row(\E) = 101$ and we have to calculate the transition when reading:
                  \begin{enumerate}
                    \item $a \rightarrow row(\E \cdot a) = 010$ and the set of rows that are covered by $010$ is ${010, 000}$, so we draw two transitions labelled with $a$ from $101$ to $010$ and to $000$;
                    \item $b \rightarrow row(\E \cdot b) = 111$ and the set of rows that are covered by $111$ is ${010, 000, 101, 001}$, so we draw four transitions labelled with $a$ from $101$ to $010$, $000$, $101$ and $001$.
                  \end{enumerate}
          \end{enumerate}
          Moreover, this automaton recognizes precisely the language proposed by the Teacher, so the algorithm can stop.
        \end{minipage}
\end{enumerate}


\section{The \rotatei algorithm}
\Label{sec:rotatei}

The algorithm \rotatei is an \emph{in-place} variant of the algorithm \specref{rotatecopy}.
We have modified the generic specification of \rotatei \cite[\S 28.6.11]{cxx-17-draft}
such that it refers to a range of objects of \valuetype.
%
The signature now reads:

\begin{lstlisting}[style=acsl-block]

  size_type rotate(const value_type* a, size_type m, size_type n);
\end{lstlisting}

\subsection{Formal specification of \rotatei}

Figure~\ref{fig:rotate} shows informally the behavior of \rotatei.
The figure is of course very similar to the one for
\rotatecopy (see Figure~\ref{fig:rotatecopy}).
The notable difference is that \rotatei operates \emph{in place} of the array
\inl{a[0..n-1]}.

\begin{figure}[hbt]
\centering
\includegraphics[width=0.75\textwidth]{Figures/rotate.pdf}
\caption{\Label{fig:rotate} Effects of \rotatei}
\end{figure}

The specification of \rotatei is shown in the following listing.

\input{Listings/rotate.h.tex}

\subsection{Implementation of \rotatei}

The following listing shows an implementation of the \rotatei function
together with several \acsl annotations.
Actually, there are several ways to implement \rotatei.
We have chosen a particularly simple one that is derived from an implementation of
\inl{std::rotate} for \emph{bidirectional iterators} \cite[\S 27.2.6]{cxx-17-draft}
and which essentially consists of several calls to the algorithm~\specref{reverse}.

Note the statement contract of the final call of \specref{reverse}.
Here we use both the labels~\inl{Pre} and~\inl{Old} which refer
to the pre-states of~\reverse and the function \rotatei itself, respectively.

\input{Listings/rotate.c.tex}

\clearpage


\subsection{Sine and Cosine}

% Sin
\input{./laplaceTransforms/derivations/sin.tex}
% Cos
\input{./laplaceTransforms/derivations/cos.tex}


As early as 1964, Goffman~\cite{goffman64OnRelevanceAsAMeasure}, a
mathematical information science pioneer \cite{harmon08RememberingWG},
notes that the relevance of documents in a list has to depend on the
documents preceding it.  More recently, work on
MMR~\cite{carbonell98MMR} was one of the first to formalize
diversification as a mathematical optimization criterion; MMR has
proved one of the most popular diversity approaches.  Aside from this
work, two of the other notable works are~\cite{yue081224Predicting},
which formalizes a structured SVM loss function based on a set
covering objective, and~\cite{wang09PortfolioTheory}, which borrows
concepts from portfolio theory in economics to treat result set
diversification as optimization of a risk minimization objective.  We
note that the results as derived in the last section formally motivates these and others somewhat ad-hoc diversification approaches and we discuss
these connections more deeply in the following sections.

%\subsection{MMR}
%
%The result in~\eqref{eq:1call} is strikingly similar to MMR --- it
%contains two terms, one for query similarity and the other for result
%set diversification, where each term represents a similarity kernel
%--- more specifically a \emph{probability product kernel}
%(PPK)~\cite{prodprobkernel} that is an inner product of probability
%vectors (or more generally, functions).  More formally, let
%$\vec{T}'$, $\vec{T}_k$, and $\vec{T}_{S_{k-1}^*}$ be respective topic
%probability vectors $P(t'=t|\vec{q})$, $P(t_k=t|s_k)$ and
%$\tilde{P}(t_k=t | S_{k-1}^*)$ with vector indices for each topic $t
%\in T$.  Then the similarity and diversity terms from~\eqref{eq:1call}
%can be respectively written as
%\begin{align}
%%\Sim_1(\vec{q},s_k) = & \hspace{-3mm}
%\sum_{t \in T} P(t'=t|\vec{q}) P(t_k=t|s_{k}) & \; = \; \langle \vec{T}',\vec{T}_k \rangle \label{eq:sim_term} \; \mbox{and}\\
%%\Sim_2(s_k,S_{k-1}) = & \hspace{-3mm}
%\sum_{t \in T} P(t|\vec{q}) P(t_k=t|s_k) \tilde{P}(t | S_{k-1}^*) & \; = \; \langle \vec{T}_k, \vec{T}_{S_{k-1}^*} \rangle_{\vec{T}'}. \label{eq:div_term}
%\end{align}
%Here, we let $\langle \cdot,\cdot \rangle$ denote an inner product of
%two vectors and $\langle \cdot,\cdot \rangle_\vec{v}$ a
%\emph{$\vec{v}$-reweighted} inner product, defined as
%in~\eqref{eq:div_term}.
%
%While having similarity and diversity terms similar to MMR,
%Exp-$1$-call@$k$ in~\eqref{eq:1call} clearly differs from MMR:
%\begin{enumerate}
%\item While MMR's definition allows for any similarity function, not
%just PPKs, we note that \emph{equating words to subtopics}, popular
%kernels like TF and TFIDF~\cite{salton83Introduction} can be viewed
%directly as PPKs if the TF and TFIDF vectors are $L_1$ normalized to
%represent probability vectors.
%\item MMR uses a maximization term for
%diversity, whereas optimization of Exp-$1$-call@$k$ instead calls for
%a product (noisy-or) diversity term $\tilde{P}(t | S_{k-1}^*)$.
%We note that a noisy-or reduces to a max when the subtopic
%probabilities are deterministic (0 or 1).
%\item While MMR proposes a $\lambda$ term to explicitly
%trade off the similarity and diversity terms, the greedy optimization
%of Exp-$1$-call@$k$ in~\eqref{eq:1call} yields no such trade-off term
%(or alternately, an implicit $\lambda=.5$).  Although it seems a tunable
%$\lambda$ is not needed for maximizing Exp-$1$-call@$k$, it may be
%desirable when maximizing surrogate retrieval objectives (e.g., ranking
%objectives).
%\item Optimizing Exp-$1$-call@$k$ introduces query-specific relevance into
%the diversification term as shown
%by the query topic ($\vec{T}'$) reweighted
%diversity function in~\eqref{eq:div_term}.
%\end{enumerate}
%
%%To verify whether the differences between MMR and Exp-$1$-call@$k$
%%matter empirically, we compare the two algorithms across a number of
%%metrics on three diversity testbeds: the TREC 6-8 Interactive
%%Track\footnotemark[1] (17 queries) and 2009 and 2010 ClueWeb Diversity
%%tasks of the TREC Web Track\footnotemark[2] (50 queries each).  On
%%these testbeds, we evaluate \emph{mean subtopic
%%recall@$k$}~\cite{zhai03Beyond} (fraction of total annotated
%%aspects/subtopics covered by a result set at rank $k$, averaged over
%%queries), which is an appropriate loss function for the
%%\emph{set-level} metric~\eqref{eq:setRelevance}~\cite{chen06Less}.  We
%%also evaluate a variety of more recent \emph{rank-based} diversity evaluation
%%metrics such as intent-aware expected reciprocal rank
%%(ERR-IA@$k$)~\cite{err-ia}, $\alpha$-nDCG@$k$~\cite{clarke08Novelty},
%%and intent-aware mean average precision
%%(MAP-IA)~\cite{agrawal09diversifying}.
%%
%%We use MMR with $\lambda = 0.5$ to match the equal weighting of
%%similarity and diversity in Exp-$1$-call@$k$.  An
%%LDA~\cite{blei03Latent} topic model is trained on the top-100 OKAPI
%%BM25~\cite{bm25} results for each query (on its respective collection)
%%and these subtopic distributions are used for the similarity and
%%diversity kernels in both algorithms: for MMR we choose $\Sim_1$ and
%%$\Sim_2$ kernels as in~\eqref{eq:sim_term} --- effectively LDA
%%variants of latent semantic indexing (LSI)~\cite{deerwester90LSA}
%%kernels; for Exp-$1$-call@$k$, we use the similarity and diversity
%%kernels respectively defined in~\eqref{eq:sim_term}
%%and~\eqref{eq:div_term}.  Both MMR and Exp-$1$-call@$k$ are used to
%%rank the top-20 documents from the top-100 OKAPI BM25 results.
%%
%%Results in Table~\ref{table:different_metrics} and
%%Figure~\ref{fig:mmr_vs_1call} show the performances of MMR and
%%Exp-$1$-call@$k$ on the three diversity testbeds across various
%%diversity measures; although there are minor performance differences,
%%we note that these differences are not statistically significant
%%w.r.t.\ 95\% confidence intervals.  Nonetheless, the results appear to
%%indicate that the structural similarities in the use of MMR and the
%%optimization of Exp-$1$-call@$k$ outweigh the differences in this
%%evaluation.
%
\subsection{Relations of Exp-$1$-call@$k$ and Other Diversification Approaches}

Recent years have seen numerous proposals for diversification
approaches and here we summarize the relationship between optimization
of Exp-$1$-call@$k$ and representatives of these alternative
approaches:

\subsubsection{Diversifying Search Results}
\cite{agrawal09diversifying} proposes a set-based objective function
to answer ambiguous web queries in a setting where there exists a predefined taxonomy of information, and that both queries and documents
may belong to more than one category according to this taxonomy. The proposed set-based objective function aims at maximizing the probability that the average user finds at least one useful resulting document retrieved within the top $k$ results. Mathematically, this objective function (a.k.a., IA-Select) is defined below:
\begin{align}
	P(S|\vec{q}) = \sum_{c} P(c|\vec{q}) \left( 1 - \prod_{s\in S}(1-V(s| q, c))\right)
\label{eq:diversifykObjectiveFunction}
\end{align}
where $S$ is a set of documents, and $V(s|q, c)$ broadly defines the likelihood that a document $s$ satisfies the query $\vec{q}$ given the taxonomy (or category) $c$ of the query and the document. Note first that we have slightly adapted notations in the above equation for consistency, and note also that the taxonomy of $c$ given the query and document is not learnt by some unsupervised model, but hand-crafted.

Now we show that our expected 1-call@$k$ objective in Equation~\eqref{eq:setRelevance} is equivalent to the objective function in Equation \eqref{eq:diversifykObjectiveFunction} by simply writing out the mathematical expectation in terms of the sum over all possible topics (e.g., taxomony in \cite{agrawal09diversifying}) the weighted relevance where weights are the topic distributions below
\begin{align*}
    \ExpOneCall(S_k,\vec{q}) & = \mathbb{E} \left[\left. \bigvee_{i=1}^{k}r_i=1 \right| s_{1},\dots, s_{k},\vec{q} \right], \\
    												 & = \sum_{t\in T} P(t|\vec{q}) \left( 1 - \prod_{i=1}^{k}(1-p(t_i = t| q, s_i))\right)
\end{align*}
Clearly our proposed objective is equivalent to the objective Equation~\eqref{eq:diversifykObjectiveFunction} proposed in \cite{agrawal09diversifying} when one replaces the likelihood function $V(s|\vec{q}, c)$ by $p(t_i = t| \vec{q}, s_i)$. More recently, Vargas et al~\cite{Vargas:SIGIR2012} propose variants of IA-Select by introducing several interesting formal probabilistic relevance models to instantiate $V(s| q, c)$, which are more appopriate in modeling the relevance in a probabilistic framework. Furthermore, \cite{Vallet:SIGIR2012} propose to introduce a user as an explicit random variable in state of the art diversification methods, thus developing a generalized framework for personalized diversification.

Another recent interesting instantiation of $V(s|q,c)$ is proposed in \cite{Zuccon:ECIR2012} motivated by the facilitation location problem~\cite{Gonzalez:Handbook2007} taken from Operation Research: for a set of customer ``locations" $D$, one aims at choosing a subset $S$ in $D$ to open $k$ ``facilities" that optimize a graph-theoretic objective that depends on the cost of opening a facility at each location and also the distance between each pair of locations. However all of the three described methods do not derive their objective functions from the expected 1-call@$k$ objective as we have achieved.

\subsubsection{Portfolio Theory}
\cite{wang09PortfolioTheory} motivates
diversification in set-based information retrieval by a
risk-minimizing portfolio selection approach.  Viewing a result set as
an investment portfolio with the objective to maximize return while
minimizing risk, the derived result of~\cite{wang09PortfolioTheory}
mimics both MMR and Exp-$1$-call@$k$ in that the similarity term may
be viewed as \emph{expected portfolio payoff} (relevance) and the
diversity term may be viewed as \emph{expected portfolio risk}, which
increases as the correlations between documents in the result set
increase. Note that diversification based on portfolio theory is extended in \cite{Shi:SIGIR2012} by introducing latent factors for collaborative filtering tasks. One major difference in the framework~\cite{wang09PortfolioTheory} is that rather than
computing the diversity term via a max (MMR) or product
(Exp-$1$-call@$k$) the portfolio theory derivation uses a summation
--- we examine the implications of this next.

\subsubsection{Set Covering:}
Yue and Joachims~\cite{yue081224Predicting} propose a set covering
approach for training SVMs to predict diverse result sets for
information retrieval.  In their work, they equate subtopics with
words and build a loss function for SVM training that penalizes
result sets according to the sum of weights of query-relevant words
\emph{not} covered by the result set.  While their approach provides a
``hard'' set-covering view of diversity, we note that an expansion of
$\tilde{P}(t | S_{k-1}^*)$ used in the diversity term
of~\eqref{eq:1call} provides a ``soft'' latent set-covering
interpretation; that is, $s_k$ is chosen so as to best cover (in a
probabilistic sense) the latent topic space not already covered by $\{
s_1^*,\ldots,s_{k-1}^* \}$.  Formally, expanding the product in
$\tilde{P}(t | S_{k-1}^*) = \prod_{i=1}^{k-1} \left(1 -
P(t_{i}=t|s_{i}^{*})\right)$, collecting terms and writing it as a
series, we arrive at a form that reflects the inclusion-exclusion
principle applied to the calculation of probability that topic $t$ is
covered by $\{ s_1^*,\ldots,s_{k-1}^* \}$:
\begin{align}
& \prod_{i=1}^{k-1} \left(1 - P(t_{i}=t|s_{i}^{*})\right) \nonumber \\
& = 1 - \left[ \sum_{i=1}^{k-1} P(t_{i}= t|s_{i}^{*}) - \sum_{i=1}^{k-1}\sum_{j=1}^{k-1}P(t_{i}= t|s_{i}^{*})P(t_{j}= t|s_{j}^{*}) + \dots - (-1)^{k-1}\prod_{i=1}^{k-1}P(t_{i}=t|s_{i}^{*})\right] \label{eq:setcover}
\end{align}

This result has a natural interpretation: the first summation term
determines the coverage of topic $t$ by each document $s_i$ ($1 \leq i
\leq k-1$) currently in the result set, the second double summation
term corrects the first term by removing the joint probability mass
from all pairs of documents that was double counted, and so on
according to the principle of inclusion-exclusion.
\eqref{eq:setcover} not only provides a probabilistic set covering
view of Exp-$1$-call@$k$, but it also suggests that a portfolio
approach to diversity using only the first summation would overcount
each document's contribution to the diversity metric according to this
set covering perspective.

The inclusion-exclusion principle calculation provided by the second term in Equation~\ref{eq:setcover}
is illustrated in~Figure~\ref{fig:inclusionExclusionPrinciple}. In words, this term is calculating the total topic probability coverage of $t$ by all
selected items $\{ s_1^*,\ldots,s_{k-1}^* \}$ by properly applying the
inclusion-exclusion principle to ensure that overlapping probability coverage
is not double counted. Then referring back to Equation~\ref{eq:partial_simp}, we note that $s_k$ is chosen by maximizing a weighted
sum over topics, where each topic weight is determined by its relevance
to the query $\vec{q}$, the item $s_k$, and penalized (i.e., due to the $1 - $)
by the topic coverage of $t$ by the set $\{ s_1^*,\ldots,s_{k-1}^* \}$ to
naturally encourage diversity.  We note that this is a soft probabilistic
version of the ``in or out'' topic coverage approach of WSL.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[t!]
\begin{center}
\centerline{\includegraphics[scale = 0.4]{inclusionExclusionPrinciple}}
\caption[Inclusion-exclusion principle.]{Inclusion-exclusion principle. The sets represent candidate
items $s$ for a query, and the area covered by each set is the
``information" covered by that item for query topic $t$. Numbers on different areas
indicates the number of sets that share these areas. }
\label{fig:inclusionExclusionPrinciple}
\end{center}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\subsubsection{Subtopic Relevance Models}
We use a subtopic relevance
model that is a simplified version of the model in~\cite{plmmr} with
fewer dependence assumptions.  In other work, Zhai {\it et
al}~\cite{zhai03Beyond} present an empirical risk minimization view of
dependent document retrieval from a subtopic perspective,
where they derive a formalization of the
\emph{greedy} selection step that is similar to MMR and to a lesser
extent, Exp-$1$-call@$k$.

\subsubsection{Set-based Relevance Objectives}
Chen and Karger~\cite{chen06Less}, whose derivation we extended, directly
optimize $1$-call@$k$, but their intention is not to formalize MMR and
instead use na\"{i}ve Bayes to directly evaluate
\eqref{eq.ncall}.  Agrawal et al~\cite{agrawal09diversifying}
and Santos et al (xQuad)~\cite{santos2010xquad} both specify set-based
diversity metrics \emph{very} similar to Exp-$1$-call@$k$ but do not provide
formal derivations as we have done in this work.

\subsubsection{Ranking Based Objectives}
Finally, returning to our introductory motivation, Wang and Zhu~\cite{wangzhu10} have shown that
natural forms of result set diversification arise via the optimization
of average precision~\cite{ap} and reciprocal rank~\cite{mrr}.  Both
of these methods share the view of directly optimizing a
\emph{ranking-based} objective, whereas this paper proposes a novel
derivation from the alternate view of optimizing a \emph{set-based}
objective w.r.t.\ a subtopic model of relevance.  However, even though
Exp-$1$-call@$k$ is a set-based objective, an indirect consequence of
(and motivation for) greedily optimizing it is that documents added
earlier yield a greater increase in objective than those added later;
this yields a natural rank ordering on the greedy Exp-$1$-call@$k$
result set.

\subsection{Four Aspects of Diversifying Approaches}
As the last part of the related work, we identify four key aspects for a diversifying approach and categorize existing approaches against these categories in Table~\ref{table:comparisonAlgorithms}. Specifically, we breakdown the
different proposals according to whether they are probabilistic, use
latent models for determining similarity, use adaptive learning
techniques, and finally whether they are unsupervised, i.e., they do
not require labeled data or feedback. We note that our model is the first
proposal (that we are aware of) to combine all four traits in the
affirmative.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{table}[htbp!]
\tbl{Dimensions of diversified set-based retrieval
systems: \emph{Probabilistic}: uses probabilistic models?; \emph{Latent}: use
latent topic models?; \emph{Learning}: uses some form of learning?;
\emph{Unsupervised}: does not require labeled topic data or feedback?}{
\begin{tabular}{lcccc}
\hline
Diversity Paper                                    &Probabilistic&  Latent & Learning & Unsupervise  \\
\hline
Carbonell \cite{carbonell98MMR}                    &             &         &         & $\surd$\\
Anagnostop \cite{anagnostopoulos05245Sampling}		 & $\surd$     &         &         & $\surd$\\
Radlinski \cite{radlinski06691Improving}           &             &         &         & $\surd$\\
Radlinski \cite{radlinski08LearningDiverse}        & $\surd$     &         & $\surd$ & \\
Clarke \cite{clarke08Novelty}                      & $\surd$     &$\surd$  &         & $\surd$\\
Yue \cite{yue081224Predicting}                     &             &$\surd$  & $\surd$ & \\
Bai \cite{bai08Adapting}                           &             &         & $\surd$ & $\surd$\\
Sanderson \cite{sanderson08Ambiguous}              &             &         &         & $\surd$\\
Yu \cite{yu09368}                                  &             &         &         & $\surd$\\
Agrawal \cite{agrawal09diversifying}               & $\surd$     & $\surd$ &         & $\surd$\\
Gollapudi \cite{gollapudi09AnAxiomatic}            &             &         &         & $\surd$\\
Clough \cite{clough09734Multiple}                  & $\surd$     &         &         & $\surd$\\
Song \cite{song09Identification}                   & $\surd$     &         & $\surd$ & \\
Wang \cite{wang09PortfolioTheory}                  &             & $\surd$ &         & $\surd$\\
Neal \cite{lathia10TemporalDiversity}              &             &         &         & \\
Zhao \cite{Zhao:SIGIR2012}                         &             &         &         & \\
Dang \cite{Dang:SIGIR2012}                         & $\surd$     & $\surd$ &         & $\surd$ \\
Vargas \cite{Vargas:SIGIR2012}										 & $\surd$     &         & $\surd$ & $\surd$    \\
Our model (this paper)                             & $\surd$     & $\surd$ & $\surd$ & $\surd$ \\
\hline
\end{tabular}}
\label{table:comparisonAlgorithms}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\subsection{Temporal Diversification in Recommender Systems}
%Another closely related line of study on diversification applies into recommender systems, thus we discuss these approaches here.
%\subsubsection{Static Diversification in Recommender Systems}
%
%\subsubsection{Temporal Diversification in Recommender Systems}


\documentclass{article}

\input{../header.tex}

\begin{document}

It might be more accurate for the Coulomb term in the SEMF to be proportional to \(Z(Z-1)\), since, modeling the protons as point particles, the proper expression for the energy would be:

\begin{equation} \label{eq:SEMF-coulomb-correction}
    U = \frac{e^2}{4 \pi \varepsilon_0} \sum _{i=1}   ^{Z} \sum _{j<i} \frac{1}{\abs{r_i - r_j} }  \propto \frac{Z(Z-1)}{\abs{\overline{r} } }  \propto \frac{Z(Z-1)}{A^{1/3}}
\end{equation}

where \(\overline{r} \) is the average distance between the protons in the nucleus. We do not know what its expression looks like, but surely \(\overline{r} \propto r _{\text{nucleus}}  \propto A^{1/3}\).

\paragraph{Specular nuclei}

They are pairs of nuclei with odd \(A\) and \(Z\)s equal to \((A \pm 1)/2\).

The only term which changes in the SEMF between them is the Coulomb, therefore (using the modified Coulomb term given in \eqref{eq:SEMF-coulomb-correction}) their difference in energy is given by

\begin{subequations}
\begin{align}
  \Delta B  &= \frac{a_C}{A^{1/3}} \qty(\frac{(A+1)(A-1)}{4} - \frac{(A-1)(A-3)}{4})  \\
  &= \frac{a_C}{A^{1/3}} \qty(\frac{4A -4}{4})  \\
  &= a_C \qty(A^{2/3} - A^{-1/3})
\end{align}
\end{subequations}

With the Coulomb term which models the nucleus as a uniformly charged sphere, \(a_C Z^2 A^{-1/3}\), we get \(\Delta B = a_C A^{2/3}\) instead.

We can plot the data for \(\Delta B\) wrt \(x \defeq A^{2/3}\). The plot will be of the form

\begin{equation} \label{eq:delta-B-options}
    \Delta B  = a_C x - \frac{a_C}{\sqrt{x}} \qquad \text{or} \qquad \Delta B = a_C x
\end{equation}

We fit the two options given in equation \eqref{eq:delta-B-options}: the results are shown in figure \ref{fig:odd-A-fit}.

\begin{figure}[H]
    \centering
    \begin{subfigure}{0.5\textwidth}
        \includegraphics[width=\textwidth]{figures/odd_A_fit.pdf}
        \caption{Fit}
    \end{subfigure}%
    \begin{subfigure}{0.5\textwidth}
        \includegraphics[width=\textwidth]{figures/odd_A_residuals.pdf}
        \caption{Residuals}
    \end{subfigure}%
    \caption{Fit of the difference in \(B\) between symmetric nuclei. The chi square is \(\SI{0.136}{MeV^2} \) for the \(Z^2\) model, and \(\SI{0.062}{MeV^2}\) for the \(Z(Z-1)\) model.}
    \label{fig:odd-A-fit}
\end{figure}

The fit gives us \(a_C = \SI{631(5)}{keV}\) in the new parametrization (the error is only indicative, as I did not have errorbars for the binding energies).

\begin{flushright}
    Jacopo Tissino, 21 june 2019
\end{flushright}

\end{document}


\documentclass[twocolumn, a4paper]{article}

\RequirePackage[a4paper,bindingoffset=0.0cm,vcentering=true,%
top=2.5cm,bottom=2.5cm,left=3.0cm,right=3.0cm]{geometry}

\usepackage[latin1]{inputenc}
\usepackage{amsmath,amssymb}
\usepackage[hidelinks]{hyperref}
\usepackage{../macros}

\title{Cheatsheet for the \textit{macros.sty} file}
\begin{document}
	\maketitle

	Import the \textit{macros.sty} files with $\backslash$usepackage\{macros\} and use the commands in this cheatsheet.

	\section{Operations}
	\begin{itemize}
	\item $\backslash$vect\{x\} -- $\vect{x}$
	\item $\backslash$Diag\{x\} -- $\Diag{x}$
	\item $\backslash$diag\{x\} -- $\diag{x}$
	\item $\backslash$rank\{x\} -- $\rank{x}$
	\item $\backslash$spark\{x\} -- $\spark{x}$
	\item $\backslash$card\{x\} -- $\card{x}$
	\item $\backslash$trace\{x\} -- $\trace{x}$
	\item $\backslash$supp\{x\} -- $\supp{x}$
	\item $\backslash$expval\{x\} -- $\expval{x}$
	\item $\backslash$cov\{x\} -- $\cov{x}$
	\item $\backslash$prob\{x\} -- $\prob{x}$
	\item $\backslash$var\{x\} -- $\var{x}$
	\item $\backslash$`lpf\{x\} -- $\lpf{x}$
	\end{itemize}

	\section{Most Common Sets}
	\begin{itemize}
		\item $\backslash$Rset -- $\Rset$
		\item $\backslash$Cset -- $\Cset$
		\item $\backslash$Nset -- $\Nset$
		\item $\backslash$Zset -- $\Zset$
		\item $\backslash$Qset -- $\Qset$
		\item $\backslash$Dset -- $\Dset$
	\end{itemize}
	\section{Trigonometry}
	\begin{itemize}
		\item $\backslash$cos(x)-- $\cos(x)$
		\item $\backslash$cosh -- $\cosh$
		\item $\backslash$sen -- $\sen$
		\item $\backslash$senh -- $\senh$
		\item $\backslash$tg -- $\tg$
		\item $\backslash$tgh -- $\tgh$
		\item $\backslash$ctg -- $\ctg$
		\item $\backslash$ctgh -- $\ctgh$
	\end{itemize}

	\section{mathrm}
	'Normal' text in math envinroment.
	\begin{itemize}
		\item $\backslash$arm -- $\arm$
		\item $\backslash$zrm -- $\zrm$
		\item $\backslash$Arm -- $\Arm$
		\item $\backslash$Zrm -- $\Zrm$
	\end{itemize}

	\section{mathcal}
	Calligraphic font.
	\begin{itemize}
		\item $\backslash$Arm -- $\Acal$
		\item $\backslash$Zrm -- $\Zcal$
	\end{itemize}

	\section{mathsf}
	Sans serif.
	\begin{itemize}
		\item $\backslash$arm -- $\asf$
		\item $\backslash$zrm -- $\zsf$
		\item $\backslash$Arm -- $\Asf$
		\item $\backslash$Zrm -- $\Zsf$
	\end{itemize}

	\section{mathbf}
	Bold face.
	\begin{itemize}
		\item $\backslash$abf -- $\abf$
		\item $\backslash$zbf -- $\zbf$
		\item $\backslash$Abf -- $\Abf$
		\item $\backslash$Zbf -- $\Zbf$
	\end{itemize}

	\section{boldsymbol}
	Bold symbol.
	\begin{itemize}
		\item $\backslash$abs -- $\abs$
		\item $\backslash$zbs -- $\zbs$
		\item $\backslash$Abs -- $\Abs$
		\item $\backslash$Zbs -- $\Zbs$
	\end{itemize}

	\section{Tilde}
	Tilde
	\begin{itemize}
		\item $\backslash$atil -- $\atil$
		\item $\backslash$ztil -- $\ztil$
		\item $\backslash$Atil -- $\Atil$
		\item $\backslash$Ztil -- $\Ztil$
	\end{itemize}

	\section{tilde + mathbf}
	Tilde + Bold face.
	\begin{itemize}
		\item $\backslash$abftil -- $\abftil$
		\item $\backslash$zbftil -- $\zbftil$
		\item $\backslash$Abftil -- $\Abftil$
		\item $\backslash$Zbftil -- $\Zbftil$
	\end{itemize}

	\section{tilde + mathbf}
	Tilde + mathbf.
	\begin{itemize}
		\item $\backslash$abft -- $\abft$
		\item $\backslash$zbft -- $\zbft$
		\item $\backslash$Abft -- $\Abft$
		\item $\backslash$Zbft -- $\Zbft$
	\end{itemize}

	\section{Hat}
	Hat.
	\begin{itemize}
		\item $\backslash$ahat -- $\ahat$
		\item $\backslash$zhat -- $\zhat$
		\item $\backslash$Ahat -- $\Ahat$
		\item $\backslash$Zhat -- $\Zhat$
	\end{itemize}

	\section{Hat + mathbf}
	Hat + bold face.
	\begin{itemize}
		\item $\backslash$abfh -- $\abfh$
		\item $\backslash$zbfh -- $\zbfh$
		\item $\backslash$Abfh -- $\Abfh$
		\item $\backslash$Zbfh -- $\Zbfh$
	\end{itemize}

	\section{hat + boldsymbol}
	Hat + Bold symbol.
	\begin{itemize}
		\item $\backslash$absh -- $\absh$
		\item $\backslash$zbsh -- $\zbsh$
		\item $\backslash$Absh -- $\Absh$
		\item $\backslash$Zbsh -- $\Zbsh$
	\end{itemize}

	\section{Ring}
	Ring.
	\begin{itemize}
		\item $\backslash$aring -- $\aring$
		\item $\backslash$zring -- $\zring$
		\item $\backslash$Aring -- $\Aring$
		\item $\backslash$Zring -- $\Zring$
	\end{itemize}

	\section{Ring + mathbf}
	Ring + bold face.
	\begin{itemize}
		\item $\backslash$aringbf -- $\aringbf$
		\item $\backslash$zringbf -- $\zringbf$
		\item $\backslash$Aringbf -- $\Aringbf$
		\item $\backslash$Zringbf -- $\Zringbf$
	\end{itemize}

	\section{Greek letter + bold symbols}
	\begin{itemize}
		\item $\backslash$Phibf -- $\Phibf$
		\item $\backslash$Lambdabf -- $\Lambdabf$
		\item $\backslash$Deltabf -- $\Deltabf$
		\item $\backslash$alphabf -- $\alphabf$
		\item $\backslash$betabf -- $\betabf$
		\item $\backslash$gammabf -- $\gammabf$
		\item $\backslash$deltabf -- $\deltabf$
		\item $\backslash$epsilonbf -- $\epsilonbf$
		\item $\backslash$etabf -- $\etabf$
		\item $\backslash$thetabf -- $\thetabf$
		\item $\backslash$varthetabf -- $\varthetabf$
		\item $\backslash$iotabf -- $\iotabf$
		\item $\backslash$kappabf -- $\kappabf$
		\item $\backslash$lambdabf -- $\lambdabf$
		\item $\backslash$mubf -- $\mubf$
		\item $\backslash$nubf -- $\nubf$
		\item $\backslash$xibf -- $\xibf$
		\item $\backslash$oobf -- $\oobf$
		\item $\backslash$pibf -- $\pibf$
		\item $\backslash$varpibf -- $\varpibf$
		\item $\backslash$taubf -- $\taubf$
		\item $\backslash$upsilonbf -- $\upsilonbf$
		\item $\backslash$phibf -- $\phibf$
		\item $\backslash$chibf -- $\chibf$
		\item $\backslash$psibf -- $\psibf$
		\item $\backslash$omegabf -- $\omegabf$
		\item $\backslash$Pibf -- $\Pibf$
		\item $\backslash$Sigmabf -- $\Sigmabf$

	\end{itemize}

\end{document}


\documentclass[11pt,a4paper]{article}
\usepackage[colorlinks,
pdfauthor="Len Thomas",
pdftitle="MT4113 Lecture notes"]{hyperref}
\usepackage[a4paper,margin=2cm,footskip=.5cm]{geometry}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{epsf,graphics,graphicx,fancyhdr,color,amsmath,url,enumerate,alltt}

\begin{document}

\section*{MT4113 Lecture 4 Computer arithmetic\\Solutions to practice questions}

\begin{enumerate}
    \item Write out -15-3=-18 in binary using an 8-bit signed integer system
\begin{verbatim}  -15 10001111
-  +3 00000011
= -18 10010010
\end{verbatim}
    \item What is the largest positive number that can be represented in this system?\\ \\
\texttt{01111111 = 127}
    \item Why is it very fast to multiply numbers represented as integers by 2?  What manipulation is required to the bits making up the number to achieve this operation?\\

\texttt{The computer just needs to shift the bits to the left (apart from the sign bit and the most significant digit -- if the latter is already 1 then you get an overflow), and put a 0 in the least significant digit bit}

    \item What is the machine epsilon on a 32-bit floating point system where 1 bit is for the sign, 16 bits for the exponent and 16 bits\footnote{using the same trick as in the IEEE standard to get one extra bit for free; note that this is not a very sensible allocation as it gives far too much of the space to the exponent} for the fraction?\\

\texttt{epsilon = $2^{(1-d)}=2^{(-15)}$}

    \item In this system, what would be the result of computing $2* 2^{-17} + 1$?\\

\texttt{$2\times2^{-17} = 1\times2{^-16}$.  This is below the machine epsilon so the result would be 1.}

    \item What do you get if you compute $512 * 0.25$ in the above floating point system, and then convert it into the above signed integer system?\footnote{A calculation like this once cost the EU space program about \$500 million: \href{https://www.ima.umn.edu/~arnold/disasters/ariane.html}{https://www.ima.umn.edu/$\sim$arnold/disasters/ariane.html}}\\

\texttt{$512 \times 0.25$ is easily evaluated exactly in the floating point system, giving 128.  This is larger than the largest integer, however, so you'd get an overflow}

\end{enumerate}

\end{document}


\chapter{Problem Formalization}

\section{Input Data}

\subsubsection{Notes}
\begin{itemize}
    \item The geographical information will be loaded in the form of a map, obtained in OpenStreetMap and converted to a graph
    \item The words 'street', 'road' and 'way' are used interchangeably
    \item The words 'node' and 'vertex' ('nodes' and 'vertices') are used interchangeably
    \item The words 'range' and 'autonomy' are used interchangeably
    \irem The words 'route' and 'itinerary' are used interchangeably
\end{itemize}

\subsubsection{Graph}
\paragraph{G = (N, E)} - weighted directed (roads may be one way only) graph that represents the map. It is composed by Nodes and Edges
\begin{itemize}

	\item N - set of Nodes (a node represents an \uline{\textit{interest point}} or simply a point in the road network) (N(i) is the ith element). For each node:
\begin{itemize}
	\item Adj - edges whose origin is N(i)
	\item lat - the latitude of the point it represents in the map
	\item long - the longitude of the point it represents in the map
\end{itemize}

	\item A - set of Edges (an edge represents a way/street/road) (E(i) is the ith element). For each edge:
\begin{itemize}
	\item w - weight (represents the length of the way) (measured in meters)
	\item dest - origin node of the edge
	\item orig - destination node of the edge
\end{itemize}

\end{itemize}

\uline{Interest Points} (special nodes)
\begin{itemize}
	\item base - base/garage of the company
	\item rp - recharge points
	\item pup - pick up point
	\item dp - delivery point
\end{itemize}

\subsubsection{Vehicles}
\paragraph{V} - set of vehicles that make the fleet of the company (Ve(i) is the ith element). For each vehicle:
\begin{itemize}
	\item range - current range of the vehicle (in meters)
	\item license-plate - plate that identifies the car
\end{itemize}

\subsubsection{Orders}
\paragraph{O} - set of orders for the day (O(i) is the ith element). For each order:
\begin{itemize}
    \item pup - pick up point
	\item dp - delivery point
	\item orderID - id that represents the order
\end{itemize}

\section{Output Data}
Each vehicle is assigned a \textit{path} that represents the best sequence of nodes for the orders \textit{Ov} he's been assigned to. The path and orders are distributed taking to account the optimization of the distance travelled and the range of each vehicle at any given time.
For each Vehicle V(i):
\begin{itemize}
	\item path - sequence of nodes that represents the path to be taken by a vehicle on a day (path(i) is the ith element). Path has to be connected and finish on the starting point.
	\item Ov - set of orders assigned to the vehicle (Ov(i) is the ith element)
\end{itemize}

\section{Restrictions}

\subsection{Input Restrictions}

\subsubsection{General}
\begin{itemize}
    \item The sets' indexes are implicitly limited by their sizes and 0\\ \uline{Example:}
    $ 0 \leq i < |N| $
\end{itemize}

\subsubsection{Graph}
\begin{itemize}
    \item Node
    \begin{itemize}
        \item $ |N| > 0 $
        \item $ \forall n \in N, Adj(n) \subseteq E $ (Adj is the set of edges originated in N(i))
        \item $ \forall n \in N, \ang{0} \leq lat \leq \ang{360} $
        \item $ \forall n \in N, \ang{0} \leq long \leq \ang{360} $
    \end{itemize}

    \item{Edge}
    \begin{itemize}
        \item $ |E| > 0 $
        \item $ \forall e \in E, w > 0 $ (the length of a way or road must be always bigger than 0)
        \item $ \forall e \in E, orig \in N $
        \item $ \forall e \in E, dest \in N $
    \end{itemize}

    \item $ base \in N $
    \item $ rp \in N $
    \item $ pup \in N $
    \item $ dp \in N $
    \item $ \exists! n \in N, n = base $

\end{itemize}

\subsubsection{Vehicles}
\begin{itemize}
    \item $ |V| > 0 $
    \item $ \forall v \in V, range > 0 $
\end{itemize}

\subsubsection{Orders}
\begin{itemize}
    \item $ |O| \geq 0 $
    \item $ \forall o \in O, pup \in N $
    \item $ \forall o \in O, dp \in N $
\end{itemize}

\subsection{Output Restrictions}

\subsubsection{Path}
\begin{itemize}
    \item $ |path| > 0 $
    \item $ path \subseteq N $
    \item $ \forall p \in path, p \in N $
\end{itemize}

\subsubsection{Vehicle Orders}
\begin{itemize}
    \item $ |Ov| \geq 0 $
    \item $ Ov \subseteq O $
    \item $ \forall o \in Ov, o \in O$
\end{itemize}

\section{Objective Function}

The company's goal for this system is to optimize the use of their vehicles. As we will not consider different speeds of travel for the vehicles, the time to fulfill a order behaves in parallel to the distance of its path. In our interpretation of the problem, optimizing the use of the vehicles would mean to find the shortest paths between two interest points in a route, as well as minimizing the distance of the route itself. In an optimal solution, the maximum distance travelled by a vehicle in a day would also be minimized. As such, there must be three functions to optimize (ones depend on the others). Being $ f $ the function that represents the most distance travelled by a vehicle; $ g $ the sum of the distances between the points in an itinerary; $ h $ the function that represents the distance between two interest points: the objective is to minimize them:
\[ f = \max(D) \]
\begin{itemize}
    \item $ D $ being the set of distances travelled by each vehicle in a day
\end{itemize}
\[ g = \max(sum(d)) \]
\[ h = \max(d) \]
\begin{itemize}
    \item $ d_1 $ being the distance from one interest point to another
\end{itemize}


\documentclass[titlepage]{article}
\newcommand{\var}{\textrm{Var}}
\newcommand{\E}{\textrm{E}}
\newcommand{\Normal}{\mathcal{N}}
\newcommand{\Ito}{It\^{o}~}

\usepackage{amsmath, amsthm, amssymb}
\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}

%IEEE compliance:
\DeclareGraphicsRule{.eps}{pdf}{.pdf}{`epstopdf --gsopt=-dPDFSETTINGS=/prepress #1}

\author{Yuriy Sverchkov}
\title{Modeling Flagellar Growth as a Stochastic Process}

\newtheorem*{clthm}{Central Limit Theorem for Renewal Processes}
\newtheorem*{itoform}{The \Ito Formula}

\begin{document}

%\maketitle

\begin{titlepage}
\begin{center}

\vspace*{2.5in}
{\Large Modeling Flagellar Growth as a Stochastic Process}

\vspace{0.5in}
{\large Yuriy Sverchkov}

\vfill
{\Large Senior Thesis\\ }

\vspace{0.25in}
{\large Advisor: Dr. Muruhan Rathinam

\vspace{0.25in}
Mathematics Department\\ University of Maryland, Baltimore County}

\vspace{0.5in}
\today

\end{center}
\end{titlepage}

\input{Intro.tex}

\section{Discrete Stochastic Model}
\label{sec:OriginalModel}

Following an approach similar to \cite{bressloff},
we model the process as a discrete-state continuous-time Markov process as follows:
We view the flagellum as having $N = L / a$ segments.
Each transporter has a position between $0$ (the flagellum base) and $N$ (the flagellum tip).
We also keep track of the direction of a transporter.
If a transporter $i$ ($i=1,...,n$) is moving anterograde, we consider the time it takes it to move from position $x$ to its next position $x+1$ to be an exponential random variable $T_{i,x+}$ with rate $\lambda_+ = v_+ / a$.
Similarly,  retrograde  movement from position $x$ to position $x-1$ is represented by discrete jumps a random exponential time period $T_{i,x-}$ apart (with a rate of $\lambda_- = v_- / a$).
Disassembly is similarly represented by a discrete shortening of the flagellum length at random exponentially distributed time intervals $S$ with the corresponding rate of $\mu = V / a$.
The direction of movement of a transporter changes only at the tip and at the base as follows:
When a transporter at the tip (position $N$) is moving anterograde jumps to its next position, $N$ is incremented, the transporter's new position is the new value of $N$, and its direction of movement becomes retrograde.
When a transporter at position $1$ is moving retrograde jumps to its next position, its new position becomes $0$ and its direction becomes anterograde.

Note that the resulting state-space for this Markov process has $M+1$ dimensions.

\subsection{Monte Carlo Simulation}

The most intuitive way to simulate a Markov Process is through the means of a Monte Carlo method, by generating values for the random variables $T_{i,x-}$, $T_{i,x+}$ and $S$ with a pseudorandom number generator (PRNG) and using those values to simulate the positions of the transporters and the flagellum length at any given moment in time.

We have encountered some challenges regarding the implementation of the simulation due to the number of steps the simulation must take to simulate a reasonably long time period.
Initially, MATLAB was used for the simulation. However, the MATLAB simulation took an unreasonably long period of time to run, and the simulation had to be re-written in C.
The C code ran considerably faster.
In writing the simulation code it was also important to make sure that the simulation does not exceed the PRNG's period.
In our simulation, we used the SIMD-oriented Fast Mersenne Twister algorithm~\cite{matsumoto} with a period of $2^{216091}-1$ iterations.
The number of random numbers generated per simulation run is as follows:
A step (a transporter moves or the flagellum shortens) occurs between $10 \times 350+1$ and $10 \times 200+1$ times per simulation second.
Two random numbers are generated per step: one to select the event that happens, and one to determine the waiting time until the next event.
We run simulations with time limits of $15000$ and $50000$ simulation seconds, resulting in about $10^7$ to $10^8$ random numbers generated per each trajectory.
Adding that we would like to get final distributions by running thousands of trajectories, and then compare several such sets of runs, adds three or more orders of magnitude to the number of random numbers to be generated.

\subsection{Trajectories}
At first glance, the stochastic IFT model seems to be in agreement with the ODE model. Figure~\ref{fig:originalTrajs} shows some sample trajectories created by the simulation with their ODE solution counterparts.

\begin{figure}[!h]
\centering
\includegraphics[width=\textwidth]{OriginalModelTrajs}
\caption{
Four representative trajectories generated by the stochastic IFT simulation and corresponding solutions to the ODE.
The four different trajectories start from four different initial lengths: 100, 1000, 1300, and 1900, running to a time limit of 50000.
}
\label{fig:originalTrajs}
\end{figure}

\subsection{Distribution at a Given Time}
%Table~\ref{tab:original} shows
Figure~\ref{fig:orig_ic8_15Ks} shows data from running the simulation of 5000 independent trajectories starting with the same initial conditions and taking the length at a particular predetermined time (15000 simulation seconds in this case).
%See Table~\ref{tab:ic} for a list of initial conditions. Sets of initial conditions were generated so that the IFTs are distributed uniformly.

%\begin{table}[t]
%\centering
%\begin{tabular}{crr}
%Name & Initial Length & Number of IFTs \\ \hline
%ic2 & 100 & 10 \\
%ic5 & 1300 & 10 \\
%ic8 & 1300 & 10
%\end{tabular}
%\caption{List of names for the different sets of initial conditions used for %simulations.}
%\label{tab:ic}
%\end{table}

%\begin{table}[!htbp]
%\centering
%\begin{tabular}{c*6{r}}%{cc*6{r}}
% Fig. &
% I.C. &
% \parbox{50pt}{Time Limit (seconds)} &
% \parbox{40pt}{Number of Runs} &
% Mean &
% \parbox{50pt}{Standard deviation} &
% Skewness &
% Kurtosis
%\\ \hline
% \ref{fig:orig_ic5_50Ks} &
%  ic5 & 50000 & 1200 & 1272.1 & 25.3665 & 0.0294 & 3.1540 \\
% \ref{fig:orig_ic8_15Ks} &
%  ic8 & 15000 & 5000 & 1273.3 & 25.2790 & 0.0045 & 2.8647 \\
% \ref{fig:orig_ic8_50Ks_1} &
%  ic8 & 50000 & 1800 & 1272.3 & 24.7195 & 0.1595 & 3.0236 \\
% \ref{fig:orig_ic8_50Ks_2} &
%  ic8 & 50000 & 2400 & 1273.1 & 25.1025 & 0.0554 & 2.9257 \\
% \ref{fig:orig_ic2_50Ks} &
%  ic2 & 50000 & 3500 & 1271.9 & 25.1562 & 0.0442 & 2.9342 \\
% \ref{fig:orig_ic2_15Ks} &
%  ic2 & 15000 & 5000 & 1273.0 & 25.3101 & -0.0020 & 2.9549

%\end{tabular}
%\caption{Data from ensemble runs of the IFT simulation.}
%\label{tab:original}
%\end{table}

%\begin{figure}[!htbp]
%\centering
%\includegraphics[width=\textwidth]{ic5_50Ks.eps}
%\caption{Distribution of final lengths given by the original simulation. See Table~\ref{tab:original} for details. 30 bin histogram for a sample of 1200.}
%\label{fig:orig_ic5_50Ks}
%\end{figure}

\begin{figure}%[!htbp]
\centering
\includegraphics[height=3in]{ic8_15Ks}
\caption{Distribution of final lengths given by the original simulation. The simulation was initialized at an initial length $N(0) = 1300$. 70 bin histogram for a sample of 5000.}
\label{fig:orig_ic8_15Ks}
\end{figure}

%\begin{figure}[!htbp]
%\centering
%\includegraphics[width=\textwidth]{ic8_50Ks.eps}
%\caption{Distribution of final lengths given by the original simulation. See Table~\ref{tab:original} for details. 30 bin histogram for a sample of 1800.}
%\label{fig:orig_ic8_50Ks_1}
%\end{figure}

%\begin{figure}[!htbp]
%\centering
%\includegraphics[width=\textwidth]{ic8_50Ks_2.eps}
%\caption{Distribution of final lengths given by the original simulation. See Table~\ref{tab:original} for details. 40 bin histogram for a sample of 2400.}
%\label{fig:orig_ic8_50Ks_2}
%\end{figure}

%\begin{figure}[!htbp]
%\centering
%\includegraphics[width=\textwidth]{ic2_50Ks.eps}
%\caption{Distribution of final lengths given by the original simulation. See Table~\ref{tab:original} for details. 50 bin histogram for a sample of 3500.}
%\label{fig:orig_ic2_50Ks}
%\end{figure}

%\begin{figure}%[!htbp]
%\centering
%\includegraphics[height=3in]{ic2_15Ks.eps}
%\caption{Distribution of final lengths given by the original simulation. The simulation was initialized at an initial length $N(0) = 1300$. 70 bin histogram for a sample of 5000.}
%\label{fig:orig_ic2_15Ks}
%\end{figure}

\subsection{Comparing Different Distributions}
We generated multiple sets of data with the simulation starting at various initial lengths $N(0)$.
We also compared simulations with time limits of both 50000 and 15000 seconds.

Using the Kolmogorov-Smirnov test (the MATLAB \texttt{kstest2} command) to compare the distributions given by the simulation we can conclude several things:

Since the test cannot reject the hypothesis that the samples come from the same distribution when comparing two samples from different initial lengths and identical time limit shows that starting at different initial conditions leads to the same stationary probabilities as suggested by the trajectory plots.
%(Comparing the distribution in Figure~\ref{fig:orig_ic2_50Ks} to the distribution in Figure~\ref{fig:orig_ic5_50Ks} or Figure~\ref{fig:orig_ic8_50Ks_1} or Figure~\ref{fig:orig_ic8_50Ks_2})

The test also cannot reject the hypothesis when comparing two samples with different time limits (50000s vs. 15000s), leading to believe that the stationary probabilities are reached before 15000s, as suggested by the trajectory plots.
%(Comparing the distribution in Figure~\ref{fig:orig_ic8_15Ks} to the distribution in Figure~\ref{fig:orig_ic5_50Ks} or Figure~\ref{fig:orig_ic8_50Ks_1} or Figure~\ref{fig:orig_ic8_50Ks_2})

%In fact, the test cannot reject the hypothesis when comparing any pair of distributions from Table~\ref{tab:original}.

\subsection{The Crowding Model}
The crowding model is a modified version of the original model with the major difference being that transporters are not allowed to occupy the same position at the same time. This is accomplished by adding a check every time a transporter is selected to move---if there is another transporter in the position in front of it, the transporter does not move. When the flagellum length decreases, transporters are bumped back (that is, if there is an transporter at the very end and another directly behind it, both are moved back).

\subsubsection{Trajectories}
Figure~\ref{fig:crowdTrajs} shows some sample trajectories created by the simulation with their ODE solution counterparts. Visually, the crowding model also apparently agrees with the ODE model.

\begin{figure}%[!htbp]
\centering
\includegraphics[width=\textwidth]{CrowdingModelTrajs}
\caption{
Four representative trajectories generated by the stochastic IFT simulation with crowding and corresponding solutions to the ODE.
The four different trajectories start from four different initial lengths: 100, 1000, 1300, and 1900, running to a time limit of 50000.
}
\label{fig:crowdTrajs}
\end{figure}

\subsubsection{Distribution at a Given Time}
Figure~\ref{fig:crowd_ic8_15Ks} shows data from running the simulation repeatedly starting with the same initial conditions and taking the length at a particular predetermined time (15000s).
The dataset shown in Figure~\ref{fig:crowd_ic8_15Ks} had a mean of 1268.6 and a standard deviation of 25.4275,
with 95\% confidence intervals of [1268.0, 1269.2] and [25.0211, 25.8474] for the mean and standard deviation respectively.
When compared to the non-crowding model simulation results (see Table~\ref{tab:ci} on page~\pageref{tab:ci}) it can be seen that the crowding model yields a lower mean, but a similar standard deviation.

%\begin{table}[!htbp]
%\centering
%\begin{tabular}{c*6{r}}%{cc*6{r}}
% Fig. &
% I.C. &
% \parbox{50pt}{Time Limit (seconds)} &
% \parbox{40pt}{Number of Runs} &
% Mean &
% \parbox{50pt}{Standard deviation} &
% Skewness &
% Kurtosis
%\\ \hline
% \ref{fig:crowd_ic8_50Ks} &
%  ic8 & 50000 & 2100 & 1268.1 & 25.4904 & 0.0176 & 2.8749 \\
% \ref{fig:crowd_ic8_15Ks} &
%  ic8 & 15000 & 7280 & 1268.6 & 25.4275 & 0.0064 & 2.9586 \\
% \ref{fig:crowd_ic2_50Ks} &
%  ic2 & 50000 & 1270 & 1269.6 & 24.8842 & -0.0928 & 2.8579 \\
% \ref{fig:crowd_ic2_15Ks} &
%  ic2 & 15000 & 4200 & 1268.8 & 25.1056 & 0.0304 & 2.8689

%\end{tabular}
%\caption{Data from ensemble runs of the crowding simulation.}
%\label{tab:crowd}
%\end{table}

%\begin{figure}[!htbp]
%\centering
%\includegraphics[width=\textwidth]{c_ic8_50Ks.eps}
%\caption{Distribution of final lengths given by the crowding simulation. See Table~\ref{tab:crowd} for details. 60 bin histogram for a sample of 2100.}
%\label{fig:crowd_ic8_50Ks}
%\end{figure}

\begin{figure}%[!htbp]
\centering
\includegraphics[height=3in]{c_ic8_15Ks}
\caption{Distribution of final lengths given by the crowding simulation.
The simulation was initialized at an initial length $N(0) = 1300$.
80 bin histogram for a sample size of 7280.}
\label{fig:crowd_ic8_15Ks}
\end{figure}

%\begin{figure}[!htbp]
%\centering
%\includegraphics[width=\textwidth]{c_ic2_50Ks.eps}
%\caption{Distribution of final lengths given by the crowding simulation. See Table~\ref{tab:crowd} for details. 30 bin histogram for a sample of 1270.}
%\label{fig:crowd_ic2_50Ks}
%\end{figure}

%\begin{figure}[!htbp]
%\centering
%\includegraphics[width=\textwidth]{c_ic2_15Ks.eps}
%\caption{Distribution of final lengths given by the crowding simulation. See Table~\ref{tab:crowd} for details. 60 bin histogram for a sample of 4200.}
%\label{fig:crowd_ic2_15Ks}
%\end{figure}

\subsubsection{Comparing Different Distributions}
%The Kolmogorov-Smirnov test cannot reject the hypothesis that two samples come from the same distribution when any pair of samples from Table~\ref(tab:crowd).
According to the Kolmogorov-Smirnov test, the same final distribution are reached by trajectories run from different initial conditions.
Similarly, the test cannot reject the hypothesis that distributions at 15000s and at 50000s are the same.

\subsection{Crowding vs. Non-Crowding}
Since the crowding model yields a lower mean for the stationary distribution, it is clear that the two models do not give strictly the same distribution.
However, when the distributions are shifted so that their means match, the Kolmogorov-Smirnov test cannot reject the hypothesis that the two samples (one from the crowding model and one from the original model) come from the same distribution.

\section{Naive Birth-Death Model}

Due to the complexity of the discrete model, it is of interest whether this model can be simplified.
We are particularly interested in the length of the flagellum as a function of time, and the stationary distribution of the length, hence we attempt to write a model that is dependent on length and time alone.

One of the simpler forms of such a model is a birth-death model (see~\cite{ross} for a definition) where the death rate is the rate of disassembly and the birth rate is the total rate of assembly.

\subsection{Exact Stationary PDF Derivation}

In the birth-death model the state number $n$ represents the length of the flagellum in number of proteins ($N$ from the discrete model), the birth rate is the assembly rate, and the death rate is the disassembly rate.

The assembly rate is indicated in the ODE: since the frequency at which one transporter will arrive at the end of the flagellum with proteins for assembly is the mean speed of the transporter, $\bar{v}$, divided by the total distance to be traveled from the tip down and back to the tip again, $2 L$.
The frequency of assembly with $M$ transporters will then be $M$ times that rate, giving an assembly rate of $\frac{M \bar{v}}{2 L}$, or, using the notation in the discrete model, $\frac{M \bar\lambda}{2 N}$.
The disassembly rate is similarly simply $\mu$ from the discrete model.

From this we can get the following balance conditions for all positive-numbered states:

\begin{equation*}
 \mu \pi_{n+1} = \frac{M \bar\lambda }{2 n} \pi_n \qquad \forall n > 0
\end{equation*}

Since the rate of assembly is inversely proportional to the length (and the state number), there is a question of what the rate of assembly should be when the length is zero. For example, if we allow for the rate of assembly at zero to be the same as the rate of assembly at 1, we get a Poisson Distribution with mean equal to the ODE-predicted mean, since then we can get an expression for $\pi_n$ in terms of $\pi_0$:
\begin{equation*}
 \pi_n = \left(\frac{M\bar\lambda}{2 \mu}\right)^n \frac{1}{n!} \pi_0
\end{equation*}
which allows us to get:
\begin{align*}
 \sum_{n=0}^\infty \pi_n
 &= \sum_{n=0}^\infty \left(\frac{M\bar\lambda}{2 \mu}\right)^n \frac{1}{n!} \pi_0 \\
 &= \pi_0 e^{\frac{M\bar\lambda}{2 \mu}} \\
 &= 1
\end{align*}
giving:
\begin{equation*}
 \pi_n = e^{-(\frac{M\bar\lambda}{2 \mu})} \left(\frac{M\bar\lambda}{2 \mu }\right)^n \frac{1}{n!}
\end{equation*}
meaning that the stationary distribution is Poisson with mean and variance equal to the ODE mean.

Another possible value for the assembly rate at zero can be taken from the detailed simulation: When the length is zero all transporters are at the same position, all are moving anterograde, and once any transporter moves assembly will occur. Hence the rate of assembly will be the number of transporters $M$ times the anterograde movement rate, $\lambda_+$.

\begin{equation*}
 M \lambda_+ \pi_0 = \mu \pi_1
\end{equation*}

\begin{align*}
 \forall n > 0: \\
 \pi_{n+1} &= \frac{M \bar\lambda}{2 \mu n} \pi_n \\
 \pi_n &= \left( \frac{M \bar\lambda}{2 \mu} \right)^{n-1} \frac{1}{n!} \pi_1
\end{align*}

\begin{align*}
 \sum_{n = 0}^\infty \pi_n
 &= \pi_0 + \sum_{n = 1}^\infty \left( \frac{M \bar\lambda}{2 \mu} \right)^{n-1} \frac{1}{n!} \pi_1 \\
 &= \pi_0 + \sum_{n = 1}^\infty \left( \frac{M \bar\lambda}{2 \mu} \right)^{n} \frac{2 \mu}{M \bar\lambda} \frac{1}{n!} \pi_1 \\
 &= \pi_0 + \left( e^\frac{M \bar\lambda}{2 \mu} - 1 \right) \frac{2 \mu}{M \bar\lambda} \pi_1 \\
 &= \pi_0 \left( 1 + \left( e^\frac{M \bar\lambda}{2 \mu} - 1 \right) \frac{2 \mu}{M \bar\lambda} \frac{M \lambda_+}{\mu} \right) \\
 &= \pi_0 \left( 1 + \left( e^\frac{M \bar\lambda}{2 \mu} - 1 \right) \frac{2 \lambda_+}{\bar\lambda} \right) \\
 &= 1
\end{align*}

\begin{equation*}
\pi_0 = \frac{1}{ 1 + \left( e^\frac{M \bar\lambda}{2 \mu} - 1 \right) \frac{2 \lambda_+}{\bar\lambda} }
\end{equation*}

\begin{equation*}
\forall n > 0 \qquad \pi_n = \frac{M \lambda+}{ \left( 1 + \left( e^\frac{M \bar\lambda}{2 \mu} - 1 \right) \frac{2 \lambda_+}{\bar\lambda} \right) \mu n! } \left( \frac{M \bar\lambda}{2 \mu} \right)^{n-1}
\end{equation*}

Note that the resulting distribution is very similar to a Poisson distribution in shape.
In fact, the only difference is that the probability that $n=0$ is different, and the probabilities for $n>0$ are a constant multiple of the Poisson probabilities for $n>0$.
Additionally, noting that $\frac{M\bar\lambda}{2\mu} \gg 1$, and that $2\lambda_+ / \bar\lambda = 1 + ( \lambda_+ / \lambda_- ) > 1$, we can see that
\begin{equation*}
( 1 + ( e^\frac{M\bar\lambda}{2\mu} - 1 ) \frac{2 \lambda_+}{\bar\lambda} )
\approx \frac{2 \lambda_+}{\bar\lambda} e^\frac{M\bar\lambda}{2\mu}
\end{equation*}
Which means that the distribution is very close to a Poisson distribution, that is, the scaling is not very significant.

The birth-death model gives a stationary distribution with a variance of $\bar{N}$, which is about twice the variance observed from simulations of the detailed model.

\subsection{Simulation Results}
Figure~\ref{fig:bdTrajs} shows that the trajectory of the birth-death model does not match the ODE like the detailed stochastic model does; however, it does approach the same mean in the long run.
The major difference between the models is the fact that the standard deviation predicted by the birth-death model is twice the standard deviation observed from simulations of the detailed model.

\begin{figure}%[!htbp]
\centering
\includegraphics[width=\textwidth]{BirthDeathTrajs}
\caption{
Four representative trajectories generated by the birth-death simulation and corresponding solutions to the ODE.
The four different trajectories start from four different initial lengths: 100, 1000, 1300, and 1900, running to a time limit of 50000.
}
\label{fig:bdTrajs}
\end{figure}

\section{Stochastic Differential Equation Model}

After seeing that the simple birth-death model is inadequate, we try a different approach, which yields a stochastic differential equation (SDE) of the length as a function of time.

First, consider a time interval $[t,t+\tau]$, where $\tau$ is small enough so that the length of the flagellum $L$, and hence the number of segments $N$, does not change appreciably.
Denote the number of assemblies performed by transporter $i$ during the time interval $[t,t+\tau]$ by $X_i(\tau)$, $i=1,...,M$.

In a model without crowding effects, since the transporters are only affected by each other via the changing length of the flagellum, our assumption that $N$ does not change appreciably during the time interval allows us to say that $X_1(\tau),...,X_n(\tau)$ are almost i.i.d. random variables.

Treating $X_i(\tau)$ as a renewal process (see Ross~\cite{ross} for the definition of a renewal process) where $T_i$ is the random waiting time between increments of $X_i(\tau)$, we can find the mean and variance of the renewal time $T_i$ as follows:
To guarantee an assembly, the transporter must complete an entire loop around the flagellum, consisting of $N$ anterograde jumps and $N$ retrograde jumps. Using the notation from Section~\ref{sec:OriginalModel}, we can express $T_i$ as:

\begin{equation*}
T_i = \sum_{x=0}^N{T_{i,x+}} + \sum_{x=0}^N{T_{i,x-}}
\end{equation*}

Since the times between individual jumps $T_{i,x+}$ and $T_{i,x-}$ are independent exponential random variables with rates $\lambda_+$ and $\lambda_-$ respectively, the mean of one assembly can be expressed as the sum of their means:

\begin{equation*}
\E(T_i) = \sum_{x=0}^N{\E(T_{i,x+})} + \sum_{x=0}^N{\E(T_{i,x-})} = N \frac{1}{\lambda_+} + N \frac{1}{\lambda_-} = \frac{2N}{\bar{\lambda}}
\end{equation*}

And the variance can be expressed as:
\begin{equation*}
\var(T_i) = \sum_{x=0}^N{\var(T_{i,x+})} + \sum_{x=0}^N{\var(T_{i,x-})} = N \frac{1}{\lambda_+^2} + N \frac{1}{\lambda_-^2} = \frac{2N}{{\lambda^*}^2}
\end{equation*}

Where $\bar{\lambda}$ is the harmonic mean of $\lambda_+$ and $\lambda_-$, and $\lambda^*$ is defined as $\sqrt{\frac{2}{(\frac{1}{\lambda_+})^2+(\frac{1}{\lambda_-})^2}}$.

We now suppose that the time interval $[t,t+\tau]$ is such that the number of assemblies that the transporter performs in the time interval, $X_i(\tau)$, is sufficiently large to make use of the central limit theorem for renewal processes (see Appendix~\ref{sec:ren}).

We use the central limit theorem for renewal processes to approximate $X_i(\tau)$, as a normal distribution with mean and variance given by:

\begin{equation*}
\frac{\E(X_i(\tau))}{\tau}
\approx \lim_{s \to \infty}\frac{\E(X_i(s))}{s}
= \frac{1}{\E(T_i)}
= \frac{\bar{\lambda}}{2N}
\end{equation*}

\begin{equation*}
\frac{\var(X_i(\tau))}{\tau}
\approx \lim_{s \to \infty}\frac{\var(X_i(s))}{s}
= \frac{\var(T_i)}{\E^3(T_i)}
= \frac{2N}{{\lambda^*}^2} \left(\frac{\bar{\lambda}}{2N}\right)^3
= \frac{\bar{\lambda}^3}{4N^2{\lambda^*}^2}
\end{equation*}

Hence we can say that:
\begin{equation*}
X_i(\tau) \sim \Normal\left( \frac{\bar{\lambda}}{2N}\tau, \frac{\bar{\lambda}^3}{4N^2{\lambda^*}^2}\tau \right)
\end{equation*}

In the same interval of time $[t, t+\tau]$, the number of disassemblies, denoted by $Y(\tau)$ is Poisson with mean and variance $\mu\tau$.
When $\tau$ is large enough, this can also be approximated by a normal distribution with mean and variance $\mu\tau$.
Hence $Y(\tau) \sim \Normal(\mu\tau,\mu\tau)$.

We can then write an expression for the change in length during the time interval $[t,t+\tau]$:
\begin{equation*}
\delta N = N(t+\tau) - N(t) = \sum_{i=1}^M{X_i(\tau)} - Y(\tau)
\end{equation*}

Since $X_i(\tau)$ are almost i.i.d. and independent from $Y(\tau)$, $\delta N$ is a linear combination of mutually independent normal distributions and is therefore itself a normal distribution:
\begin{equation*}
\delta N \sim \Normal\left( \frac{M\bar{\lambda}\tau}{2N} - \mu\tau, \frac{M\bar{\lambda}^3\tau}{4N^2{\lambda^*}^2} + \mu\tau \right)
\end{equation*}

Which can be rewritten as an SDE for $N(t)$:

\begin{equation*}
dN(t) = \left( \frac{M\bar{\lambda}}{2N(t)} - \mu \right)dt + \sqrt{ \frac{M \bar{\lambda}^3}{4N^2(t){\lambda^*}^2} + \mu } \phantom{.} dB(t)
\end{equation*}

Where $B(t)$ is Brownian motion.

Recalling that we used a conversion from physical units of length to multiples of the segment length $a$, we can convert the SDE back to physical units of length ($dN(t) = dL(t)/a$, $(\bar{\lambda}) = (\bar{v})/a$, $\lambda^* = v^*/a$, $\mu = V/a$)

\begin{equation*}
dL(t) = \left( \frac{M\bar{v}a}{2L(t)} - V \right)dt + \sqrt{ \frac{M \bar{v}^3a^3}{4L^2(t){v^*}^2} + aV } \phantom{.} dB(t)
\end{equation*}

\subsection{SDE Simulation}

To compare the results predicted by the SDE to the results given by the (Non-Crowding) Monte Carlo simulation we use Euler's method to simulate the SDE trajectories.

Euler's method for solving an ODE such as $dy(x) = f(y(x))dx$ consists of viewing the ODE as a difference equation
\[ y(x_n) - y(x_{n-1}) = f(y(x_{n-1}))\cdot(x_n - x_{n-1}) \]
for some constant step size $(x_n - x_{n-1})$.
Similarly, we can view the SDE as a difference equation of random variables, that is, for the SDE
\[ dN(t) = f(N(t))dt + g(N(t))dB \]
we have a difference equation:
\[ N(t_n) - N(t_{n-1}) = f(N(t_{n-1}))\cdot(t_n - t_{n-1}) + g(N(t_{n-1}))\cdot(B(t_n) - B(t_{n-1})) \]
where $(B(t_n) - B(t_{n-1})) \sim \Normal(0, t_n - t_{n-1})$ by the properties of Brownian motion.
Then by choosing a step size $(t_n - t_{n-1})$ and an initial condition $N(0)$ we can simulate the SDE by generating random numbers for the Brownian motion term and iteratively generating $N(t_n)$ for each $n$.

\begin{figure}%[!htbp]
\centering
\includegraphics[width=\textwidth]{SDEtraj}
\caption{
Four representative SDE trajectories generated using Euler's method and corresponding solutions to the ODE.
The four different trajectories start from four different initial lengths: 100, 1000, 1300, and 1900, running to a time limit of 50000.}
\label{fig:SDEtraj}
\end{figure}

In the same manner in which we could generate a distribution for the length of the flagellum at a given time by running the Monte Carlo trajectories repeatedly and recording final length, we generate a distribution for the length of the flagellum at a given time by simulating a large number of trajectories for the SDE.

\begin{figure}%[!htbp]
\centering
\includegraphics[height=3in]{SDEdist}
\caption{
Distribution of final lengths given by the SDE simulation.
The initial length was set to $N(0)=700$ and the time limit was set to 15000 seconds.
100 bin histogram for a sample size of 10000.
Mean: 1273.4
Standard deviation: 25.6482 }
\label{fig:SDEens}
\end{figure}

%Since the SDE suggests that the distribution is lognormal, and since the mean of the distribution is large, in finding how well the distributions agree, it is useful to approximate the distribution as normal, which allows us to compare confidence intervals for the mean and standard deviation of the distribution.
Since the distributions produced by the models and the distribution predicted by the SDE resemble Gaussians, we used the Gaussian assumption to compute the confidence intervals for the means and standard deviations of the simulation results.
The distribution generated by the SDE simulation has a mean and standard deviation that is within the confidence intervals corresponding to distributions from the detailed stochastic model (see Table~\ref{tab:ci}).

\section{Linear Noise Approximation}

Although the SDE simulation can be used to get the variance of the stationary distribution of flagellum lengths given a specific set of parameters, we are interested in getting an expression for the variance analytically.
For this purpose, we approximate the SDE with a linear noise approximation.

First we observe that near the equilibrium length, $\bar{N}$, the diffusion due to the assembly rate is very small.
Recall that $\bar{N}=\frac{\bar\lambda M}{2\mu}$.
Then:

\begin{align*}
\frac{M \bar{\lambda}^3}{4\bar{N}^2{\lambda^*}^2}
&= \frac{M \bar{\lambda}^3}{4{\lambda^*}^2}\left(\frac{2\mu}{\bar\lambda M}\right)^2 \\
&= \frac{\mu^2 \bar\lambda}{{\lambda^*}^2 M} \\
%\frac{M \bar{\lambda}^3}{4\bar{N}^2{\lambda^*}^2}
&\ll \mu
\end{align*}
since $\mu$ is orders of magnitude smaller than $\lambda_+$ and $\lambda_-$, and since $\frac{\bar\lambda}{\lambda^*}$ is bounded.

We can then rewrite the SDE near $N = \bar{N}$ as
\begin{equation*}
dN(t)=A(N(t))dt+\sqrt{\mu}dB(t)
\end{equation*}
where
\begin{equation*}
A(N(t)) := \left( \frac{M\bar{\lambda}}{2N(t)} - \mu \right)
\end{equation*}
Then let $\triangle N(t) := N(t)-\bar{N}$, which gives:
\begin{align*}
d \triangle N(t) = dN(t)
&= A(N(t))dt + \sqrt{\mu}dB(t) \\
&= A(\bar{N} + \triangle N(t))dt + \sqrt{\mu}dB(t)
\end{align*}
Taylor expanding $A(\bar{N} + \triangle N(t))$ around $\bar{N}$, and omitting terms after the second (since we are considering the case where $\triangle N(t)$ is small):
\begin{equation*}
d \triangle N(t) \approx
A(\bar{N}) + A'(\bar{N}) \triangle N(t)dt +  \sqrt{\mu}dB(t)
\end{equation*}
Observing that
\begin{align*}
A(\bar{N})
&= \frac{M\bar{\lambda}}{2\bar{N}} - \mu \\
&= \frac{M\bar{\lambda}}{2} \frac{2\mu}{\bar\lambda M} - \mu \\
&= \mu - \mu \\
A(\bar{N}) &= 0
\end{align*}
The above gives us the following linear SDE for the perturbation:
\begin{equation*}
d \triangle N(t) =
-\frac{M\bar\lambda}{2\bar{N}^2} \triangle N(t)dt + \sqrt{\mu}dB(t)
\end{equation*}

By taking the expectation of both sides, using linearity of expectation, and noting that $\E dB(t) = 0$ we get an ODE for $\E \triangle N(t)$:
\begin{equation*}
d \E \triangle N(t) =
-\frac{M\bar\lambda}{2\bar{N}^2} \E( \triangle N(t) )dt + \sqrt{\mu} \E( dB(t) )
\end{equation*}
\begin{equation*}
\frac{d \E( \triangle N(t) )}{dt} +
\frac{M\bar\lambda}{2\bar{N}^2} \E( \triangle N(t) )
= 0
\end{equation*}
Solving the equation gives:
\begin{equation*}
\E \triangle N(t) = C \exp \left( -\frac{M\bar\lambda}{2\bar{N}^2} t \right)
\end{equation*}
Taking the limit gives:
\begin{equation*}
\lim_{t \rightarrow \infty} \E \triangle N(t) = 0
\end{equation*}

Similarly, we can get an ODE and a solution for $\E( (\triangle N(t))^2 )$ (see Appendix~\ref{sec:deriv}).
This allows us to arrive at an expression for $\var( N(t) )$ as $t \rightarrow \infty$, and noting that $\E(N(t)) \rightarrow \bar{N}$:

\begin{align*}
\var( N(t) ) &= \E( ( N(t) - \E(N(t)) )^2 ) \\
&= \E( ( \bar{N} + \triangle N(t) - \bar{N} )^2 ) \\
&= \E( (\triangle N(t))^2 ) \\
\var( N(t) ) &\rightarrow \frac{M \bar{\lambda}}{4 \mu}
\qquad \textrm{as } t \rightarrow \infty
\end{align*}

Note that the above shows that the variance of the stationary distribution is approximated to be half the mean.
Table~\ref{tab:ci} compares different data from the discrete model and nonlinear SDE simulations to the mean and variance predicted by this approximation through the use of confidence intervals.
It can be seen that the distributions are close, and in most cases their means and variances are in each other's confidence intervals.

\begin{table}%[!htbp]
\centering
\begin{tabular}{c|rrr|cc}
 Model & \multicolumn{1}{c}{$N(0)$} & \multicolumn{1}{c}{Time Limit}
 & \multicolumn{1}{c}{Data} &
 \multicolumn{2}{c}{95\% Confidence Intervals for} \\
 & & \multicolumn{1}{c}{(seconds)} & \multicolumn{1}{c}{Points}
 & \multicolumn{1}{c}{Mean} &
 \multicolumn{1}{c}{Standard Deviation}
\\ \hline
 LNA & & & & 1272.7 & 25.2262 \\
 SDE & 100 & 15000 & 5000 & [1272.4, 1273.8] & [24.6917, 25.6790] \\
 SDE & 700 & 15000 & 100000 & [1273.1, 1273.4] & [25.1371, 25.3584]\\
 MAR & 100 & 15000 & 5000 & [1272.3, 1273.7] & [24.8236, 25.8162] \\
 MAR & 100 & 50000 & 3500 & [1271.1, 1272.7] & [24.5804, 25.7598] \\
 MAR & 1300 & 15000 & 5000 & [1271.6, 1273.0] & [24.7931, 25.7845] \\
 MAR & 1300 & 50000 & 2400 & [1272.1, 1274.1] & [24.4120, 25.8336]

\end{tabular}
\caption{Confidence intervals from various distributions.
The models are as follows:
LNA---linear noise approximation (only the mean and the variance, as calculated above, are given);
SDE---nonlinear SDE simulation;
MAR---Markov Chain simulation.}
\label{tab:ci}
\end{table}

\section{Conclusion}

We see the discrete model for flagellar length that was based on a Markov Chain can be approximated well by a nonlinear SDE that showed that the mean flagellum length predicted by the ODE a can be further approximated by a linear SDE.
The linear SDE was used to show that as long as the mean flagellar length is significantly greater than the length added by each transporter, and as long as the degeneration rate is much lower than the rates at which transporters move, the stationary distribution of the flagellum length has a variance of about half the mean.
This also provides an example of an instance where a simple birth-death model constructed from an ODE is inadequate (since the birth-death model yields a distribution with equal mean and variance).

It should be noted that although in the Markov Chain model we assumed the waiting times for transporters to move from one point to the next to be exponentially distributed random variables, since the SDE approximation makes use of the Central Limit Theorem for Renewal Processes, this approximation still holds for a more general case where those waiting times have variances equal to their mean squared.
The process of approximation here can also be generalized further for waiting times of any given mean and variance, yielding SDEs in terms of those means and variances.

Here we concentrated on the model's behavior near it's equilibrium.
It may be of interest to study how the model behaves at the other extreme, how fast it reaches its equilibrium, and what parameters affect these behaviors.
It would also be of interest to look for biological confirmation of the accuracy of this model (or the lack thereof).

\appendix

\section{Renewal Processes}\label{sec:ren}

\begin{clthm}[Ross~\cite{ross}, 7.3]
Let $\{N(t), t \leq 0 \}$ be a renewal process and let $\mu$ and $\sigma$ be, respectively, the mean and standard deviation of the interarrival distribution. Then the following holds:

\begin{equation*}
\lim_{t \rightarrow \infty} P \left\{
\frac{N(t)-t/\mu}{\sqrt{t\sigma^2/\mu^3}} < x
\right\}
= \frac{1}{\sqrt{2\pi}} \int_{-\infty}^x e^{-x^2/2} dx
\end{equation*}
\end{clthm}

Note that this means that as $t \rightarrow \infty$, $N(t)$ approaches a normal distribution with mean $\frac{1}{\mu}t$ and variance $\frac{\sigma^2}{\mu^3}t$, or, equivalently:
\begin{equation*}
\lim_{t \rightarrow \infty} \frac{\E(N(t))}{t} = \frac{1}{\mu}
\end{equation*}
and
\begin{equation*}
\lim_{t \rightarrow \infty} \frac{\var(N(t))}{t} = \frac{\sigma^2}{\mu^3}
\end{equation*}

\section{ $\E( (\triangle N(t))^2 )$ derivation }\label{sec:deriv}

Given the equation
\begin{equation*}
d \triangle N(t) =
-\frac{M\bar\lambda}{2\bar{N}^2} \triangle N(t)dt + \sqrt{\mu}dB(t)
\end{equation*}
First, a change of notation is convenient.
Let
\begin{align*}
B_t &= B(t) \\
\xi_t &= \triangle N(t) \\
\alpha &= -\frac{M\bar\lambda}{2\bar{N}^2} \\
\beta &= \sqrt{\mu}
\end{align*}
Giving
\begin{equation*}
d \xi_t = \alpha \xi_t dt + \beta dB_t
\end{equation*}

At this point we make use of the \Ito Formula, in particular, the 1-dimensional \Ito formula, in order to calculate $d(\xi_t^2)$:
\begin{itoform}[{\O}ksendal~\cite{oksendal}, Theorem 4.1.2]
For an \Ito process $\xi_t$ given by
\begin{equation*}
d \xi_t = u_t \xi_t dt + v_t dB_t
\end{equation*}
Let $g(t,x) \in C^2([0,\infty) \times \mathbb{R})$ (i.e. $g$ is twice continuously differentiable on $[0,\infty) \times \mathbb{R}$). Then
\begin{equation*}
\zeta_t = g(t,\xi_t)
\end{equation*}
is again an \Ito process, and
\begin{equation*}
d\zeta_t = \frac{\partial g}{\partial t}(t,\xi_t)dt + \frac{\partial g}{\partial x}(t, \xi_t)d\xi_t + \frac{1}{2}\frac{\partial^2 g}{\partial x^2}(t,\xi_t) \cdotp (d\xi_t)^2
\end{equation*}
where $(d\xi_t)^2 = (d\xi_t) \cdotp (d\xi_t)$ is computed according to the rules
\begin{equation*}
dt \cdotp dt = dt \cdotp dB_t = dB_t \cdotp dt = 0~, \quad dB_t \cdot dB_t = dt
\end{equation*}
\end{itoform}

We apply this formula to the particular case when $g(t,x) = x^2$, and we get:
\begin{align*}
d \zeta_t &= 0 dt + 2 \xi_t d \xi_t + \frac{1}{2} 2 (d \xi_t)^2 \\
&= 2 \xi_t (\alpha \xi_t dt + \beta dB_t) + (\alpha \xi_t dt + \beta dB_t)(\alpha \xi_t dt + \beta dB_t) \\
&= 2 \alpha \xi_t^2 dt + 2 \beta \xi dB_t + \alpha^2 \xi_t^2 (dt \cdotp dt) + \alpha \beta \xi_t (dt \cdotp dB_t + dB_t \cdotp dt) + \beta^2 (dB_t \cdot dB_t) \\
&= 2 \alpha \zeta_t dt + 2 \beta \xi_t dB_t + \beta^2 dt
\end{align*}
Taking the expected value of both sides gives
\begin{equation*}
d \E( \zeta_t ) = \E( d \zeta_t )
= 2 \alpha \E( \zeta_t )dt + \beta^2 dt
\end{equation*}
The general solution to the resulting ODE is
\begin{equation*}
\E \zeta_t = C e^{-2\alpha t} - \frac{\beta^2}{2\alpha}
\end{equation*}
Then we can finally arrive at an expression for $\lim_{t \rightarrow \infty} \E( (\triangle N(t))^2 )$:
\begin{align*}
\lim_{t \rightarrow \infty} \E( (\triangle N(t))^2 )
&= \lim_{t \rightarrow \infty} \E \zeta_t \\
&= - \frac{\beta^2}{2\alpha} \\
&= \frac{\mu}{2}\frac{2\bar{N}^2}{M\bar\lambda} \\
&= \frac{\mu}{M\bar\lambda} \bar{N}^2 \\
&= \frac{\mu}{M\bar\lambda} \left( \frac{\bar\lambda M}{2\mu} \right)^2 \\
&= \frac{M\bar\lambda}{4\mu}
\end{align*}

\input{bibliography.tex}

\end{document}