% $Header: /cvsroot/latex-beamer/latex-beamer/solutions/conference-talks/conference-ornate-20min.en.tex,v 1.7 2007/01/28 20:48:23 tantau Exp $

\documentclass[11pt]{beamer}

\mode<beamer>
{
  \usetheme{default}
  \usecolortheme[rgb={0,0,0.8}]{structure}
  %\setbeamercolor{normal text}{bg=blue!50}
  %\setbeamercolor{normal text}{fg=blue!50}
  % or ...

  %\setbeamercovered{transparent}
  % or whatever (possibly just delete it)
}

\usepackage[english]{babel}
% or whatever

\usepackage[latin1]{inputenc}
% or whatever

\usepackage{times}
\usepackage[T1]{fontenc}
% Or whatever. Note that the encoding and the font should match. If T1
% does not look nice, try deleting the line with the fontenc.

%\usepackage{newcent}
%\usefonttheme{structuresmallcapsserif}

\usepackage{amssymb,latexsym,amsmath}
\usepackage{amsthm}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}

\usepackage{mathtools}
\input xy
\xyoption{all}
\usepackage[latin1]{inputenc}
\usepackage{color}
\usepackage{tikz}

\title[On Laplacian Eigenmaps for Dimensionality Reduction] % (optional, use only with long paper titles)
{On Laplacian Eigenmaps for Dimensionality Reduction}

%\subtitle

\author[Dr. Juan Orduz] % (optional, use only with lots of authors)
{Dr. Juan Orduz}
% - Give the names in the same order as the appear in the paper.
% - Use the \inst{?} command only if the authors have different
%   affiliation.

\institute[PyData Berlin 2018] % (optional, but mostly needed)
{

}
% - Use the \inst command only if there are several affiliations.
% - Keep it simple, no one is interested in your street address.

\date[ PyData Berlin 2018] % (optional, should be abbreviation of conference name)
{ PyData Berlin 2018}
% - Either use conference name or its abbreviation.
% - Not really informative to the audience, more for people (including
%   yourself) who are reading the slides online

\subject{data science}
% This is only inserted into the PDF information catalog. Can be left
% out.

% If you have a file called "university-logo-filename.xxx", where xxx
% is a graphic format that can be processed by latex or pdflatex,
% resp., then you can add a logo as follows:

\pgfdeclareimage[height=0.7cm]{university-logo}{logo.jpg}
\logo{\pgfuseimage{university-logo}}

% If you wish to uncover everything in a step-wise fashion, uncomment
% the following command:

%\beamerdefaultoverlayspecification{<+->}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

%\begin{frame}{Contenido}
%\tableofcontents
%\end{frame}

\begin{frame}{Overview}
\tableofcontents
\end{frame}

\section{Introduction}

\begin{frame}{Can One Hear the Shape of a Drum?}{\cite{K66}}
A  {\bf differentiable manifold} is a type of manifold that is locally similar enough to a linear space to allow one to do calculus. A (Riemannian) metric $g$ allow us to measure distances.
\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\draw (0,0) ellipse (2.5cm and 1.5cm);
%\draw (-0.5,0) arc (175:315:0.5cm and 0.25cm);
%\draw (0.2,-0.2) arc (-30:180:0.35cm and 0.15cm);
\draw (-1,0.2) arc (175:315:1cm and 0.5cm);
\draw (0.5,-0.27) arc (-30:180:0.7cm and 0.3cm);
\draw [black,fill=gray!60] (1.5,0.3) ellipse (0.5cm and 0.3cm);
\node (a) at (1.5,-0.3) {$U\subset \mathbb{R}^n$};
\end{tikzpicture}
%\caption{$2$-Torus $T^2 = S^1\times S^1$. }
\end{center}
\end{figure}
\pause
We can consider the \textbf{Laplacian} $L:C^\infty(M)\longrightarrow C^\infty(M)$ and its \textbf{spectrum}
$\text{spec}(L)=\{\lambda_0, \lambda_1, \cdots, \lambda_k, \cdots \longrightarrow \infty\}$.
\begin{itemize}
\pause
\item If we are given $\text{spec}(L)$ we can infer the dimension of $M$, its volume and its total scalar curvature.
\end{itemize}
\end{frame}

\begin{frame}{Spectral Geometry for Dimensionality Reduction?}
Let us assume we have data points $x_1, \cdots, x_k\in\mathbb{R}^N$ which lie on an \underline{unknown} submanifold $M\subset\mathbb{R}^N$.
\begin{block}{Key Observation}
\begin{itemize}
\item Eigenfunctions  of $L$ on $M$ can be used to define lower dimensional embeddings.
\end{itemize}
\end{block}

\begin{block}{Idea (\cite{BN2003})}
\begin{itemize}
\item Model $M$ by constructing a graph $G=(V,E)$ where close data points are connected by edges.
\pause
\item
Construct the graph Laplacian $L$ on $G$.
\pause
\item
Compute \text{spec}(L) and the corresponding eigenfunctions.
\pause
\item Use these eigenfunctions to construct an embedding $F:V\longrightarrow \mathbb{R}^m$ for $m<N$.
\end{itemize}
\end{block}
\end{frame}

\section{Warming Up}

\subsection{The Spectral Theorem}

\begin{frame}{The Spectral Theorem}
Let $A\in M_{n\times n}(\mathbb{R})$ be a symmetric matrix, i.e. $A=A^\dagger$.
\pause
\begin{block}{Recall}
\begin{itemize}
\item $\lambda\in\mathbb{C}$ is an {\bf eigenvalue} for A with {\bf eigenvector} $f\in\mathbb{R}^n$, $f\neq 0$, if
$$Af=\lambda f.$$
\item A set of vectors $\mathcal{B} = \{f_1, f_2, \cdots, f_n\}$ is a {\bf basis} for $\mathbb{R}^n$ if:
\begin{itemize}
\item They are linearly independent.
\item They generate $\mathbb{R}^n$.
\end{itemize}
\item $\mathcal{B}$ is said to be an {\bf orthonormal} basis if $\langle f_i, f_j\rangle = \delta_{ij}$.
\end{itemize}
\pause
\end{block}
\begin{block}{Spectral Theorem}
There exists an orthonormal basis of $\mathbb{R}^n$ consisting of eigenvectors of $A$. Each eigenvalue is real.
\end{block}
\end{frame}

\begin{frame}{Min(Max)imizing Properties of Eigenvalues}
Let $A\in M_n(\mathbb{R})$ be a symmetric matrix with spectral decomposition $\lambda_0 \leq \lambda_1 \leq \cdots \leq \lambda_n$. \\
\vspace{0.3 cm}
For later purposes, we would like to find
\begin{align*}
\argmax_{||f||=1} \langle Af, f \rangle.
\end{align*}
\begin{itemize}
\pause
\item Define the associated Lagrange optimization problem
\begin{align*}
\mathcal{L}(f, \lambda) = \langle Af, f \rangle -\lambda(||f||^2 - 1).
\end{align*}
\pause
\item Take the derivative with respect to $f$
\begin{align*}
\frac{\partial}{\partial f} \mathcal{L}(f, \lambda) = 2(Af - \lambda f )\stackrel{!}{=} 0.
\end{align*}
\pause
\item Hence,
\begin{align*}
\argmax_{||f||=1} \langle Af, f \rangle = f_n
\quad \text{and}\quad
\argmin_{||f||=1} \langle Af, f \rangle = f_0.
\end{align*}
\end{itemize}
\end{frame}

\section{Motivation}

\subsection{Toy Model Example}

\begin{frame}{Step 0: Understand the Problem}
Consider the problem of mapping these points to a line so that close points stay as together as possible.
\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\node [draw, circle] (a) at (0,0) {1};
\node [draw, circle] (b) at (-0.5,2) {2};
\node [draw, circle] (c) at (0,-1.5) {3};
\node [draw, circle] (d) at (3,0) {4};
\end{tikzpicture}
%\caption{$2$-Torus $T^2 = S^1\times S^1$. }
\end{center}
\end{figure}
\end{frame}

\begin{frame}{Step 1: From Data to Adjacency Graph}
\begin{itemize}
\item Define a distance function: first nearest neighbour.
 \pause
\item For each node, attach an edge for close points.
\end{itemize}
\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\node [draw, circle] (a) at (0,0) {1};
\node [draw, circle] (b) at (-0.5,2) {2};
\node [draw, circle] (c) at (0,-1.5) {3};
\node [draw, circle] (d) at (3,0) {4};
\pause
\path [-] (a) edge node[left] {} (c);
\pause
\path [-] (b) edge node[left] {} (a);
\pause
\path [-] (d) edge node[left] {} (a);
\end{tikzpicture}
%\caption{$2$-Torus $T^2 = S^1\times S^1$. }
\end{center}
\end{figure}
\end{frame}

\begin{frame}{Step 2: Construct the Adjacency and Degree Matrices}
\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\node [draw, circle] (a) at (0,0) {1};
\node [draw, circle] (b) at (-0.5,2) {2};
\node [draw, circle] (c) at (0,-1.5) {3};
\node [draw, circle] (d) at (3,0) {4};
\path [-] (a) edge node[left] {} (c);
\path [-] (b) edge node[left] {} (a);
\path [-] (d) edge node[left] {} (a);
\end{tikzpicture}
%\caption{$2$-Torus $T^2 = S^1\times S^1$. }
\end{center}
\end{figure}
\begin{align*}
W = \left(
\begin{array}{cccc}
 0 & 1 & 1 & 1 \\
 1 & 0 & 0 & 0 \\
 1 & 0 & 0 & 0 \\
 1 & 0 & 0 & 0
\end{array}
\right)
\quad
D = \left(
\begin{array}{cccc}
 3 & 0 & 0 & 0 \\
 0 & 1 & 0 & 0 \\
 0 & 0 & 1 & 0 \\
 0 & 0 & 0 & 1
\end{array}
\right)
\end{align*}
\end{frame}

\begin{frame}{Step 3: Spectrum of the Graph Laplacian}
\begin{itemize}
\item Construct the operator $L$ defined by

\begin{align*}
L \coloneqq D - W  = \left(
\begin{array}{cccc}
 3 & -1 & -1 & -1 \\
 -1 & 1 & 0 & 0 \\
 -1 & 0 & 1 & 0 \\
 -1 & 0 & 0 & 1
\end{array}
\right)
\end{align*}

\item Consider the generalized eigenvalue problem
$$Lf = \lambda D f.$$
Equivalently, $D^{-1}Lf = \lambda f$.
\pause
\item Eigenvalues: $\lambda_0 =0 , \lambda_1 =1, \lambda_2 = 1, \lambda_3 =2$.
\pause
\item An eigenvector for $\lambda_1 = 1$ is $y\coloneqq f_1 = (0,-3,1,2)$.
\pause
\item The vector $y:V\longrightarrow\mathbb{R}$ defines and embedding.
\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\node [draw, circle] (a) at (0,0) {1};
\node [draw, circle] (b) at (-3,0) {2};
\node [draw, circle] (c) at (1,0) {3};
\node [draw, circle] (d) at (2,0) {4};
\path [-] (a) edge node[left] {} (b);
\path [-] (a) edge node[left] {} (c);
\path [-] (c) edge node[left] {} (d);
\end{tikzpicture}
%\caption{$2$-Torus $T^2 = S^1\times S^1$. }
\end{center}
\end{figure}
\end{itemize}
\end{frame}

\section{The Algorithm}

\subsection{Description}

\begin{frame}{The Algorithm}
Let $x_1, \cdots, x_k\in\mathbb{R}^N$.
\begin{enumerate}
\item \textbf{Construct a weighted graph} $G=(V, E)$ with $k$ nodes, one for each point, and a set of edges connecting neighbouring points.
\textbf{Select a distance function}:
\begin{itemize}
\item (Euclidean Distance) Let $\varepsilon>0$. We connect and edge between $i$ and $j$ if $||x_i-x_j||^2 < \varepsilon$.
\item $n$ nearest neighbours.
\end{itemize}
\pause
\item \textbf{Choose Weights}. If nodes $i$ and $j$ are connected, put
\begin{itemize}
\item $W_{ij}=1$.
\item (Heat Kernel) $W_{ij}\coloneqq e^{-\frac{||x_i-x_j||^2}{t}}$ for some $t > 0$.
\end{itemize}
\pause
\item Assume $G$ is connected. \textbf{Compute the eigenvalues} of the generalized eigenvector problem $Lf = \lambda D f$, where
\begin{itemize}
\item $D$ is the diagonal weight matrix, $D_{ii} = \sum_{j=1}^k W_{ij}$.
\item $L\coloneqq D - W$ is the graph Laplacian.
\end{itemize}
\pause
\item \textbf{Construct Embedding}. Let $f_0, f_1, \cdots, f_{k-1}$ be the corresponding eigenvectors ordered according to their eigenvalues ($\lambda_0 =0$). For $m<N$, set
\begin{align*}
F(i)\coloneqq (f_1(i), \cdots, f_{m}(i)).
\end{align*}
\end{enumerate}
\end{frame}

\subsection{Justification}

\begin{frame}{Why does it work?}{$m=1$}
Assume you have constructed the weighted graph $G=(V, E)$. We want to construct an embedding $F: V\longrightarrow\mathbb{R}$.\\
\vspace{0.3cm}
\underline{Hint:} Minimize
\begin{align*}
J(y)\coloneqq \sum_{i,j=1}^k (y_i - y_j)^2 W_{ij} \stackrel{*}{=} 2 y^\dagger L y.
\end{align*}
\pause
Thus, the problem reduces to find
\begin{align*}
\argmin_{\substack{
y^\dagger D y = 1\\
y^\dagger D 1 = 0}}
y^\dagger L y
=
\argmin_{\substack{
y^\dagger D y = 1\\
y^\dagger D 1 = 0}}
\langle Ly, y \rangle
\end{align*}
\begin{itemize}
\item $y^\dagger D y = 1$ fixes the scale.
\item $y^\dagger D 1 = 0$ eliminates the trivial solution $y=1$.
\end{itemize}
\pause
This translates to finding the minimum non-zero eigenvalue and eigenvector of
\begin{align*}
Ly=\lambda D y.
\end{align*}
\end{frame}

\begin{frame}{Why does it work?}{$m>1$ (Vectorize)}
Assume you have constructed the weighted graph $G=(V, E)$. We want to construct an embedding $F: V\longrightarrow\mathbb{R}^m$.\\
\vspace{0.3cm}
\underline{Hint:} Minimize, for $Y=(y_1 \cdots y_m)\in M_{k\times m}(\mathbb{R})$,
\begin{align*}
J(Y)\coloneqq \sum_{i,j=1}^k ||Y_i - Y_j||^2 W_{ij} = \text{tr}(Y^\dagger L Y).
\end{align*}
Thus, the problem reduces to find
\begin{align*}
\argmin_{\substack{
\text{tr}(Y^\dagger D Y = I)}}
\text{tr}(Y^\dagger L Y)
\end{align*}
This translates to finding the minimum non-zero eigenvalues and eigenvectors of
\begin{align*}
Lf=\lambda D y.
\end{align*}
\end{frame}

\section{Examples: Scikit-Learn}

\begin{frame}{Examples: Scikit-Learn}

Let us go to a Jupyter notebook to see some examples.

\end{frame}

\section{Spectral Geometry*}

\subsection{The Laplacian}

\begin{frame}{The Laplacian}
Second order differential operator
$L:C_c^\infty(M)\longrightarrow C_c^\infty(M)$.
\begin{itemize}
\item For $M = \mathbb{R}^n$,
\begin{align*}
L = -\sum_{i=1}^n \frac{\partial^2}{\partial x_i^2}
\end{align*}
\item For $(M, g)$ Riemannian manifold,
% - \frac{1}{\sqrt{|g|}}\sum_{i=1}^n \frac{\partial}{\partial x_i}\left(\sum_{j=1}^n \sqrt{|g|} g^{ij}\frac{\partial}{\partial x_j}\right)
\begin{align*}
L = - \sum_{i=1}^n\sum_{j=1}^n g^{ij}\frac{\partial^2}{\partial x_i \partial x_j} + \text{lower order terms}.
\end{align*}
\pause
\end{itemize}
\begin{block}{Spectral Theorem (\cite{R1997})}
L is symmetric with respect to the inner product in $C^\infty_c(M)$,
\begin{align*}
(f,g)_{L^2} = \int_M f(x)g(x)  dx.
\end{align*}
If $M$ is compact, there exists an orthonormal basis of $L^2(M)$ consisting of eigenvectors of $L$. Each eigenvalue is real.
\end{block}
\end{frame}

\begin{frame}{Embedding trough Eigenmaps}
Let $(M, g)$ be a compact Riemannian manifold and $f:M\longrightarrow \mathbb{R}$.
\begin{itemize}
\item If $x, z\in M$ are close, then
\begin{align*}
|f(x)-f(z)| \leq \text{dist}_M(x,z) ||\nabla f||+o(\text{dist}_M(x,z)).
\end{align*}
\pause
\item We want a map that best preserves locality on average,
\begin{align}\label{Eqn:argmin_f}
\argmin_{||f||_{L^2(M)}=1}\int_M ||\nabla f||^2 dx.
\end{align}
\pause
\item By Stokes' Theorem
\begin{align*}
\int_M ||\nabla f||^2 dx = \int_M (Lf)f dx = (Lf,f)_{L^2}.
\end{align*}
\item \eqref{Eqn:argmin_f} must be an eigenvalue of the Laplacian.
\end{itemize}
\end{frame}

\begin{frame}{The Graph Laplacian as a Differential Operator}
\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\node [draw, circle] (a) at (0,0) {1};
\node [draw, circle] (b) at (-0.5,2) {2};
\node [draw, circle] (c) at (0,-1.5) {3};
\node [draw, circle] (d) at (3,0) {4};
\path [->] (a) edge node[left] {} (c);
\path [<-] (b) edge node[left] {} (a);
\path [<-] (d) edge node[left] {} (a);
\node at (0, 1 ) {$e_1$};
\node at (0.3, -0.7 ) {$e_2$};
\node at (1.5, 0.3 ) {$e_3$};
\end{tikzpicture}
%\caption{$2$-Torus $T^2 = S^1\times S^1$. }
\end{center}
\end{figure}
\begin{align*}
\nabla = \left(
\begin{array}{cccc}
 -1 & 1 & 0 & 0 \\
 -1 & 0 & 1 & 0 \\
 -1 & 0 & 0 & 1
\end{array}
\right)
\quad
\Rightarrow
\quad
\nabla^\dagger \nabla = \left(
\begin{array}{cccc}
 3 & -1 & -1 & -1 \\
 -1 & 1 & 0 & 0 \\
 -1 & 0 & 1 & 0 \\
 -1 & 0 & 0 & 1
\end{array}
\right)
\end{align*}
So we see,
\begin{align*}
L = \nabla^\dagger \nabla.
\end{align*}
\end{frame}

\subsection{The Heat Kernel}

\begin{frame}{The Heat Kernel}
Let $f:M\longrightarrow \mathbb{R}$. Consider the \textbf{Heat Equation} on $M$,
\begin{align*}
\left({\partial_t} + L\right)u(x,t)  = 0
\quad \text{with intitial condition}
\quad
u(x,0) = f(x).
\end{align*}
\pause
\begin{itemize}
\item The solution is given by (\cite{R1997})
\begin{align*}
u(x,t) = \int_{M} H_t(x,y)f(y) dy,
\end{align*}
where the \textbf{Heat Kernel} has the form
\begin{align*}
H_t(x,y) = (4\pi t)^{-\text{dim}(M)/2} e^{-\frac{\text{dist}_M(x,y)^2}{4t}} (\phi(x,y) + O(t)),
\end{align*}
for certain $\phi$ is a smooth function with $\phi(x,x) = 1$.
\pause
\item It can be shown that, for $x_1, \cdots, x_k \in M$ and $t>0$ small,
\begin{align*}
Lf(x_i) \approx \frac{1}{t}\left(f(x_i) -
\frac{
\sum_{0 < ||x_i - x_j||^2 <\varepsilon}
e^{-\frac{||x_i - x_j||^2}{4t}}f(x_j)
}
{
\sum_{0 < ||x_i - x_j||^2 <\varepsilon}
e^{-\frac{||x_i - x_j||^2}{4t}}
}
\right)
\end{align*}
which justifies $W_{ij}=e^{-\frac{||x_i - x_j||^2}{4t}}$.
\end{itemize}
\end{frame}

\begin{frame}{References}{Slides and notebook available at juanitorduz.github.io}
\bibliographystyle{alpha}
\bibliography{references}
\end{frame}

\end{document}


\documentclass{article}

\begin{document}
	\author{Dr. Desmond Moru}
	\title{Cardano's Formula for Cubic Equations}
	\maketitle

	\begin{center}
		\textbf{Abstract}
	\end{center}
	Gerolamo Cardano was born in Pavia 1504 as the illegitimate child of a jurist. He attended the University of Padua and became a physician in the town of Sacco, after being rejected by his home Europe, having treated the Pope. He was also an astrologer and an avid gambler, to which he wrote the Book on Games of chance , which was the first serious treatise on the mathematics of probalitity. \cite{cardano}

	\section{ Introduction to Cardano's Formula}
	Cardano's formula for solution of cubic equations for an equation like;
	\begin{equation}
		x^3 + a1x^2 + a2x + a3 = 0
	\end{equation}
	the parameters Q, R , S and T can be computed thus,

	\begin{equation}
		Q= \frac{3a_{2} - a{1}^2}{a}
	\end{equation}
\begin{equation}
\frac{R=9a_{1}a_{2}-27a_{3}-2a_{1}^3}{54}
\end{equation}
\begin{equation}
	S=3\sqrt{R +\sqrt{-Q^3 + R^2}}
\end{equation}
\begin{equation}
	T=\sqrt{R-\sqrt{Q^3 + R^2}}
\end{equation}

to give the roots
\begin{equation}
	x_{1}= S + T -\frac{1}{3}a_{1}
\end{equation}
\begin{equation}
		x_{2} =\frac{-(S +T)}{2} -\frac{a_{1}}{3} + i\frac{\sqrt{3}(s-T)}{2}
\end{equation}
\begin{equation}
	x_{2} =\frac{-(S +T)}{2} -\frac{a_{1}}{3} + i\frac{\sqrt{3}(s-T)}{2}
\end{equation}
\subsection{Some examples}

\begin{itemize}
\item	\begin{equation}
		x^3 - 3x^2 + 4 =0
	\end{equation}
\item\begin{equation}
	2x^3 + 6x^2 + 1 =0
\end{equation}
\end{itemize}

\bibliography{take_away}
\bibliographystyle{ieeetr}
\end{document}


%\documentclass{article}
%\usepackage[all]{xy}
%\usepackage{amssymb}
%\usepackage{amsmath}
%\usepackage{amsfonts}
%\usepackage{amsthm}
%\usepackage{amscd}
%\usepackage{eucal}
%\usepackage[dvips]{epsfig}
%\usepackage{graphicx}
%\usepackage{ulem}
%\usepackage{wrapfig}
%\addtolength{\hoffset}{-2cm}
%\addtolength{\topmargin}{-2.8cm}
%\addtolength{\textwidth}{3 cm}
%\addtolength{\textheight}{6.2 cm}
%
%\def\ii{{\bf i}}
%\def\jj{{\bf j}}
%\def\kk{{\bf k}}
%\def\aa{{\bf a}}
%\def\bb{{\bf b}}
%\def\nn{{\bf n}}
%\def\uu{{\bf u}}
%\def\vv{{\bf v}}
%\def\rr{{\bf r}}
%\def\ff{{\bf F}}
%
%\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\chapter{DERIVATION OF THE $\Upsilon$ FUNCTION}%
\label{appendixB}

%%\clearpage %remove this command if your appendix doesn't start with a landscaped page!!!!!
%%\thispagestyle{plain}
%%\begin{landscape}
%%\begin{figure}

 %% \begin{center}
  %%  \includegraphics[width=6in]{LaTeX2e_logo.eps}
   %% \caption{\LaTeX 2\ensuremath{\epsilon.} logo}\label{biglogo}
  %%\end{center}
%%\end{figure}
%%\end{landscape}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%ADD LABEL

Proposition B.3.

Suppose $\{\xi_{1},\xi_{2},...\}$ is a sequence of i.i.d. exponential random variables with rate $\eta>0$, and Z is a normal variable with distribution $N(0,\sigma^{2})$. Then for every $ n \geq 1$, we have: (1) The density functions are given by:

$$f_{Z+\sum_{i=1}^{n}\xi_{i}}(t)=(\sigma\eta)^{n}\frac{e^{(\sigma\eta)^{2}/2}}{\sigma\sqrt{2\pi}}e^{-t\eta}Hh_{n-1}(-\frac{t}{\sigma}+\sigma\eta)$$

$$f_{Z-\sum_{i=1}^{n}\xi_{i}}(t)=(\sigma\eta)^{n}\frac{e^{(\sigma\eta)^{2}/2}}{\sigma\sqrt{2\pi}}e^{-t\eta}Hh_{n-1}(\frac{t}{\sigma}+\sigma\eta)$$

(2) The tail probabilities are given by

$$P(Z+\sum_{i=1}^{n}\xi_{i}\geq x) = (\sigma\eta)^{n}\frac{e^{(\sigma\eta)^{2}/2}}{\sigma\sqrt{2\pi}}e^{-t\eta}I_{n-1}(x;-\eta,-\frac{1}{\sigma},-\sigma\eta)$$

$$P(Z-\sum_{i=1}^{n}\xi_{i}\geq x) = (\sigma\eta)^{n}\frac{e^{(\sigma\eta)^{2}/2}}{\sigma\sqrt{2\pi}}e^{-t\eta}I_{n-1}(x;\eta,\frac{1}{\sigma},-\sigma\eta)$$

Proof. Case 1. The densities of $Z+\sum_{i=1}^{n}\xi_{i}$, and $Z-\sum_{i=1}^{n}\xi_{i}$. We have

$$f_{Z+\sum_{i=1}^{n}\xi_{i}}(t)=\int_{-\infty}^{\infty}f_{\sum_{i=1}^{n}\xi_{i}}(t-x)f_{Z}(x)dx$$

$$=e^{-t\eta}(\eta^{n})\int_{-\infty}{t}\frac{e^{x\eta}(t-x)^{n-1}}{(n-1)!}\frac{1}{\sigma\sqrt{2\pi}}e^{-x^{2}/(2\sigma^{2})}dx$$

$$=e^{-t\eta}(\eta^{n})e^{(\sigma\eta)^{2}/(2)}\int_{-\infty}{t}\frac{(t-x)^{n-1}}{(n-1)!}\frac{1}{\sigma\sqrt{2\pi}}e^{-(x-\sigma^{2}\eta)^{2}/(2\sigma^{2})}dx$$

Letting $y=(x-\sigma^{2}\eta)/\sigma$ yields

$$f_{Z+\sum_{i=1}^{n}\xi_{i}}(t)=e^{-t\eta}(\eta^{n})e^{(\sigma\eta)^{2}/(2)}\sigma^{n-1}$$

$$\times\int_{-\infty}^{t/\sigma-\sigma\eta}\frac{(t/\sigma - y -\sigma\eta)^{n-1}}{(n-1)!}\frac{1}{\sqrt{2\pi}}e^{-y^{2}/2}dy$$

$$=\frac{e^{(\sigma\eta)^{2}/2}}{\sqrt{2\pi}}(\sigma^{n-1}\eta^{n})e^{-t\eta}Hh_{n-1}(-t/\sigma + \sigma\eta)$$

because $(1/(n-1)!)\int_{-\infty}{a}(a-y)^{n-1}e^{-y^{2}/2}dy=Hh_{n-1}(a)$. The derivation of $f_{Z+\sum_{i=1}^{n}\xi_{i}}(t)$ is similar.

Case 2. $P(Z+\sum_{i=1}^{n}\xi_{i}\geq x)$ and $P(Z-\sum_{i=1}^{n}\xi_{i}\geq x)$. From (B9), it is clear that

$$P(Z+\sum_{i=1}^{n}\xi_{i}\geq x)=\frac{(\sigma\eta)^{n}e^{(\sigma\eta)^{2}/2}}{\sigma\sqrt{2\pi}}\int_{x}^{\infty}e^{(-i\eta)}Hh_{n-1}(-\frac{t}{\sigma}+\sigma\eta)dt$$

$$=\frac{(\sigma\eta)^{n}e^{(\sigma\eta)^{2}/2}}{\sigma\sqrt{2\pi}}I_{n-1}(x;-\eta,-\frac{1}{\sigma},-\sigma\eta)dt$$

by (B6). We can compute
$P(Z-\sum_{i=1}^{n}\xi_{i}\geq x)$ similarly.

Theorem B.1. With $\pi_{n}:= P(N(t)=n)=e^{-\lambda T}(\lambda T)^{n}/n!$ and $I_{n}$ in Proposition B.
, we have

$$P(Z(T)\geq a)=\frac{e^{(\sigma \eta_{1})^{2} T/2}}{\sigma \sqrt{2 \pi T}} \sum_{n=1}^{\infty} \pi_{n} \sum_{k=1}^{n} P_{n,k}(\sigma\sqrt{T}\eta_{1})^{k}\times I_{k-1}(a-\mu T; -\eta_{1},-\frac{1}{\sigma\sqrt{T}},-\sigma\eta_{1}\sqrt{T})$$

$$+\frac{e^{(\sigma\eta_{2})^{2}T/2}}{\sigma\sqrt{2\pi T}}\sum_{n=1}^{\infty}\pi_{n}\sum_{k=1}^{n}Q_{n,k}(\sigma\sqrt{T}\eta_{2})^{k}$$

$$\times I_{k-1}(a-\mu T; \eta_{2},\frac{1}{\sigma\sqrt{T}},-\sigma\eta_{2}\sqrt{T})$$

$$+\pi_{0}\phi(-\frac{a-\mu T}{\sigma\sqrt{T}})$$

Proof by the decomposition (B2)

%\end{document}


\section{Statistical Analysis through RAVEN}
\label{sec:SAraven}
In order to perform a complete analysis of a system under uncertainties,
it is crucial to be able to compute all the statistical moments of one or even multiple
FOMs. In addition, it is essential to identify the correlation
among different FOMs toward a specific input space.

RAVEN is able to compute the most important statistical moments:
such as:
\begin{enumerate}
  \item \textit{Expected Value}
  \item \textit{Standard Deviation}
  \item \textit{Variance}
  \item \textit{variationCoefficient}
  \item \textit{Skewness}
  \item \textit{Kurtosis}
  \item \textit{Median}
  \item \textit{Percentile}.
\end{enumerate}
In addition, RAVEN fully supports the computation of all of the statistical moments defined to
``measure'' the correlation among variables/parameters/FOMs:
\begin{enumerate}
  \item \textit{Covariance matrix}
  \item \textit{Normalized Sensitivity  matrix}
  \item \textit{Variance Dependent Sensitivity  matrix}
  \item \textit{Sensitivity matrix}
  \item \textit{Pearson matrix}.
\end{enumerate}
The goals of this section is to show how to:
 \begin{enumerate}
   \item Set up a sampling strategy to perform a final statistical analysis
   perturbing a driven code
   \item Compute all the statistical moments and correlation/covariance
   metrics.
\end{enumerate}
In order to accomplish these tasks, the following RAVEN \textbf{Entities} (XML blocks in the input files) need to be defined:
\begin{enumerate}
   \item \textbf{\textit{RunInfo}}:
     \xmlExample{framework/user_guide/StatisticalAnalysis/statisticalAnalysis.xml}{RunInfo}
   As shown in the other examples, the \textit{RunInfo} \textbf{Entity} is intended  to set up the desired analysis . In this specific case, two steps  (\xmlNode{Sequence}) are  sequentially run
   using forty processors (\xmlNode{batchSize}).
   \\In the first step, the original physical model is sampled. The obtained results are  analyzed with the Statistical Post-Processor.
   \item \textbf{\textit{Files}}:
     \xmlExample{framework/user_guide/StatisticalAnalysis/statisticalAnalysis.xml}{Files}
   Since the driven code uses a single input file, in this section the original input is placed. As detailed in the user manual
   the attribute  \xmlAttr{name} represents the alias that is going to be
   used in all the other input blocks in order to refer to this file.
   \\In addition, the output file of the \textit{PostProcess} \textbf{Step} is
   here defined (XML format).
   \item \textbf{\textit{Models}}:
     \xmlExample{framework/user_guide/StatisticalAnalysis/statisticalAnalysis.xml}{Models}
 The goal of this example is to show how the
 principal statistical FOMs can be computed through RAVEN.
 \\Indeed, in addition to the previously explained Code
 model, a Post-Processor model (BasicStatistics) is here specified.
Note that the post-process step is
performed on all the variables with respect to the parameters used in this example ( $A,\, B,\, C \, and \, D$
with respect to $sigma-A,\,sigma-B,\, decay-A,$ and $decay-B$).
   \item \textbf{\textit{Distributions}}:
     \xmlExample{framework/user_guide/StatisticalAnalysis/statisticalAnalysis.xml}{Distributions}
  In the Distributions XML section, the stochastic models for the
  uncertainties are reported. In
  this case 2 distributions are defined:
  \begin{itemize}
    \item $sigma \sim \mathbb{U}(0,1000)$, used to model the uncertainties
    associated with  the Model \textit{sigma-A} and \textit{sigma-B}
    \item  $decayConstant \sim \mathbb{U}(1e-8,1e-7)$,  used to
    model the uncertainties
    associated with  the Model \textit{decay-A} and \textit{decay-B}.
  \end{itemize}
   \item \textbf{\textit{Samplers}}:
     \xmlExample{framework/user_guide/StatisticalAnalysis/statisticalAnalysis.xml}{Samplers}
  In order to obtained the data-set through which the statistical FOMs need to be computed, a \textit{MonteCarlo} sampling approach is here employed.
   \item \textbf{\textit{DataObjects}}:
     \xmlExample{framework/user_guide/StatisticalAnalysis/statisticalAnalysis.xml}{DataObjects}
  Int this block, two \textit{DataObjects} are defined:
  1) PointSet named ``samplesMC'' used to collect the final outcomes of
  the code,
  2) HistorySet named ``histories'' in which the full time responses of the
  variables $A,B,C,D$ are going to be stored.

   \item \textbf{\textit{Steps}}:
     \xmlExample{framework/user_guide/StatisticalAnalysis/statisticalAnalysis.xml}{Steps}

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   Finally, all the previously defined \textbf{Entities} can be combined in
   the \xmlNode{Steps} block. As inferable,
   2 \xmlNode{Steps} have been inputted:
   \begin{itemize}
     \item \xmlNode{MultiRun} named ``sampleMC'', used to run the
     multiple
     instances of the driven code and
     collect the outputs in the two \textit{DataObjects}. As it can be
     seen, the \xmlNode{Sampler} is inputted to communicate to the
     \textit{Step} that the driven code needs to
     be perturbed through the Grid sampling strategy.
     \item \xmlNode{PostProcess} named ``statisticalAnalysisMC'', used
     compute all the statistical moments and FOMs based on the
     data obtained through the sampling strategy. As it can be noticed,
     the \xmlNode{Output} of the ``sampleMC'' \textit{Step} is the
     \xmlNode{Input} of the ``statisticalAnalysisMC''  \textit{Step}.
   \end{itemize}
\end{enumerate}

Tables \ref{ScalarMoments}-\ref{SensitivityComputed} show all the results of the \textit{PostProcess}
step.

\begin{landscape}
\begin{table}[h!]
\centering
\caption{Computed Moments and Cumulants.}
\label{ScalarMoments}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
{\ul \textit{\textbf{Computed Quantities}}} & \textbf{A} & \textbf{B} & \textbf{C} & \textbf{D} & \textbf{decay-A} & \textbf{decay-B} & \textbf{sigma-A} & \textbf{sigma-B} \\ \hline
\textit{expected value}                     & 5.97E-02   & 3.97E-01   & 9.82E-01   & 1.50E+00   & 5.57E-08         & 5.61E-08         & 5.07E+02         & 4.73E+02         \\ \hline
\textit{median}                             & 2.45E-02   & 3.06E-01   & 9.89E-01   & 1.54E+00   & 5.73E-08         & 5.62E-08         & 5.11E+02         & 4.70E+02         \\ \hline
\textit{variance}                           & 8.19E-03   & 6.00E-02   & 1.19E-02   & 1.49E-02   & 7.00E-16         & 6.83E-16         & 8.52E+04         & 8.64E+04         \\ \hline
\textit{sigma}                              & 9.05E-02   & 2.45E-01   & 1.09E-01   & 1.22E-01   & 2.64E-08         & 2.61E-08         & 2.92E+02         & 2.94E+02         \\ \hline
\textit{variation coefficient}              & 1.52E+00   & 6.17E-01   & 1.11E-01   & 8.15E-02   & 4.75E-01         & 4.66E-01         & 5.75E-01         & 6.21E-01         \\ \hline
\textit{skewness}                           & 2.91E+00   & 9.88E-01   & -1.49E-01  & -9.64E-01  & -6.25E-02        & -5.75E-02        & -2.18E-02        & 7.62E-02         \\ \hline
\textit{kurtosis}                           & 9.56E+00   & -1.12E-01  & -6.98E-01  & -1.50E-01  & -1.24E+00        & -1.21E+00        & -1.21E+00        & -1.20E+00        \\ \hline
\textit{percentile 5\%}                     & 2.87E-03   & 1.48E-01   & 7.89E-01   & 1.24E+00   & 1.42E-08         & 1.45E-08         & 5.08E+01         & 2.97E+01         \\ \hline
\textit{percentile 95\%}                    & 2.51E-01   & 9.19E-01   & 1.16E+00   & 1.63E+00   & 9.54E-08         & 9.48E-08         & 9.59E+02         & 9.49E+02         \\ \hline
\end{tabular}
\end{table}
\begin{table}[h!]
\centering
\caption{Covariance matrix.}
\label{covarianceComputed}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
{\ul \textit{\textbf{Covariance}}} & \textbf{A} & \textbf{B} & \textbf{C} & \textbf{D} & \textbf{decay-A} & \textbf{decay-B} & \textbf{sigma-A} & \textbf{sigma-B} \\ \hline
\textbf{A}                         & 8.19E-03   & -1.11E-03  & -3.09E-03  & -1.13E-04  & -1.28E-09        & 5.14E-11         & -1.49E+01        & -3.74E-01        \\ \hline
\textbf{B}                         & -1.11E-03  & 6.00E-02   & 2.26E-03   & -2.96E-02  & -7.80E-11        & -6.02E-09        & 7.00E+00         & -1.47E+00        \\ \hline
\textbf{C}                         & -3.09E-03  & 2.26E-03   & 1.19E-02   & 7.15E-04   & -1.44E-09        & -4.11E-12        & 2.63E+01         & 3.19E-01         \\ \hline
\textbf{D}                         & -1.13E-04  & -2.96E-02  & 7.15E-04   & 1.49E-02   & -1.21E-10        & 3.01E-09         & 1.12E+00         & 8.01E-01         \\ \hline
\textbf{decay-A}                   & -1.28E-09  & -7.80E-11  & -1.44E-09  & -1.21E-10  & 7.00E-16         & -1.73E-17        & -1.26E-07        & 2.07E-07         \\ \hline
\textbf{decay-B}                   & 5.14E-11   & -6.02E-09  & -4.11E-12  & 3.01E-09   & -1.73E-17        & 6.83E-16         & -1.86E-07        & 3.91E-08         \\ \hline
\textbf{sigma-A}                   & -1.49E+01  & 7.00E+00   & 2.63E+01   & 1.12E+00   & -1.26E-07        & -1.86E-07        & 8.52E+04         & 1.79E+03         \\ \hline
\textbf{sigma-B}                   & -3.74E-01  & -1.47E+00  & 3.19E-01   & 8.01E-01   & 2.07E-07         & 3.91E-08         & 1.79E+03         & 8.64E+04         \\ \hline
\end{tabular}
\end{table}
\begin{table}[h!]
\centering
\caption{Correlation matrix.}
\label{pearsonComputed}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
{\ul \textit{\textbf{Correlation}}} & \textbf{A} & \textbf{B} & \textbf{C} & \textbf{D} & \textbf{decay-A} & \textbf{decay-B} & \textbf{sigma-A} & \textbf{sigma-B} \\ \hline
\textbf{A}                          & 1.00E+00   & -5.02E-02  & -3.13E-01  & -1.03E-02  & -5.35E-01        & 2.17E-02         & -5.63E-01        & -1.40E-02        \\ \hline
\textbf{B}                          & -5.02E-02  & 1.00E+00   & 8.47E-02   & -9.90E-01  & -1.20E-02        & -9.41E-01        & 9.80E-02         & -2.04E-02        \\ \hline
\textbf{C}                          & -3.13E-01  & 8.47E-02   & 1.00E+00   & 5.37E-02   & -4.98E-01        & -1.44E-03        & 8.25E-01         & 9.96E-03         \\ \hline
\textbf{D}                          & -1.03E-02  & -9.90E-01  & 5.37E-02   & 1.00E+00   & -3.75E-02        & 9.43E-01         & 3.14E-02         & 2.23E-02         \\ \hline
\textbf{decay-A}                    & -5.35E-01  & -1.20E-02  & -4.98E-01  & -3.75E-02  & 1.00E+00         & -2.50E-02        & -1.64E-02        & 2.67E-02         \\ \hline
\textbf{decay-B}                    & 2.17E-02   & -9.41E-01  & -1.44E-03  & 9.43E-01   & -2.50E-02        & 1.00E+00         & -2.44E-02        & 5.08E-03         \\ \hline
\textbf{sigma-A}                    & -5.63E-01  & 9.80E-02   & 8.25E-01   & 3.14E-02   & -1.64E-02        & -2.44E-02        & 1.00E+00         & 2.08E-02         \\ \hline
\textbf{sigma-B}                    & -1.40E-02  & -2.04E-02  & 9.96E-03   & 2.23E-02   & 2.67E-02         & 5.08E-03         & 2.08E-02         & 1.00E+00         \\ \hline
\end{tabular}
\end{table}
\begin{table}[h!]
\centering
\caption{Variance Dependent Sensitivity matrix.}
\label{VarDepSensitivityComputed}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
{\ul \textit{\textbf{Variance Sensitivity}}} & \textbf{A} & \textbf{B} & \textbf{C} & \textbf{D} & \textbf{decay-A} & \textbf{decay-B} & \textbf{sigma-A} & \textbf{sigma-B} \\ \hline
\textbf{A}                                   & 1.00E+00   & -1.36E-01  & -3.77E-01  & -1.38E-02  & -1.56E-07        & 6.27E-09         & -1.82E+03        & -4.56E+01        \\ \hline
\textbf{B}                                   & -1.86E-02  & 1.00E+00   & 3.77E-02   & -4.94E-01  & -1.30E-09        & -1.00E-07        & 1.17E+02         & -2.45E+01        \\ \hline
\textbf{C}                                   & -2.60E-01  & 1.90E-01   & 1.00E+00   & 6.01E-02   & -1.21E-07        & -3.46E-10        & 2.21E+03         & 2.68E+01         \\ \hline
\textbf{D}                                   & -7.60E-03  & -1.99E+00  & 4.80E-02   & 1.00E+00   & -8.11E-09        & 2.02E-07         & 7.51E+01         & 5.37E+01         \\ \hline
\textbf{decay-A}                             & -1.83E+06  & -1.11E+05  & -2.05E+06  & -1.73E+05  & 1.00E+00         & -2.47E-02        & -1.81E+08        & 2.96E+08         \\ \hline
\textbf{decay-B}                             & 7.52E+04   & -8.82E+06  & -6.02E+03  & 4.40E+06   & -2.53E-02        & 1.00E+00         & -2.72E+08        & 5.72E+07         \\ \hline
\textbf{sigma-A}                             & -1.75E-04  & 8.22E-05   & 3.08E-04   & 1.32E-05   & -1.48E-12        & -2.19E-12        & 1.00E+00         & 2.10E-02         \\ \hline
\textbf{sigma-B}                             & -4.33E-06  & -1.70E-05  & 3.69E-06   & 9.27E-06   & 2.40E-12         & 4.52E-13         & 2.07E-02         & 1.00E+00         \\ \hline
\end{tabular}
\end{table}
\begin{table}[h!]
\centering
\caption{Sensitivity matrix.}
\label{SensitivityComputed}
\begin{tabular}{|c|c|c|c|c|}
\hline
{\ul \textit{\textbf{Sensitivity (I/O)}}} & \textbf{decay-A} & \textbf{decay-B} & \textbf{sigma-A} & \textbf{sigma-B} \\ \hline
\textbf{A}                                & 3.83E-06         & -1.78E-04        & -2.07E+04        & -1.86E+06        \\ \hline
\textbf{B}                                & -1.36E-05        & 6.28E-05         & -8.80E+06        & -3.14E+05        \\ \hline
\textbf{C}                                & 2.17E-06         & 3.05E-04         & 2.64E+04         & -2.00E+06        \\ \hline
\textbf{D}                                & 6.96E-06         & 2.25E-05         & 4.40E+06         & -6.19E+04        \\ \hline
\end{tabular}
\end{table}
\end{landscape}


\documentclass[tiles]{cornellnotes}

\title{Data Science}
\author{Naga Nitish}
\date{May 2020}

\begin{document}
        \maketitle
        \section{Probability}
        \begin{cuenotes}
                \cue{first cue?}
                \note{
                        \subsection*{Introduction}
                        \begin{itemize}
                                \item Probability is the liklihood of event occuring
                                \item Trail -- Observing an event occur and note the outcome
                                \item Experiment -- Collection of trails
                                \item Expected value -- The outcome we expect from an experiment
                                \item Probability frequency distribution --  collection of probabilities of each possible outcome of an event
                                \item Permutations -- represents the number of different possible ways we can arrange a set of elements -- $n!$
                                \item Variations -- represents the number of different possible ways we can pick and arrange a number of elements
                                \begin{itemize}
                                        \item With repetition -- $n^p$
                                        \item Without repetition -- $^nP_p=\frac{n!}{(n-p)!}$
                                \end{itemize}
                                \item Combinations -- represents number of different possible ways we can pick elements
                                \item Baye's theorem -- $P(A|B) = P(B|A)*P(A)/P(B)$
                        \end{itemize}
                }
                \cue{second cue?}
                \note{
                        \subsection*{Distributions}
                        There are two types of distributions: They are Discrete and Continuous
                }
                \note{
                        \subsubsection*{Discrete}
                        \begin{enumerate}
                                \item Uniform
                                \item Bernoulli
                                \begin{itemize}
                                        \item one trail -- two possibilities
                                        \item $E(Y)=p$
                                        \item $Var(Y)=p(1-p)$
                                \end{itemize}
                                \item Binomial
                                \begin{itemize}
                                        \item measures the frequencies of occurrence of one of the possible outcomes over n trails
                                        \item $P(Y=y) = C(y,n)\times p^y\times (1-p)^{n-y}$
                                        \item $E(Y) = n\times p$
                                        \item $Var(Y) = n\times p\times (1-p)$
                                \end{itemize}
                                \item Poisson
                                \begin{itemize}
                                        \item measures the frequency over an interval of time or distance
                                        \item only non-negative values
                                        \item $P(Y=y) = \frac{\lambda^y}{y!e^{-\lambda}}$
                                        \item $E(Y) = Var(Y) = \lambda$
                                \end{itemize}
                        \end{enumerate}
                }
                \cue{third cue?}
                \note{
                        \subsubsection*{Continuous}
                        \begin{enumerate}
                                \item Normal
                                \begin{itemize}
                                        \item bell shaped, symmetric, thin tails
                                        \item $E(Y) = \mu$
                                        \item $Var(Y) = \sigma^2$
                                \end{itemize}
                                \item Students' T
                                \begin{itemize}
                                        \item a small sample size approximation of normal distribution
                                        \item bell shaped, symmetric, flat tails
                                        \item accounts for extreme values better than normal distribution
                                        \item $Var(Y) = s^2 \times \frac{k}{k-2}$
                                \end{itemize}
                                \item Chi squared
                                \begin{itemize}
                                        \item asymmetric, skewed to right
                                        \item it is square of T distribution
                                        \item $E(Y) = k$
                                        \item $Var(Y) = 2k$
                                \end{itemize}
                                \item Exponential
                                \begin{itemize}
                                        \item Both PDF and CDF plateau after certain point
                                        \item $E(Y) = \frac{1}{\lambda}$
                                        \item $Var(Y) = \frac{1}{\lambda^2}$
                                \end{itemize}
                                \item Logistic
                                \begin{itemize}
                                        \item The smaller the scale parameter, the quicker it reaches 1.0
                                        \item $E(Y) = \mu$
                                        \item $Var(Y) = \frac{s^2 \times \pi^2}{3}$
                                \end{itemize}
                        \end{enumerate}
                }
        \end{cuenotes}
        \summary{
                \begin{enumerate}
                        \item something random
                        \item something random
                        \item something random
                \end{enumerate}
        }
        \section{Statistics}
        \begin{cuenotes}
                \cue
                \note{
                        \subsection*{Types of Data}
                        \subsubsection*{Qualitative data or categorical data}
                        \begin{itemize}
                                \item Nominal - values not order
                                \item Ordinal - there is order or ranking
                        \end{itemize}
                        \subsubsection*{Quantitative data}
                        \begin{itemize}
                                \item Discrete
                                \item Continuous
                        \end{itemize}
                }
                \cue
                \note{
                        \subsection*{Types of statistics}
                }
                \note{
                        \subsubsection*{Descriptive}
                        \begin{itemize}
                                \item To describe data
                                \item Measure of central tendencies
                                \begin{itemize}
                                        \item \textbf{Mean or average} -- sum of all values divided by number of values
                                        \item \textbf{Median} -- middle term in the sorted list
                                        \item \textbf{Mode} -- value with highest frequency
                                        \item \textbf{Mid-range} -- average of largest and smallest value
                                \end{itemize}
                                \item Measure of dispersion
                                \begin{itemize}
                                        \item \textbf{Range} -- largest minus smallest value
                                        \item \textbf{Standard deviation} -- square root of variance
                                        \item \textbf{Variance} -- average of squared differences of the mean
                                \end{itemize}
                                \item Frequency distributions
                                \item Histograms
                                \begin{itemize}
                                        \item It's a bar graph with equal width
                                        \item Properties -- symmetric, skewed and uniform or rectangular
                                \end{itemize}
                        \end{itemize}
                }
                \note{
                        \subsubsection*{Inferential}
                        \begin{itemize}
                                \item To make inferences from data
                                \item Hypothesis testing
                                \item ANOVA
                                \item Chi-squared tests
                                \item Regression
                        \end{itemize}
                }
                \cue
                \note{
                        \subsubsection*{Some important points}
                        \begin{itemize}
                                \item \textbf{Skewness} -- Left (negative) skewness means that the outliers are to the left
                                \item \textbf{Covariance} -- It is joint variability of two variables
                                $$\sigma_{xy} = \frac{\Sigma_{i=1}^N (x_i - \mu_x) \times (y_i - \mu_y)}{n-1}$$
                                \item \textbf{Correlation}
                                $$\rho = \frac{\sigma_{xy}}{\sigma_x \sigma_y}$$
                        \end{itemize}
                }
                \note{
                        \subsection*{Central Limit Theorem}
                        The Central Limit Theorem (CLT) is one of the greatest statistical insights. It states that no matter the underlying distribution of the dataset, the sampling distribution of the means would approximate a normal distribution. Moreover, the mean of the sampling distribution would be equal to the mean of the original distribution and the variance would be n times smaller, where n is the size of the samples. The CLT applies whenever we have a sum or an average of many variables (e.g. the sum of rolled numbers when rolling dice)
                        \begin{itemize}
                                \item \textbf{Estimator} is a mathematical function that approximates a population parameter depending only on sample information
                                \item \textbf{Estimate} is the output that we get from estimator. Point estimate and confidence interval estimate
                        \end{itemize}
                }
                \note{
                        \subsubsection*{Confidance interval estimate}
                        With population variance
                        $$\bar{x} \pm z_{\alpha/2} \times \frac{\sigma}{\sqrt{n}}$$
                        Without population variance
                        $$\bar{x} \pm t_{n-1,\alpha/2} \times \frac{s}{\sqrt{n}}$$
                        where standard error is $s/\sqrt{n}$
                }
        \end{cuenotes}
        \summary{
                \begin{enumerate}
                        \item something random
                        \item something random
                        \item something random
                        \item something random
                        \item something random
                \end{enumerate}
        }
\end{document}


\documentclass{article}
\usepackage{titling}
\usepackage{fancyhdr}
\usepackage{amsmath,bm}
\usepackage{chngcntr}
\counterwithin*{equation}{section}
\counterwithin*{equation}{subsection}
\renewcommand{\theequation}{\arabic{equation}}
\pretitle{\begin{flushleft}\huge}
\posttitle{\par\end{flushleft}\vspace{-8mm}}
\preauthor{\begin{flushleft}
            % \large \lineskip 0em%
            \begin{tabular}[t]{r}}
\postauthor{\end{tabular}\par\end{flushleft}\vspace{-8mm}}
\predate{\begin{flushleft}\small}
\postdate{\par\end{flushleft}}
\pagestyle{fancy}
\fancyhead[L]{killPRML}
\fancyhead[R]{@anlijuncn}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{4pt}
\title{Chapter 2 Probability Distributions}
\author{}
\date{}
%---------------------------------------------------%
\begin{document}
\maketitle
\section{Exercise 2.1}
By Bernulli distribution defination, we have
\begin{align}
    \sum_{x_i=0, 1} p(x_i|\mu) = \mu + (1 - \mu) = 1
\end{align}
By expectation defination, we have
\begin{align}
    E[x] = \sum_{x_i=0, 1} x_ip(x_i|\mu) = 0 * (1 - \mu) + 1 * \mu=\mu
\end{align}
By variance defination, we have
\begin{align}
    Var[x] & = \sum_{x_i=0, 1} (x_i - E[x])^2p(x_i|\mu) \\
    & = \mu^2 (1 - \mu) + (1 - \mu)^2 \mu \\
    & = \mu (1 - \mu)
\end{align}
\section{Exercise 2.2}
TO DO
\end{document}


\chapter{Conclusions and perspectives}

In this thesis, we studied the swimming of bacteria \textit{Escherichia coli} (\textit{E. coli}) near a sinusoidal boundary. We used low-density suspensions of bacteria to measure their accumulation near the curved surfaces. Through image analysis and bacterial tracking, we measured bacteria's density, speed, and residence times in the region close to the curved wall. We also developed a model of bacteria swimming, considering steric interactions with the surface.

We observed that bacteria movement in the curved surface depends on the parameters of the sinusoidal shape, namely the amplitude $A$ and the wavelength $\lambda$. Their combined effect can be largely summarized in the wall maximum curvature $\kappa=4\pi^2 A /  \lambda^2$. For lower curvatures, bacteria move along the surface quickly, and when bacteria reach a peak, they may leave the surface. As the curvature increases, bacteria become trapped in the valleys and eventually form clusters that last for several seconds. We called this transition the accumulation transition. To characterize this transition, we measured the mean density of bacteria in a period of the sinusoidal wall, through the intensity of the fluorescence of bacteria. We focused on the intensity in the curved wall, which we normalized by the mean intensity in the flat wall. This normalization ensures experiments are comparable. The accumulation transition was characterized via the Fourier coefficient $c_1$ associated with the shape of the intensity profile. We determined that the accumulation transition occurs near a critical curvature $\kappa^* =$ \SI{0.3}{\per \micro \meter}.

The model considered interactions between bacteria and the wall through the steric alignment intensity $K$ and random reorientations induced by the liquid particles through the rotational diffusion coefficient $D_r$. $K$ and $D_r$ were the only non-fixed parameters of the model. We adjusted the model parameters to replicate the values of $c_1$ resulting in the optimal values $K^*=$ \SI[per-mode = symbol]{3.0}{\radian\per\second} and $D_r^*=$ \SI[per-mode = symbol]{0.015}{\square\radian\per\second}. This values compare well to the reported measurements in the literature. In a flat surface $K=$ \SI[per-mode = symbol]{4.9}{\radian\per\second} was measured \cite{Bianchi20193DInterface}, and a lower value of $K$ is to be expected as bacteria align less with the curved surface. Also $D_r=$ \SI[per-mode = symbol]{0.057}{\square\radian\per\second} was reported for cells swimming far away from boundaries \cite{Drescher2011FluidScattering}. In our experiments, bacteria in the focal swim in contact with a frontal surface, so it is reasonable to have a lower value of $D_r$ in our case due to the geometric restrictions that the surfaces imposes on the liquid and the rotation of the bacteria.

The optimal values of the model parameters were determined only with $c_1$. Nevertheless, the model replicates other quantities such as mean accumulation in the curved wall, speed profiles near the wall, and contact times with it. This is interesting because the model is very simple. The model does not consider the spherocylindrical shape of cells, the friction with the wall, the collision and alignment between cells, and the hydrodynamic effects caused by the flagella movement. There is plenty of physics involved in these experiments, but a model with minimal ingredients predicts the observed accumulation transition and makes reasonable predictions for all the measurements we made in the experiments. This can mean only one thing, the dynamics of cells near sinusoidal walls is dominated by the effects described in the model. We conclude that the steric alignment of cells with the wall and the rotational diffusion are the primary physical mechanisms that govern the dynamics of bacteria when swimming near a curved surface.

Regarding the mean accumulation of bacteria, we discovered that near the critical curvature, a minimum of the average accumulation along the curved wall is found for the values $A=$ \SI{5.6}{\micro\meter}, $\lambda= $ \SI{27}{\micro\meter}. Nevertheless, an experiment with almost equal curvature but lower amplitude showed a higher accumulation. This is because, for these curvatures, bacteria move around the valley easily, but for higher amplitude, the bacteria leave the wall with a higher inclination and therefore move away from the surface. This is interesting for designing surfaces that reduce biofilm formation because it reveals that curvature is not the only relevant parameter. We believe that semicircular patterns are the best option to reduce accumulation of bacteria, as they are expelled with the highest inclination possible. Nevertheless, our characterization as a function of the curvature is helpful because it is independent of the shape. If we extrapolate the results of this thesis for the semicircular geometery, we can predict an optimal radius $R^*$ around $R^*=(\kappa^*)^{-1}\approx$ \SI{5}{\micro\meter} for semicircular patterns.

Thanks to the measurments of residence time of bacteria near the walls, we determined that the average contact time in the sinusoidal wall is an order of magnitude lower than in the flat surfaces. This decrease could mean that bacteria do not have time to adhere to the surface. In the future, we believe it is necessary to test this surface in more natural situations to measure its effectiveness in preventing biofilm formation.

The work done in this thesis still has plenty of room for improvement, as was discussed in the previous chapter. For example, we only have experiments with $A\approx$ \SI{9}{\micro\meter} in one day. Due to technical problems with the camera, it was impossible to generate more experimental data. We are also lacking resolution in the amplitudes, because for the wavelengths \SIlist{21;24}{\micro\meter} we cannot observe the accumulation transition optimally. Increasing the number of experiments in this range of amplitudes is crucial to elucidate the differences observed in this range. Therefore an increase of the resolution in the  $(\lambda, \ A)$ space will better describe the accumulation transition. Moreover, the experiments will benefit from data from lower amplitudes as it is expected that for curvatures near zero the behavior in the curved wall will recover the behavior of the flat surface, implying that $c_1$ and $\langle I(x) \rangle$ have a non-monotonic behavior with respect to the curvature. We also believe that a tracking-based bacterial density measure will allow a more direct comparison between experiments and simulations. Finally, the model should consider cell alignment interactions to correctly reproduce the bacteria cluster dynamics in the curved wall. The last two aspects were not considered due to time restrictions, but will be implemented in a future publication.

In summary, this thesis contributes to understanding how shape alters the accumulation of bacteria near a surface. We observe a transition in the accumulation depending on the curvature in the wall. We explain this phenomenon by a simple model that considers an alignment with the wall and rotational diffusion. By adjusting the model parameters to replicate the transition, the dependence of bacterial speed and mean density with respect to the curvature is replicated, indicating that the system's dynamics are correctly represented. This implies that the steric alignment dominates other effects typically present in experiments but not included in the model. In addition, we have shown that these surfaces reduce the accumulation of bacteria on the wall considerably as the bacteria are in contact for times an order of magnitude shorter than near flat walls. This study promises that control of biofilm formation by optimization of surface curvature is possible.


%%% Latex preamble
\documentclass[11pt]{article}
\oddsidemargin 0pt
\textwidth 6.5in
\topmargin -0.65in
\textheight 9.25in

\usepackage{epsfig}
\usepackage{natbib}
\usepackage{amssymb}
%Get the citation punctuation correct
\bibpunct{(}{)}{;}{a}{}{,}

%Set the space between paragraphs.
%Uncomment this for single spacing, comment for double spacing
\setlength{\parskip}{1.0ex plus0.5ex minus0.2ex}

%Allow colour in your output (pdf only?)
% \usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
% \definecolor{darkgreen}{rgb}{0,.5,0}	%For example
%%%End of preamble

\newcommand{\Plwr}{\ensuremath{P_{\mathrm{lwr}}}}
\newcommand{\Pupr}{\ensuremath{P_{\mathrm{upr}}}}

\begin{document}
\begin{center}
\begin{Huge} Some notes on the Box Least Squared Algorithm \end{Huge}
\end{center}

This document describes some notes on my implementation of the BLS.

\section{Choosing the optimal trial periods}

Consider a transit with period $P$ and duration $\tau$ observed continuously
for a timespan $T$. We would expect, on average, to observe $n = T/P$ transits.
Fold this lightcurve on a period $P'$. $P'$ is ``close enough" to $P$ to find the transit if
all points in transit are folded on top of each other (i.e have the same phase) in the folded lightcurve. For simplicity, we will assume that two points have the same phase if their phase differs by less than a transit duration.

Let the phase of the 0th transit is $t0$. The worst error will be on the nth transit (assuming for simplicity that $P$ and $P'$ are close enough that no wrapping in phase occurs. The phase of the $n^{\mathrm{th}}$ transit will be $t0 + n(P-P')$,  where  phase is defined to run from [0..$P$) not, say, [0, 2$\pi$).

If we want all the transits to line up, we require
$$
n(P-P') < \tau
$$

But $n = T/P$, so our requirement that all transits overlap implies
$$
(P-P') < \tau P/T
$$
%dP := (P-P') < tau \times P/T

Following Kovacs, we will call $\tau/T$ the fractional transit duration, $q$.
To do a blind search where at least one trial period is close enough
to any transit period present, we select periods

\noindent
\Plwr\\
\Plwr\ + (P-P') $= \Plwr + q \Plwr = \Plwr \times (1+q)$\\
\Plwr\ $\times (1+q)^2$\\
...\\
\Plwr\ $\times (1+q)^N$\\

\noindent
(This is considerably fewer steps than \Plwr + $Nq$ steps.)

Now, this will ensure that all transit centres lie within one transit
duration of each other in at least one folded lightcurve. However, this phase difference will still smear out the event quite a bit, making it harder to detect. So we pick an overresolution factor, $R$ to
ensure even better preformance.. Setting $R=2$ ensures
all transit centres lie within half a transit duration of each other. We redefine $q$ such that
$q = \tau/(RT)$

So how many steps, $N$, do we need to get from some \Plwr\ to some other \Pupr?

\begin{eqnarray*}
\Pupr = \Plwr(1+q)^N\\
\Rightarrow \Pupr/\Plwr = (1+q)^N\\
\Rightarrow \log_{(1+q)} (\Pupr/\Plwr) = N\\
\vspace{1ex}\\
\Rightarrow N = \frac{\ln(\Pupr/\Plwr)}{ \ln(1+q)}
\end{eqnarray*}

\section{Computational Cost}
The computational cost is driven by the number of periods searched, $N$, and time taken to bin the data. The binning time is O(n), i.e it scales linearly with the number of input points. The number of periods searched depends on the ratio of the longest and shortest period, and the assumed fractional transit duration, $q$ (i.e transit duration divided by orbital period). $N$ doubles for each factor of $e$ the period span increases. It also scales as $10^{1/q}$. For example, if $q= 0.01$, $100 \times \ln(\Pupr/\Plwr)$ periods are searched. For coding simplicity, $q$ is computed once for the shortest duration and longest period and used for all other periods. This is computationally quite inefficient, but it makes the meaning of the output much simpler. If a faster algorithm is needed, $N$ can be recomputed for each transit duration.

\begin{figure}[bht]
     \begin{center}
    \includegraphics[angle=0, scale=.4]{qplot}
    \caption{Number density of periods searched as a function of assumed fractional transit duration. The actual number of periods searched depends on the ratio between the longest and shortest periods searched.}
     \end{center}
 \end{figure}

\end{document}


{\color{indiagreen}\subsection{Predpone}}
\begin{center}
	\begin{tabular}{|c c|}
 	\hline
 	P(peta) & $10^15$ \\
 	T(tera) & $10^12$ \\
 	G(giga) & $10^9$ \\
 	M & $10^6$ \\
 	k & $10^3$ \\
 	h & $10^2$ \\
 	da & $10$ \\
 	d & $10^{-1}$ \\
 	c & $10^{-2}$ \\
 	m & $10^{-3}$ \\
 	$\mu$& $10^{-6}$ \\
 	n & $10^{-9}$ \\
 	p(piko) & $10^{-12}$ \\
 	f(fento) & $10^{-15}$ \\
 	\hline
 	\end{tabular}
\end{center}


\section{Problem Definitions}
In this section, we provide the formal problem definitions on how to choose the \emph{design parameters} of
an LSM tree. Before proceeding, we give a brief introduction to our notation.

\subsection{Notation}\label{sec:notation}
As we discussed above, LSM trees have two types of parameters: the \emph{design parameters} and the \emph{system parameters}.  One can think of the design parameters as those that someone who aims to optimize the performance of
an LSM tree can tune, while the system parameters are given and therefore untunable.

\Paragraph{Design Parameters}
The design parameters we consider in this paper (in accordance with the related
    work~\cite{Dayan2017,Dayan2018a,Luo2020b}) are the  size-ratio ({\sizeratio}),
    the memory allocated to the Bloom filters ({\mfilt}), the memory allocated to
    the write buffer ({\mbuf}) and the policy ({\policy}) as shown in Table
    \ref{tab:model-design-params}.
Recall that the policy refers to either leveling or tiering, as discussed in the previous section.

\begin{table}[h]\centering%\small
    %\vspace{-0.1in}
\renewcommand{\arraystretch}{1.1}
\begin{tabular}{cl}
    \toprule
    Term & Definition \\
    \midrule
        $\mfilt$ &  Memory allocated for Bloom filters  \\
        $\mbuf$ &  Memory allocated for the write buffer \\
        $\sizeratio$ &  Size ratio between consecutive levels   \\
        \policy & Compaction policy (\emph{tiering}/\emph{leveling}) \\
    \bottomrule
\end{tabular}
\caption{\emph{Design} parameters of an LSM tree.}
	\label{tab:model-design-params}
	%\vspace{-0.35in}
\end{table}

\Paragraph{System Parameters} A complicated data structure like LSM trees also has other various \emph{system parameters} and other non-tunable as shown in Table \ref{tab:model-system-params} (e.g., total memory ({\mtot}), size of data entries $E$, page size $B$, data size $N$).

\begin{table}[h]\centering%\small
    %\vspace{-0.1in}
\renewcommand{\arraystretch}{1.1}
\resizebox{\columnwidth}{!}{
\begin{tabular}{cl}
    \toprule
    Term & Definition \\
    \midrule
    $\mtot$ & Total memory (Bloom filters+write buffer)    ($\mtot=\mbuf+\mfilt$)\\
        $E$ &  Size of a key-value entry  \\
        $B$ &  Number of entries that fit in a page   \\
        $N$ & Total number of entries    \\
    \bottomrule
\end{tabular}
}
\caption{\emph{System} and untunable parameters of an LSM tree.}
	\label{tab:model-system-params}
%	\vspace{-0.05in}
\end{table}

\Paragraph{LSM Tree Configuration} In terms of notation we use $\configuration$ to denote the
LSM tree tuning configuration which essentially describes the values of the
tunable parameters together  $\configuration := (\sizeratio, \mfilt, \policy)$. Note that we only
use the memory for Bloom filters $\mfilt$ and not
$\mbuf$, because the latter can be derived using the
former and the
total available memory: $\mbuf=\mtot-\mfilt$.

\Paragraph{Workload}  The choice of the parameters in $\configuration$
depends on the input (expected) workload, i.e., the fraction of
empty lookups
    ({\emptylookup}), non-empty lookups ({\nonemptylookup}), range lookups
    ({\range}), and write ({\update}) queries, as shown in Table \ref{tab:workload-params}.
A workload can therefore be expressed as a vector
    ${\workload = (\emptylookup, \nonemptylookup, \range, \update)^\intercal \geq 0}$
    describing the proportions of the different kinds of queries.
Clearly, $\emptylookup+\nonemptylookup+\range+\update = 1$ or alternatively:
$\workload^\intercal \columnvec = 1$ where {\columnvec} denotes a column vector of
    ones. %of the same dimension as {\workload}.

\begin{table}[h]\centering%\small
    %\vspace{-0.1in}
\renewcommand{\arraystretch}{1.1}
\begin{tabular}{cl}
    \toprule
    Term & Definition \\
    \midrule
        $z_0$ & Percentage of zero-result point lookups\\ %in the workload \\
        $z_1$ & Percentage of non-zero-result point lookups\\ %in the workload  \\
        $q$ & Percentage of range queries\\ %in the workload  \\
        $w$ & Percentage of updates\\ %in the workload  \\
    \bottomrule
\end{tabular}
\caption{Parameters describing the \emph{workload}.}
    \label{tab:workload-params}
    %\vspace{-0.35in}
\end{table}

\noindent Each type of query (non-empty lookups, empty lookups, range lookups and writes) has a different cost, denoted as
$Z_0(\configuration)$, $Z_1(\configuration)$, $Q(\configuration)$, $W(\configuration)$, as there is a dependency between
the cost of each type of query and the design ${\configuration}$.
For easiness of notation, we use
    $\costvec(\configuration) = \left(Z_0(\configuration), Z_1(\configuration), Q(\configuration), W(\configuration)\right)^\intercal$
    to denote the vector of the costs  of executing
    different types of queries.
Thus, given a specific configuration ({\configuration}) and a workload ({\workload}),
    the expected cost for the workload can be computed as:
{%
%\small
\begin{equation}
    \label{eq:thecost}
    \cost(\workload, \configuration) = \workload^\intercal
    \costvec(\configuration)=\nonemptylookup \cdot
    Z_0(\configuration)+\emptylookup \cdot Z_1(\configuration) + \range\cdot Q(\configuration) + \update \cdot W(\configuration).
\end{equation}
}%

\subsection{The Nominal Tuning Problem}
Traditionally, the designers have focused on finding the
configuration ${\configuration}^\ast$ that minimizes the total cost %$\cost(\workload, \configuration^\ast;\varphi)$,
$\cost(\workload, \configuration^\ast)$,
 for a given fixed workload $\workload$.  We call this problem the
 {\nominal} problem, defined as follows:

 \begin{problem}[{\nominal}]\label{problem:nominal}
 Given fixed $\workload$  find the tuning configuration of the LSM tree $\configuration_N$ such that
\begin{equation}
\label{eq:nominal_problem}
    \configuration_N = \argmin_{\configuration} \cost(\workload, \configuration).
\end{equation}
\end{problem}

\noindent The nominal tuning problem described above
captures the classical tuning paradigm. It uses a
cost-model to find a system configuration that
minimizes the cost given a specific workload and
system environment. Specifically, prior tuning
approaches for LSM trees solve the nominal tuning
problem when proposing optimal memory allocation,
and merging policies \cite{Dayan2017,Dayan2018a,Luo2020a}.

\subsection{The Robust Tuning Problem}
\label{subsec:robust-tuning}

In this work, we attempt to compute high-performance configurations that minimize
    expected cost of operation, as expressed in Equation~\eqref{eq:thecost},
    in the presence of uncertainty with respect to the expected workload.

%\Paragraph{Uncertain Workload:}
In the {\nominal} problem, the designers assume perfect information about the
    workload for which to tune the system. For example, they may assume that the
    input vector $\workload$ represents the workload for which they have to
    optimize. While in practice, $\workload$ is simply an estimate of what the
    workload will look like.
Hence, the configuration obtained by solving Problem~\ref{problem:nominal} may
    result in high variability in the system performance; which will inevitably
    depend on the actual observed workload upon the deployment of the system.

We capture this uncertainty by reformulating Problem~\ref{problem:nominal} to
    take into account the variability that can be observed in the input workload.
Given expected workload $\workload$, we introduce the notion of the
    \emph{uncertainty region} of $\workload$, which we denote by
    $\mathcal{U}_\workload$.

We can define the robust version of Problem~\ref{problem:nominal}, under the
assumption that there is uncertainty in the input workload as follows:

\begin{problem}[{\robustw}]\label{problem:robustw}
Given $\workload$ and uncertainty region $\mathcal{U}_\workload$
find the tuning configuration of the LSM tree $\configuration_R$ such that
\begin{eqnarray}
\label{eq:robust_workload_problem}
\configuration_R &=& \argmin_{\configuration} \cost(\obsworkload,
    \configuration) \nonumber\\
    \textrm{s.t.,}&& \obsworkload \in \mathcal{U}_{\workload}.
\end{eqnarray}
\end{problem}

Note that the above problem definition intuitively states the following: it recognizes that the input workload $\workload$ won't
be observed exactly, and it assumes that any workload in $\mathcal{U}_\workload$ is possible.  Then, it searches for the
configuration $\configuration_\workload$ that is best for the \emph{worst-case} scenario among all those in $\mathcal{U}_\workload$.

The challenge in solving {\robustw}  is that one needs to explore all the workloads in the uncertainty region
in order to solve the problem.  In the next section, we show that this is not necessary.  In fact, by appropriately rewriting
the problem definition we show that we can solve Problem~\ref{problem:robustw} in polynomial time.

%
%$\mathcal{U}_{\workload}$ represents the \emph{uncertainty region} around
%    the expected workload {\workload}; a set of  workloads similar to but
%    not exactly the same as {\workload}.
%In Section~\ref{sec:robust_lsm_tuning}, we explain in detail the
%    parameterization of the uncertainty region
%    based on the number of sample workloads used during the computation of the
%    expected workload and the confidence of the designer on how relevant the
%    observed samples are to the future workloads.


\section{Applications: Judging Wine Quality}

As a sort of fun application, I found a dataset on UCI's archive from a paper by
Cortez et al. \cite{2009CCAMR} which charted various physicochemical properties
of a set of white wine, and had corresponding 'quality' (judged by a committee,
the CVRVV) levels for each data point. The reason why I decided to try this
dataset, is not only because knowing what makes alcohol quality clearly
a very important task, but also because in the original paper, their uncertainty
regarding the relevancy of all input variables was noted. That is, this is an
interesting opportunity to try a feature selection method: my method of choice
this time was ridge-regression, the $\ell^2$ variant of LASSO. See Figures
\ref{fig:linearwine} and \ref{fig:ridgewine} for the linear and ridge regression
variants, respectively.
\begin{figure}[!htb]
  \centering
  \begin{subfigure}{.5\textwidth}
    \centering
    \includegraphics[width=\linewidth]{./resources/linear_wine}
    \caption{}\label{fig:linearwine}
  \end{subfigure}%
  \begin{subfigure}{.5\textwidth}
    \centering
    \includegraphics[width=\linewidth]{./resources/ridge_wine}
    \caption{}\label{fig:ridgewine}
  \end{subfigure}
  \caption{
    Both converge in rougly four to eight epochs, but it should be noted
    that neither converges to the true solution. Regardless of how I chose the
    learning rate, it appeared that both runs of \hogwild\ would get stuck in
    a noise ball somewhere close to the true solution. This is an important
    failing of stochastic gradient methods in general, sometimes the noise
    generated will prevent us from seeing a 'true' solution, and indeed the
    ridge-regressed version didn't properly feature select, whereas the solution
    computed via CVX saw the 11th feature to be most weighted (The 11th feature,
    to my amusement, is alcohol content. Certainly an important part of what
    makes a good wine...).
  }
\end{figure}


\section{Dynamic Model}

The Dynamic Model excel file is provided
\href{http://ucanr.edu/sites/fruittree/How-to_Guides/Dynamic_Model_-_Chill_Accumulation/}{here} and its use is explained
\href{http://ucanr.edu/sites/fruittree/files/49320.pdf}{here}.

\begin{enumerate}
\item \func{Fahrenheit\_to\_Celsius(temp\_cel)} converts Fahrenheit temp. to Celsius. Celsius is the proper form of temp. used in the model.

\code{Input}:
\begin{itemize}
\item \vari{temp\_cel}  A real valued temp. or a column of a
data frame containing the temp in the Celsius format.
\end{itemize}

\code{output}
\begin{itemize}
\item A real valued temp. in Fahrenheit or a column of
data frame.
\end{itemize}

%%%%%%%%%%%%%%%

\item \func{initiate\_data\_frame(col\_names, init\_temp\_c, const)} Creates a new data frame
of size $2 \times 13$ and fills in the cells which are to be used
by dynamic model. It corresponds to rows 11 and 12 of the
model given in the excel file.

\code{Input}:

\begin{itemize}
\item \vari{col\_names}  The names of columns of the data frame to be used in the model.

{\footnotesize {$ \vari{col\_names} = [ \text{date}, \:
                                    \text{ time},
                                     \text{temp\_c},
                                     \text{temp\_k},
                                     \text{ftmprt},
                                     \text{sr},
                                     \text{xi},
                                     \text{xs},
                                     \text{ak1},
                                     \text{Inter-S},
                                     \text{Inter-E},
                                     \text{delt},
                                     \text{Portions}] $}}

\item \vari{init\_temp\_c}. Initial temps. corresponding to cells C11 and C12
of the excel file. $\vari{init\_{temp\_c}} = (15, 12)$.

\item \vari{const} An object of the class \vari{constants} containing
constants of the model. They are given below and in
the D1 through D8 cells of the excel
file.
%%%%%%%%%
\iffalse
\begin{align*}
\vari{const}
&=  \begin{bmatrix}
           \vari{e0} \\
           \vari{e1} \\
           \vari{a0}\\
           \vari{a1}\\
           \vari{slp}\\
           \vari{tetmlt}\\
           \vari{aa}\\
           \vari{ee}
         \end{bmatrix}  =
      \begin{bmatrix}
           4.15E+03 \\
           1.29E+04\\
           1.40E+05 \\
           2.57E+18\\
           1.6\\
           277\\
           \vari{a0} / \vari{a1}\\
           \vari{e1} - \vari{e0}
         \end{bmatrix}
\end{align*}
\fi
%%%%%%%%%

\begin{table}[!htb]
\caption{\vari{const} object}
\begin{center}
    \begin{tabular}{| l | l | l | l | l | l| l| l| l | l | l | p{1cm} |}
     \hline
    \scriptsize{\texttt{e0}} & \scriptsize{\texttt{e1}} & \scriptsize{\texttt{a0}} & \scriptsize{\texttt{a1}} & \scriptsize{\texttt{slp}} & \scriptsize{\texttt{tetmlt}} & \scriptsize{\texttt{aa}} & \scriptsize{\texttt{ee}} \\ \hline
             \scriptsize{\texttt{4.15E+03}} & \scriptsize{\texttt{1.29E+04}} & \scriptsize{\texttt{1.40E+05}} & \scriptsize{2.57E+18} & \scriptsize{\texttt{1.6}} & \scriptsize{\texttt{277}} & \scriptsize{\texttt{a0 / a1}} & \scriptsize{\texttt{e1 - e0}}  \\ \hline
    \end{tabular}
\end{center}
 \label{table:None}
\end{table}

\end{itemize}

\code{output:} A data frame of the following form.

\begin{table}[!htb]
\caption{initial data frame to construct the model with.}
\vspace{-.1in}
\begin{center}
    \begin{tabular}{| l | l | l| l | l | l | l | l | l| l| l| l | p{1cm} |}
    \hline
    \scriptsize{date}  & \scriptsize{time} & \scriptsize{temp\_c} & \scriptsize{temp\_k}  &  \scriptsize{ftmprt} & \scriptsize{sr} & \scriptsize{xi} & \scriptsize{xs} & \scriptsize{ak1} & \scriptsize{Inter-S} & \scriptsize{Inter-E} & \scriptsize{delt} & \scriptsize{Portions} \\ \hline
     \scriptsize{\texttt{None}} & \scriptsize{\texttt{None}} & \scriptsize{\texttt{15} }& \scriptsize{\texttt{288}} & \scriptsize{\texttt{16.93}} & \scriptsize{\texttt{22471935.51}} & \scriptsize{\texttt{1}} & \scriptsize{v{.81}} & \scriptsize{\texttt{.09}} & \scriptsize{\texttt{0.00}} & \scriptsize{\texttt{.07}} & \scriptsize{\texttt{0.00}} & \scriptsize{0}\\ \hline
     \scriptsize{\texttt{None}}  & \scriptsize{\texttt{None}} & \scriptsize{\texttt{12}} & \scriptsize{\texttt{285}} & \scriptsize{\texttt{12.44}} & \scriptsize{\texttt{252887.94}} & \scriptsize{\texttt{1}} & \scriptsize{\texttt{1.11}} & \scriptsize{\texttt{.06}} & \scriptsize{\texttt{.07}} & \scriptsize{\texttt{.13}} & \scriptsize{\texttt{0.00}} & \scriptsize{{0}}  \\ \hline
    \end{tabular}
\end{center}
 \label{table:None1}
\end{table}

\item \func{fill\_in\_the\_table(given\_table, const)}
 This function takes the \vari{const} object and \vari{given\_table}
 as input and runs the model to fill in the
 proper information that we need to compute the Chill Portions
 which is the ultimate goal of the model.

 \code{input:}
 \begin{itemize}
 \item \vari{given\_table} Is the data frame that contains
 the first two rows, like the one given by
Table \ref{table:None1} and the first three
 columns, from row 3 to the end, are provided by
 datalogger and are read off the disk. Anything from the column
 \code{temp\_k}  onward is computed and filled by this function.

\item \vari{const}: The object containing constants of the model
mentioned before.
 \end{itemize}

\code{output:} A complete table that has the Chill Portions for the
data of out orchard.

\item \func{dynamic\_model(path\_to\_data, col\_names, init\_temp\_c, const)}

This function takes the path of the file we wish
to compute the Chilling portions for, along with
other inputs that we have already mentioned
before, and produces the Chilling Portions.

\code{input:}
\begin{itemize}
\item \vari{path\_to\_data}: the path to the data location on the disk.
\item \vari{col\_names}: Name of the columns
of the data frame, like mentioned before. These
names has to be exact, because they are used for
computations in the model.\\

{\color{red}{\textsc{NOTE}}}: These data should have temp. in
Celsius. And it is assumed the first three columns
are \code{date}, \code{time} and \code{temp} respectively.\\

\item \vari{init\_temp\_c} Initial temp. as mentioned before.

\item \vari{const}: An object containing the constants of the model.
\end{itemize}

\code{output:} A data frame containing all information we need.
(Shall I change this so that it just gives the \vari{Portions}?)

\end{enumerate}


\section{Dam break involving a dry area}

The dam break problem involving a dry area was solved analytically by Ritter~\cite{Ritter1892} as well as Stoker~\cite{Stoker1948, Stoker1957}. The analytical solution exhibits a rarefaction fan as a parabolic curve. As water moves, it involves wetting process over the dry area.

The initial condition is
\begin{equation} \label{eq:db_dry_init}
u(x,0)=0, ~~v(x,y)=0, ~~\textrm{and}~~
h(x,0) = \left\{ \begin{array}{ll}
h_1 & \textrm{if $x < 0$}\\
0 & \textrm{if $x > 0$}\\
\end{array} \right.
\end{equation}
where $h_1>0$. The topography is a horizontal flat bed.

The analytical solution~\cite{Ritter1892, Stoker1948, Stoker1957} at time $t>0$ is
\begin{equation}
h(x) = \left\{ \begin{array}{ll}
h_1 & \textrm{if $x \leq -t \sqrt{gh_1}$}\\
h_R=\frac{4}{9g}(\sqrt{gh_1}-\frac{x}{2t})^2 & \textrm{if $-t \sqrt{gh_1} <x \leq 2t\sqrt{gh_1}$}\\
0 & \textrm{if $x \geq 2t\sqrt{gh_1}$}\\
\end{array} \right.
\end{equation}
which is the free surface and
\begin{equation}
u(x) = \left\{ \begin{array}{ll}
0 & \textrm{if $x \leq -t \sqrt{gh_1}$}\\
u_R=\frac{2}{3}(\sqrt{gh_1}+\frac{x}{t}) & \textrm{if $-t \sqrt{gh_1} <x \leq 2t\sqrt{gh_1}$}\\
0 & \textrm{if $x \geq 2t\sqrt{gh_1}$}\\
\end{array} \right.
\end{equation}
which is the velocity.

\subsection{Results}
For our test, we consider $h_1=10$ in (\ref{eq:db_dry_init}).
The following figures show the stage, $x$-momentum, and $x$-velocity at several instants of time. We should see excellent agreement between the analytical and numerical solutions. The wet/dry interface is difficult to resolve and it usually produces large errors.

\begin{figure}
\begin{center}
\includegraphics[width=0.8\textwidth]{stage_plot.png}
%\label{fig:db_dry_stage}
\end{center}
\caption{Stage results}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[width=0.8\textwidth]{xmom_plot.png}
%\label{fig:db_dry_xmom}
\end{center}
\caption{Xmomentum results}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[width=0.8\textwidth]{xvel_plot.png}
%\label{fig:db_dry_xvel}
\end{center}
\caption{Xvelocity results}
\end{figure}

\endinput


%----------------------------------------------------------------------------
\chapter{Radio Propagation Models}
\label{chap:propagation}

This chapter describes the radio propagation models implemented in \ns.
These models are used to predict the received signal power of
each packet. At the physical layer of each wireless node, there is a receiving
threshold. When a packet is received, if its signal power is below the receiving
threshold, it is marked as error and dropped by the MAC layer.

Up to now there are three propagation models in \ns, which are the free
space model\footnote{Based on the code contributed to \ns~from the CMU Monarch
project.}, two-ray ground reflection model\footnote{Contributed to \ns~from the
CMU Monarch project.} and the shadowing model\footnote{Implemented in \ns~by
Wei Ye at USC/ISI}. Their implementation can be found in \nsf{propagation.\{cc,h\}},
\nsf{tworayground.\{cc,h\}} and \nsf{shadowing.\{cc,h\}}. This documentation
reflects the APIs in ns-2.1b7.

%----------------------------------------------------------------------------
\section{Free space model}
\label{sec:freespace}

The free space propagation model assumes the ideal propagation condition
that there is only one clear line-of-sight path between the transmitter and
receiver. H. T. Friis presented the following equation to
calculate the received signal power in free space at distance $d$ from the
transmitter \cite{Friis46}.

\begin{equation}
  P_r (d) = \frac{P_t G_t G_r \lambda^2}{(4\pi)^2 d^2 L}
  \label{eqn:freespace}
\end{equation}

where $P_t$ is the transmitted signal power. $G_t$ and $G_r$ are the antenna
gains of the transmitter and the receiver respectively. $L (L\ge1)$ is the
system loss, and $\lambda$ is the wavelength. It is common to select
$G_t = G_r = 1$ and $L = 1$ in \ns~ simulations.

The free space model basically represents the communication range as a circle
around the transmitter. If a receiver is within the circle, it receives all
packets. Otherwise, it loses all packets

The OTcl interface for utilizing a propagation model is the \code{node-config}
command. One way to use it here is

\begin{program}
$ns_ node-config -propType Propagation/FreeSpace
\end{program}

Another way is

\begin{program}
set prop [new Propagation/FreeSpace]
$ns_ node-config -propInstance $prop
\end{program}

%----------------------------------------------------------------------------
\section{Two-ray ground reflection model}
\label{sec:tworay}

A single line-of-sight path between two mobile nodes is seldom the only means
of propation. The two-ray ground reflection model considers both the direct
path and a ground reflection path. It is shown \cite{Rappaport96} that this
model gives more accurate prediction at a long distance than the free space
model. The received power at distance $d$ is predicted by

\begin{equation}
  P_r (d) = \frac{P_t G_t G_r {h_t}^2 {h_r}^2}{d^4 L}
  \label{eqn:tworay}
\end{equation}

where $h_t$ and $h_r$ are the heights of the transmit and receive antennas
respectively. Note that the original equation in \cite{Rappaport96} assumes
$L = 1$. To be consistent with the free space model, $L$ is added here.

The above equation shows a faster power loss than Eqn. (\ref{eqn:freespace})
as distance increases. However, The two-ray model does not give a good result
for a short distance due to the oscillation caused by the constructive and
destructive combination of the two rays. Instead, the free space model is
still used when $d$ is small.

Therefore, a cross-over distance $d_c$ is calculated in this model. When
$d < d_c$, Eqn. (\ref{eqn:freespace}) is used. When $d > d_c$, Eqn.
(\ref{eqn:tworay}) is used. At the cross-over distance, Eqns. (\ref{eqn:freespace})
and (\ref{eqn:tworay}) give the same result. So $d_c$ can be calculated as

\begin{equation}
%  d_c = \frac{4\pi h_t h_r}{\lambda}
  d_c = \left( 4\pi h_t h_r \right) / \lambda
  \label{eqn:crossover}
\end{equation}

Similarly, the OTcl interface for utilizing the two-ray ground reflection model
is as follows.

\begin{program}
$ns_ node-config -propType Propagation/TwoRayGround
\end{program}

Alternatively, the user can use

\begin{program}
set prop [new Propagation/TwoRayGround]
$ns_ node-config -propInstance $prop
\end{program}

%----------------------------------------------------------------------------
\section{Shadowing model}
\label{sec:shadowing}

\subsection{Backgroud}

The free space model and the two-ray model predict the received power
as a deterministic function of distance. They both represent the communication
range as an ideal circle. In reality, the received power at certain distance
is a random variable due to multipath propagation effects, which is also
known as fading effects. In fact, the above two models predicts the mean
received power at distance $d$. A more general and widely-used model is
called the shadowing model~\cite{Rappaport96}.

The shadowing model consists of two parts. The first one is known as path
loss model, which also predicts the mean received power at distance $d$,
denoted by $\overline{P_r(d)}$. It uses a close-in distance $d_0$ as
a reference. $\overline{P_r(d)}$ is computed relative to $P_r(d_0)$
as follows.

\begin{equation}
  \frac{P_r(d_0)}{\overline{P_r(d)}} = {\left( \frac{d}{d_0} \right)}^\beta
  \label{eqn:pathloss}
\end{equation}

$\beta$ is called the path loss exponent, and is usually empirically
determined by field measurement. From Eqn. (\ref{eqn:freespace}) we
know that $\beta = 2$ for free space propagation. Table~\ref{tab:pathlossexp}
gives some typical values of $\beta$.
Larger values correspond to more obstructions and hence faster
decrease in average received power as distance becomes larger. $P_r(d_0)$
can be computed from Eqn. (\ref{eqn:freespace}).

\begin{table}
\begin{center}
  \centering \small
  \begin{tabular}{|l|l|c|}
  \hline \multicolumn{2}{|c|}{\bf{Environment}} & $\beta$ \\
  \hline Outdoor & Free space & 2 \\
  \cline{2 - 3}  & Shadowed urban area & 2.7 to 5 \\
  \hline In building & Line-of-sight & 1.6 to 1.8 \\
  \cline{2 - 3}  & Obstructed & 4 to 6 \\ \hline
  \end{tabular}
  \caption{Some typical values of path loss exponent $\beta$}
  \label{tab:pathlossexp}
\end{center}
\end{table}
\begin{table}
\begin{center}
  \centering \small
  \begin{tabular}{|l|c|}
  \hline \bf{Environment} & $\sigma_{dB}$ (dB) \\
  \hline Outdoor & 4 to 12 \\
  \hline Office, hard partition & 7 \\
  \hline Office, soft partition & 9.6 \\
  \hline Factory, line-of-sight & 3 to 6 \\
  \hline Factory, obstructed & 6.8 \\ \hline
  \end{tabular}
  \caption{Some typical values of shadowing deviation $\sigma_{dB}$}
  \label{tab:stddb}
\end{center}
\end{table}

The path loss is usually measured in dB. So from Eqn. (\ref{eqn:pathloss})
we have

\begin{equation}
  {\left[ \frac{\overline{P_r(d)}}{P_r(d_0)} \right]}_{dB} =
    -10 \beta \log \left( \frac{d}{d_0} \right)
  \label{eqn:pathlossdb}
\end{equation}

The second part of the shadowing model reflects the variation of the
received power at certain distance. It is a log-normal random variable,
that is, it is of Gaussian distribution if measured in dB. The overall
shadowing model is represented by

\begin{equation}
{\left[ \frac{P_r(d)}{P_r(d_0)} \right]}_{dB} =
    -10 \beta \log \left( \frac{d}{d_0} \right) + X_{dB}
  \label{eqn:shadowing}
\end{equation}

where $X_{dB}$ is a Gaussian random variable with zero mean and
standard deviation $\sigma_{dB}$. $\sigma_{dB}$ is called the
shadowing deviation, and is also obtained by measurement. Table
~\ref{tab:stddb} shows some typical values of $\sigma_{dB}$. Eqn.
(\ref{eqn:shadowing}) is also known as a log-normal shadowing model.

The shadowing model extends the ideal circle model to a richer
statistic model: nodes can only probabilistically communicate when
near the edge of the communication range.

\subsection{Using shadowing model}

Before using the model, the user should select the values of the path
loss exponent $\beta$ and the shadowing deviation $\sigma_{dB}$
according to the simulated environment.

The OTcl interface is still the \code{node-config} command. One way to
use it is as follows, and the values for these parameters are just examples.

\begin{program}
# first set values of shadowing model
Propagation/Shadowing set pathlossExp_ 2.0  ;# path loss exponent
Propagation/Shadowing set std_db_ 4.0       ;# shadowing deviation (dB)
Propagation/Shadowing set dist0_ 1.0        ;# reference distance (m)
Propagation/Shadowing set seed_ 0           ;# seed for RNG

$ns_ node-config -propType Propagation/Shadowing
\end{program}

The shadowing model creates a random number generator (RNG) object. The RNG has
three types of seeds: raw seed, pre-defined seed (a set of known good seeds)
and the huristic seed (details in Section~\ref{sec:random}). The
above API only uses the pre-defined seed. If a user want different seeding
method, the following API can be used.

\begin{program}
set prop [new Propagation/Shadowing]
$prop set pathlossExp_ 2.0
$prop set std_db_ 4.0
$prop set dist0_ 1.0
$prop seed <seed-type> 0              ;# user can specify seeding method

$ns_ node-config -propInstance $prop
\end{program}

The \code{<seed-type>} above can be \code{raw}, \code{predef} or \code{heuristic}.

%--------------------------------------------------------------------------------

\section{Communication range}
\label{sec:commrange}

In some applications, a user may want to specify the communication range of
wireless nodes. This can be done by set an appropriate value of the receiving
threshold in the network interface, \ie,

\begin{program}
Phy/WirelessPhy set RXThresh_ <value>
\end{program}

A separate C program is provided at \nsf{indep-utils/propagation/threshold.cc}
to compute the receiving threshold. It can be used for all the
propagation models discussed in this chapter. Assume you have compiled it and get
the excutable named as \code{threshold}. You can use it to compute the threshold
as follows

\begin{program}
threshold -m <propagation-model> [other-options] distance
\end{program}

where \code{<propagation-model>} is either \code{FreeSpace}, \code{TwoRayGround}
or \code{Shadowing}, and the \code{distance} is the communication range in meter.

\code{[other-options]} are used to specify parameters other than their
default values. For the shadowing model there is a necessary parameter,
\code{-r <receive-rate>}, which specifies the rate of correct reception at the
\code{distance}. Because the communication range in the shadowing model is not
an ideal circle, an inverse Q-function \cite{Rappaport96} is used to calculate the
receiving threshold. For example, if you want 95\% of packets can be correctly
received at the distance of 50m, you can compute the threshold by

\begin{program}
threshold -m Shadowing -r 0.95 50
\end{program}

Other available values of \code{[other-options]} are shown below

\begin{program}
-pl <path-loss-exponent> -std <shadowing-deviation> -Pt <transmit-power>
-fr <frequency> -Gt <transmit-antenna-gain> -Gr <receive-antenna-gain>
-L <system-loss> -ht <transmit-antenna-height> -hr <receive-antenna-height>
-d0 <reference-distance>
\end{program}

%-------------------------------------------------------------------------------

\section{Commands at a glance}
\label{sec:propcommand}

Following is a list of commands for propagation models.

\begin{flushleft}
\code{$ns_ node-config -propType <propagation-model>}\\
This command selects \code{<propagation-model>} in the simulation. the
\code{<propagation model>} can be \code{Propagation/FreeSpace},
\code{Propagation/TwoRayGround} or \code{Propagation/Shadowing}

\code{$ns_ node-config -propInstance $prop}\\
This command is another way to utilize a propagation model. \code{$prop} is
an instance of the \code{<propagation-model>}.

\code{$sprop_ seed <seed-type> <value>}\\
This command seeds the RNG. \code{$sprop_} is an instance of the shadowing model.

\code{threshold -m <propagation-model> [other-options] distance}\\
This is a separate program at \nsf{indep-utils/propagation/threshold.cc}, which
is used to compute the receiving threshold for a specified communication range.

\end{flushleft}

\endinput
%------------------------------------------------------------------------------