\documentclass[11pt]{article}

\usepackage[margin=1.2in]{geometry}
\usepackage[colorlinks,unicode]{hyperref}
\usepackage[all]{xy}
\usepackage[nottoc,numbib]{tocbibind}
\usepackage{amsmath,amsthm,amsfonts,longtable,verbatim,tikz-cd,multicol,amssymb,wasysym,setspace,graphicx}

%UNCOMMENT THIS LATER!
\usepackage{plastex}

% Packages incompatible with plastex.
%%%%%%\usepackage{xspace}
%%%%%%\usepackage{mathtools}
%%%%%%\usepackage{mathrsfs}
\urlstyle{same}

\usepackage[inline]{enumitem}

\onehalfspacing

\newcommand{\bb}{\medbreak}
\newcommand{\nt}{\noindent}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Cc}{\mathbb{C}}
\newcommand{\rt}{\xrightarrow{}}
\newcommand{\xrt}{\xrightarrow}
\newcommand{\cg}{\mathfrak{g}}
\newcommand{\cd}{\cdot}
\newcommand{\id}{\text{id}}
\newcommand{\gl}{\mathfrak{gl}}
\newcommand{\GL}{\text{GL}}
\newcommand{\ad}{\text{ad}}
\newcommand{\End}{\text{End}}
\newcommand{\Der}{\text{Der}}
\newcommand{\chr}{\text{char}}
\newcommand{\tr}{\text{tr}}
\newcommand{\rad}{\text{Rad}}
\newcommand{\prim}{\text{prim}}
\newcommand{\im}{\text{Im}}
\newcommand{\spn}{\text{span}}
\newcommand{\gsl}{\mathfrak{sl}}
\newcommand{\iso}{\text{Iso}}
\newcommand{\ind}{\text{Ind}}
\newcommand{\ob}{\text{ob}}
\newcommand{\CC}{\mathscr{C}}
\newcommand{\DD}{\mathscr{D}}
\newcommand{\aut}{\text{Aut}}
\newcommand{\rank}{\text{rank}}
\newcommand{\ux}{\underline{x}}
\newcommand{\uy}{\underline{y}}
\newcommand{\Rep}{\text{Rep}}
\newcommand{\Tr}{\text{Tr}}
\newcommand{\Mod}{\text{Mod}}
\newcommand{\Vect}{\textbf{Vect}}
\newcommand{\op}{\text{op}}
\newcommand{\ev}{\text{ev}}
\newcommand{\coev}{\text{coev}}

% this is to highlight words that are being defined and enter.
\newcommand{\define}[1]{\textbf{#1}}

% The next two lines define a reasonable looking not divides sign.
\DeclareMathSymbol{\nmid}{\mathrel}{AMSb}{"2D}
\newcommand{\notdiv}{\nmid}

% Make the tilde command wider
\renewcommand{\tilde}{\widetilde}

% the following two commands change the way the footnote symbol is
% made to be old fashioned: *, dagger, etc.
\renewcommand{\thefootnote}{\fnsymbol{footnote}}

% We start with things like lemmas, theorems, etc.
\newtheorem{lemma}{Lemma}[section]
\newtheorem{theorem}[lemma]{Theorem}
\newtheorem{cor}[lemma]{Corollary}
\newtheorem*{scholium}{Scholium}
\newtheorem{proposition}[lemma]{Proposition}

% Now we create things like definitions, examples, comments, etc.
\theoremstyle{definition}
\newtheorem{definition}[lemma]{Definition}
\newtheorem{example}[lemma]{Example}
\newenvironment{comments}{}{}
\newenvironment{solution}{\smallskip\par\noindent\emph{Solution: }}{}
\newenvironment{note}{}{}

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

\title{Talk: Hopf algebras}
\author{Ted Jones-Healey}
\date{}

\begin{document}

%\maketitle

\begin{abstract}Notes based on a talk on the relationship between Hopf algebra's, category theory and Knot theory. Majid \cite{alma9916633704401631} was the main source for this material, although \cite{etingof2016tensor} and \cite{alma9956076580001631} were also useful.\end{abstract}

\tableofcontents

\section{Introduction}
We try to keep this self-contained, but realistically a small amount of understanding of tensor products, dual spaces and basic category theory is required. Plan:
\begin{itemize}
  \item Tensor products $\rt$ monoidal categories. Examples: $\Vect$, Rep(G).
  \item Dual vector spaces $\rt$ rigid monoidal categories. Examples: $\Vect^\text{fd}$, Rep(G)$^\text{fd}$.
  \item Definition of Hopf algebras (Examples: Group algebras, tensor/symmetric algebras, universal enveloping algebra)\begin{itemize}
    \item $H$-Mod is monoidal and $H$-Mod$^\text{fd}$ is rigid monoidal.
    \item $H$-Mod generalises Rep$(G)$
    %define algebra representation, show every repn of G defines a representation of the algebra $kG$, which is equivalent to a $kG$-module. Recall $kG$ is Hopf algebra.
    \item Define quasitriangular Hopf algebras.
  \end{itemize}
  \item Define braided monoidal category. Examples: $\Vect$, $H$-Mod for quasitriangular $H$.
  \item Application: Knot theory.
\end{itemize}

\section{Monoidal categories}\label{mon_cat}
Tensor products are essential to defining Hopf algebras, and we will see that a monoidal structure is the categorical generalisation of a tensor product. In the following all structures are taken to be linear over a field $k$ of characteristic $0$, usually just assume $k=\Cc$.\bb

\nt Given two $k$-vector spaces $V,W$, the \define{tensor product} $V\otimes W$ is a vector space made up $k$-linear combinations of symbols called ``pure tensors'' $v\otimes w$ for $v\in V,w\in W$ satisfying:\begin{itemize}
  \item $(v_1+v_2)\otimes w=v_1\otimes w+v_2\otimes w$ and $v\otimes (w_1+w_2)=v\otimes w_1 +v\otimes w_2$
  \item $\lambda(v\otimes w)=(\lambda v)\otimes w=v\otimes (\lambda w)$ for $\lambda \in k$
\end{itemize}
First note that $k\otimes V\cong V$, which we see via the linear map $\lambda\otimes v\mapsto \lambda v$ with inverse $v\mapsto 1_k\otimes v$. Secondly, given linear maps $\phi: V\rt W, \phi':V'\rt W'$ we can define the tensor product linear map as $\phi\otimes \phi':V\otimes V'\rt W\otimes W',\ v\otimes v'\mapsto \phi(v)\otimes \phi(v')$. Note we only defined $\phi\otimes \phi'$ on pure tensors, however the assumption that $\phi\otimes \phi'$ is a linear map is enough to deduce its action on the rest of $V\otimes V'$.\bb

\nt The reason why tensor products are so useful is that they satisfy the following universal property: for every bilinear map $f:V\times W\rt Z$ there exists a unique \underline{linear} map $\bar{f}:V\otimes W\rt Z$ such that $\bar{f}(v\otimes w)=f(v,w)$. So, in effect, we can turn bilinear maps into linear map. We put this to use with an alternative definition for an algebra:

\begin{definition} We define an \define{algebra} in two equivalent ways:\begin{itemize}
  \item Definition 1: A vector space $A$ with an associative and bilinear map $m: A\times A\rt A$ (the product) and unit element $1_A\in A$ s.t. $a\cd 1_A=a=1_A\cd a\ \forall a\in A$.
  \item Definition 2: A vector space $A$ with linear map $m:A\otimes A\rt A$ satisfying the ``associativity axiom", which is the condition that the first diagram below commutes, and a ``unit map'' $\eta:k\rt A, \lambda\mapsto \lambda 1_A$ such that the second diagram commutes:
\end{itemize}
\begin{useimager}
\begin{equation*}
\xymatrix@C=4em{
  A\otimes A\otimes A \ar[r]^{m\otimes \id} \ar[d]_{\id \otimes m} & A\otimes A \ar[d]^m\\
  A\otimes A \ar[r]_m & A\\
}
\hspace{.5cm}
\xymatrix@C=4em{
  k\otimes A \ar[rd]_{\cong} \ar[r]^{\eta\otimes \id} & A\otimes A \ar[d]_m & A\otimes k \ar[l]_{\id\otimes \eta} \ar[ld]^\cong\\
  & A}
\end{equation*}
\end{useimager}
\end{definition}

\nt Note $\id:A\rt A$ is the identity linear map. There are several advantages to Definition 2, the first being that the axioms that define an algebra get reformulated as commuting diagrams. We will also express the axioms for a Hopf algebra as commuting diagrams and this helps a lot to simplify its definition. The second advantage is that by replacing bilinear maps with linear maps, we allow for a more categorical definition of an algebra. In particular, we can view an algebra as an object $A$ in $\Vect$, the category of $k$-vector spaces, with morphisms $m:A\otimes A\rt A$ and $\eta:k\rt A$ satisfying the commuting diagrams above. A crucial part of the category $\Vect$ that allows for the construction of algebras inside it is that is has notion of tensor product. Therefore we might guess that algebras could be defined in other categories so long as they have something that plays the role of the tensor product:

\begin{definition}A \define{monoidal category} is a category $C$ with the following:\begin{itemize}
  \item a functor $\otimes :C\times C\rt C$ where $C\times C$ is the product category
  \item a natural isomorphism $\Phi:(\cd \otimes \cd)\otimes \cd \rt \cd \otimes (\cd \otimes \cd)$ called the ``associator" (i.e. for all $V,W,Z\in \ob(C)$, $\Phi_{V,W,Z}:(V\otimes W)\otimes Z\xrt{\sim} V\otimes (W\otimes Z)$ is an isomorphism).
  \item an object $1\in \ob(C)$ called the ``unit'' with natural isomorphisms $l:\cd \otimes 1\rt \cd$, and $r:1\otimes \cd \rt \cd $ (i.e. $V\cong V\otimes 1\cong 1\otimes V$)
\end{itemize}
where $\Phi, l,r$ satisfying the following commuting diagrams $\forall V,W,Z,U$:
\begin{useimager}
$$\xymatrix@C=2em{
 & (V\otimes W)\otimes (Z\otimes U) \ar[rd]^\Phi & \\
((V\otimes W)\otimes Z)\otimes U \ar[ru]^{\Phi} \ar[d]_{\Phi\otimes \id} & & V\otimes (W\otimes (Z\otimes U))\\
(V\otimes (W\otimes Z))\otimes U \ar[rr]_\Phi & & V\otimes((W\otimes Z)\otimes U) \ar[u]_{\id \otimes \Phi}
}
$$
\end{useimager}
\begin{useimager}
$$\xymatrix@C=2em{
  (V\otimes 1)\otimes W \ar[rr]^\Phi && V\otimes (1\otimes W)\\
  & V\otimes W \ar[lu]^{l\otimes \id} \ar[ru]_{\id \otimes r} & \\
}$$
\end{useimager}
\end{definition}

\subsection{A detour into the Coherence theorem}
\nt It is not obvious why we should want the first diagram above to commute (known as the pentagon condition). Note that given an ordered sequence of objects $X_1,\dots,X_n$ in $C$ we can take their tensor product, but depending on the order in which take tensor products we get different bracketings on $X_1\otimes \dots \otimes X_n$, giving distinct objects of $C$. We wish to identify the different bracketings so that we can speak of $X_1\otimes\dots \otimes X_n$ unambiguously.\bb

\nt When $n=3$, we know by $\Phi$ the two ways of bracketing give isomorphic objects $X_1\otimes (X_2\otimes X_3)\cong (X_1\otimes X_2)\otimes X_3$. For general $n\geq 3$ it can then shown there is an isomorphism between any two bracketings of $X_1\otimes \dots \otimes X_n$ by repeated applications of $\Phi$. There is a beautiful way to see this using graphs theory. We identifying each bracketing of $X_1\otimes \dots \otimes X_n$ with a vertex, and connect vertices by an edge if they are related by an application of $\Phi$. The result is a convex polytope known as an ``associahedron". The associahedron in the case $n=4$ is actually depicted in the pentagon diagram above, i.e. it is a pentagon. The case $n=5$ is depicted below.
\begin{figure}\label{fig1}
\centering
\includegraphics[height=7cm]{associahedron.png}
\caption{Associahedron at $n=5$}
\label{Unknot}
\end{figure}\bb
\nt We see that any two bracketings can be related by applications of $\Phi$ as a result of the fact that there is a path between each pair of vertices on the associahedron, i.e. it is a connected graph.\bb

\nt So we have that the different bracketings give isomorphic objects, however to unambiguously identify them we need to ensure they are related by \underline{unique} isomorphisms. Looking at the associahedron we see there can be several different paths between any two vertices, corresponding to different isomorphisms between two bracketings of $X_1\otimes \dots \otimes X_n$. On the pentagon diagram (i.e. when $n=4$) we essentially have two possible routes between any pair of vertices. The pentagon condition equates the two routes between $((V\otimes W)\otimes Z)\otimes U$ and $V\otimes (W\otimes (Z\otimes U))$, but with a little thought one can see that this means the routes between any pair of vertices on the pentagon diagram are equal. The content of the ``Coherence theorem" is that this condition is sufficient to deduce that all bracketings of $X_1\otimes \dots \otimes X_n$ are related by a unique isomorphism for all $n\geq 3$, and so they can be canonically identified with each other.

\subsection{Examples}
The obvious example of a monoidal category is $\Vect$, the category of $k$-vector spaces. It can be checked that the tensor product as defined at the start satisfies all the conditions to make $\Vect$ a monoidal category, where we take the unit to be the field, i.e. $1:=k$. However a more interesting example comes from representation theory of groups.\bb

\subsubsection{Representations of groups}
\nt Recall for a group $G$ and vector space $V$, a \define{group representation} is a group homomorphism $\rho:G\rt \GL(V)$. $\GL(V)$ is the set of invertible linear maps $V\rt V$, and under a choice of basis $\{v_1,\dots,v_n\}$ for $V$ this set can be identified with $\GL_n(k)$, the $n\times n$-invertible matrices over $k$. So the map $\rho$ sends elements of our group $G$ to linear maps (or matrices) on $V$ in a way that respects the group structure.\bb

\begin{definition} The category $\Rep(G)$ has representations of $G$ for objects and morphisms as equivariant maps. One should check this indeed satisfies the axioms of a category.\end{definition}

\begin{proposition} $\Rep(G)$ is a monoidal category.
\begin{proof}
Indeed for representations $\rho_V:G\rt \GL(V), \rho_W:G\rt \GL(W)$ we define the tensor product representation as $\rho_{V\otimes W}:G\rt \GL(V\otimes W), g\mapsto \rho_V(g)\otimes \rho_W(g)$. As a sanity check first note we do have $\rho_V(g)\otimes \rho_W(g)\in \GL(V\otimes W)$, since, after first recalling the definition of a tensor product of linear maps (see start of Section \ref{mon_cat}), we find $\rho_V(g):V\rt V,\rho_W(g):W\rt W$ so $\rho_V(g)\otimes \rho_W(g):V\otimes W\rt V\otimes W$. The unit object of $\Rep(G)$ is the trivial representation, defined as $\rho_1:G\rt \GL(k)\cong k,\ \rho_1(g)=1_k\ \forall g\in G$.
\end{proof}
\end{proposition}

\begin{definition} For finite group $G$ and field $k$ (think $k=\Cc$) the \define{group algebra} $kG$ is the $k$-vector space with basis given by $g\in G$. So a general element is given by expressions of the form $\sum_{g\in G}\lambda_g g$. We define the product of basis vectors simply as $g\cd h=gh$, and extend the product linearly to the result of the vector space. More explicitly, the product rule is:
$$(\sum_{g\in G} \lambda_g g)\cd (\sum_{g'\in G} \lambda_{g'}g')=\sum_{h\in G}(\sum_g \lambda_g \lambda_{g^{-1}h})h$$
Obviously the unit of the algebra is simply the element $1$ of $G$ regarded as a vector in $kG$.
\end{definition}
\nt Indeed it can be checked this forms an algebra, so in particular it is also a ring, so we can consider modules over $kG$. Recall a (left) $R$-module is an abelian group $V$ (for instance a $k$-vector space) with an action $\rhd:R\times V\rt V$ satisfying $(r\cd s)\rhd v=r\rhd (s\rhd v)$ and $1_R\rhd v=v$.\bb

\nt The following result is very important in that it shows representation theory is just a part of module theory. Let $kG$-$\Mod$ denote the category of left $kG$-modules with morphisms being $kG$-module homomorphisms.

\begin{proposition} There is an isomorphism between the categories $\Rep(G)$ and $kG$-$\Mod$.
\begin{proof}
For every group representation $\rho:G\rt \GL(V)$ there is a left $kG$-module structure on $V$ defined via the following action:
$$(\sum_g \lambda_g g)\rhd v:= \sum_g \lambda_g \rho(g)(v)$$
It is very quick to check this satisfies axioms to be a module. Conversely, given a $kG$-module $V$, define $\rho:G\rt \GL(V)$ as $\rho(g)(v):=g\rhd v$. And again the module axioms mean that this is indeed a representation. We have implicitly defined functors between these two categories (although not explained how the functors act on morphisms). It remains to check that the action under one of the functors and then the other leaves the object unchanged, making these functors mutually inverse.
\end{proof}
\end{proposition}
\nt We see subrepresentations are equivalent to $kG$-submodules, and irreducibility of a representation is equivalent to the corresponding $kG$-module being simple. For more this see Section 3.2 of Sengupta \cite{alma9956076580001631}.

\section{Rigid monoidal categories}
We've seen that $\Vect$ and $\Rep(G)$ have monoidal structures, meaning they have unit objects and a notion of tensor product. Another feature of these categories is that they have dual objects. In particular for $\Vect$, the dual of a vector space $V$ is the ``dual space" $V^*$, the vector space of linear maps $V\rt k$. In $\Rep(G)$, for each object/representation $p:G\rt GL(V)$ we also have dual group representations given by
$$p^*:G\rt GL(V^*),\ p^*(g)(\phi)(v):= \phi(p(g^{-1})v)$$
i.e. this is a representation of $G$ on the dual space $V^*$. These dual objects have a categorical equivalent inside monoidal categories:

\begin{definition}\begin{itemize}
  \item An object $V$ in a monoidal category is \define{rigid} if there exists an object $V^*$ called the (left) dual, and morphisms $\ev_V:V^*\otimes V\rt 1,\ \coev_V:1\rt V\otimes V^*$ satisfying
  $$(\id\otimes \ev_V)\circ (\coev_V\otimes \id)=\id_V\hspace{.5cm} (\ev_V\otimes \id)\circ (\id \otimes \coev_V)=\id_{V^*}$$
  \item A \define{rigid monoidal category}  is a monoidal category in which every object is rigit.
\end{itemize}
\end{definition}
\nt If you recall your linear algebra, for linear maps $\phi:V\rt W$ there is dual map $\phi^*:W^*\rt V^*$, and there is way to define similarly such dual morphisms between rigid objects.\bb

\nt We see that $\Vect^\text{fd}$, the category of finite-dimensional vector spaces, is a rigid monoidal category, where $\ev:V^*\otimes V\rt k$ is defined as you might expect, $\phi\otimes v\mapsto \phi(v)\in k$. Also, for basis $v_1,\dots,v_n$ for $V$, and its dual basis $f_1,\dots,f_n$ on $V^*$ (i.e. $f_i(v_j)=\delta_{ij}$) then $\coev(\lambda):=\lambda \sum_i v_i\otimes f_i$.\bb

\nt $\Rep(G)^\text{fd}$, or alternatively $kg$-$\Mod^\text{fd}$ the category of finite-dimensional $kG$-modules, is rigid if we define $\ev_V,\coev_V$ exactly as we did for $\Vect$ for each $kG$-module $V$. Using the definition we gave above for the dual representation $V^*$, i.e. we put a $kG$-module structure on the dual space $V^*$, and it can be checked this is a rigid object for this choice of $\ev_V,\coev_V$.

\section{Hopf algebras}

\begin{definition} A \define{coalgebra} is a vector space $C$ with linear map $\triangle:C \rt C \otimes C$ called the \define{coproduct}, and linear map $\epsilon: C \rt k$ called the \define{counit}, such that both diagrams below commute.
\begin{useimager}
$$\xymatrix@C=4em{
C \otimes C \otimes C & C \otimes C \ar[l]_{\id \otimes \Delta}\\
C \otimes C \ar[u]^{\Delta \otimes \id} & C \ar[l]^{\Delta} \ar[u]_{\Delta}
}\hspace{.5cm}
\xymatrix@C=4em{
k \otimes C & C \otimes C \ar[l]_{\epsilon \otimes \id} \ar[r]^{\id \otimes \epsilon} & C \otimes k\\
 & C \ar[u]_\triangle \ar[ru]_\cong \ar[ul]^\cong
}
$$
\end{useimager}
\nt The first diagram encodes the property called \define{coassociativity}. Notice that these diagrams are simply the dual diagrams (i.e. arrows reversed) to those used to define an algebra.
\end{definition}

%For all vector spaces $V,W$ define the flip map as $\tau:V\otimes W\rt W\otimes V, v\otimes w \mapsto w\otimes v$.

\begin{definition}\label{tens_algebras} For algebras $(A,m_1,\eta_1),(B,m_2,\eta_2)$, the tensor product $A\otimes B$ has an algebra structure given by a product: $(a \otimes c)\cd (b \otimes d) = ab \otimes cd\ \forall a,b\in A,c,d\in B$, and unit $1_{A\otimes B}=1_A\otimes 1_B$. Alternatively, the product and unit are defined as
$$m_{A\otimes B}: (A\otimes B) \otimes (A\otimes B)\rt A\otimes B,\ m_{A\otimes B}:=(m_1\otimes m_2)\circ (\id \otimes \tau \otimes \id)$$
$$\eta_{A\otimes B}:k\rt A\otimes B,\ \eta_{A\otimes B}:=(\eta_1 \otimes \eta_2)\circ \phi^{-1}$$
where $\phi:k\otimes k\rt k,\lambda\otimes \mu \mapsto \lambda\mu$ is an isomorphism with inverse $\phi^{-1}(\lambda)=1\otimes \lambda$.
\end{definition}

\begin{definition} A \define{bialgebra} is $(B,m,\eta,\triangle,\epsilon)$ where $(B,m,\eta)$ is an algebra, $(B,\triangle,\epsilon)$ is a coalgebra, and $\triangle,\epsilon$ are algebra homomorphisms.\bb

\nt Elaborating on this a bit, since $\triangle:B\rt B\otimes B$, we are implicitly giving $B\otimes B$ the algebra structure as described above. The algebra homomorphism property is then $\triangle (gh) = \triangle(g)\triangle(h)$, or yet more explicitly:
$$\triangle \circ m = (m\otimes m) \circ (\id \otimes \tau \otimes \id) \circ (\triangle \otimes \triangle)$$
\end{definition}

\begin{definition} A \define{Hopf algebra} $H$ is a bialgebra $(H,m,\eta, \triangle, \epsilon)$ with linear map $S:H \rt H$ called the \define{antipode}, satisfying the \define{antipode axiom} as the following commuting diagram:
\begin{useimager}
$$\xymatrix@C-1.5em@R+2em{
 & H \otimes H \ar[rr]^{S \otimes \id} & & H \otimes H \ar[dr]^m & \\
H \ar[ur]^\triangle \ar[dr]_\triangle \ar[rr]^\epsilon & & k \ar[rr]^\eta & & H \\
 & H \otimes H \ar[rr]_{\id \otimes S} & & H \otimes H \ar[ur]_m &
}
$$\end{useimager}
\end{definition}

\subsection{Examples}
\begin{example} The group algebra! The group algebra $kG$ is obviously an algebra, and we define Hopf algebra structure as follows:\begin{itemize}
  \item the coproduct $\triangle:kG\rt kG\otimes kG$ where $g\mapsto g\otimes g$ and we extend linearly to $kG$.
  \item $\epsilon:kG \rt k, g\mapsto 1_k$
  \item $S:kG\rt kG, g\mapsto g^{-1}$
\end{itemize}
It remains to check that $(kG,m,\eta,\triangle,\epsilon,S)$ actually satisfy the axioms of a Hopf algebra. Since group algebras are just a special case of Hopf algebras, we can see that the whole of group representation theory is just a special case of the representation theory of Hopf algebras.
\end{example}

\begin{example} For vector space $V$, let $T^n(V):=V\otimes \dots \otimes V$, the $n$-fold tensor product of $V$. Then the \define{tensor algebra} of $V$ is the vector space:
  $$T(V):=\bigoplus_{n=0}^\infty T^n(V)=k\oplus V\oplus (V\otimes V)\oplus (V\otimes V\otimes V)\oplus \dots$$
  with multiplication given by the tensor product:
  $$T^k(V)\otimes T^l(V)\rt T^{k+l}(V),\ (v\otimes \dots \otimes w)\cd (x\otimes \dots \otimes y):=(v\otimes \dots \otimes w\otimes x \otimes \dots \otimes y)$$
  which we can extend linearly to $T(V)$. Then on the subspace $V$ of $T(V)$ define:
  $$\triangle(v):=v\otimes 1+1\otimes v,\ \epsilon(v):=0,\ S(v):=-v$$
  Also on the subspace $k$ of $T(V)$, let
  $$\triangle(1_k):=1_k\otimes 1_k,\ \epsilon(\lambda):=\lambda,\ S(\lambda):=1\ \forall\lambda\in k$$
  $\triangle,\epsilon$ extend to all of $T(V)$ as algebra homomorphisms. In particular: $\epsilon(x)=0\ \forall x\in\bigoplus_{n=1}T^n(V)$. Whereas $S$ extends as an anti-algebra homomorphism, so it can be shown: $S(v_1\otimes \dots \otimes v_n)=(-1)^n v_n\otimes \dots \otimes v_1$. %Explicitly describing the extension of $\triangle$ to $T(V)$ brings us to into the intricacies of gradings of $T(V)\otimes T(V)$ and shuffle products, which takes us quite far from the objective of this essay. Note this can be done, and does indeed give $T(V)$ a Hopf algebra structure for which the reader can find proofs of this in Theorem $111.2.4$ and Lemma $111.3.6$ of Kassle \cite{kassel}.
  \end{example}

\nt The above example can be used to show that the symmetric and exterior algebras $S(V)$ and $\wedge (V)$ are also Hopf algebras. The universal enveloping algebra $U(\mathfrak{g})$ of a Lie algebra $\mathfrak{g}$ is a very important example of a Hopf algebra.

\subsection{Representations of Hopf algebras}
First of all, what is a representation of an algebra? Just as group representations are group homomorphisms into the group $GL(V)$, an algebra representation is an algebra homomorphism:

\begin{definition} A \define{representation} of algebra $A$ on vector space $V$ is an algebra homomorphism $\rho:A\rt \End(V)$, i.e. is a linear map that is also a ring homomorphism: $\rho(1)=1$ and $\rho(ab)=\rho(a)\rho(b)$. Recall $\End(V)$ is the endomorphism ring, i.e. the ring of linear maps with addition given pointwise and multiplication given by composition. This is completely equivalent to $V$ being a left $A$-module. %Analogously right $A$-module correspond to anti-algebra homomorphisms.
\end{definition}

\nt Note that when speak of representations of a Hopf algebra we simply mean a representation of its underlying algebra. However unlike arbitrary algebras, the added structure of a Hopf algebra means its module category is (rigid) monoidal.

\begin{proposition} The representation category $\Rep(H)$, or equivalently the module category $H$-$\Mod$, of Hopf algebra $H$ is a monoidal category. Additionally $H$-$\Mod^\text{fd}$ is rigid monoidal.
\begin{proof}
By the definition of a bialgebra we know the counit $\epsilon:H\rt k$ is an algebra homomorphism, so it actually defines a represenation of $H$ on $k$. We call it the trivial representation of $H$:
$$p:H \rt \End(k)\cong k,\ h \cdot\lambda=\epsilon(h)\lambda\hspace{.5cm} \forall \lambda\in k$$
Alternatively, treating $V$ as an $H$-module, the action on $k$ is denoted as $h\rhd \lambda=\epsilon(h)\lambda$.\bb

\nt Next we use the coproduct to define tensor products of the representations $p_{V_1}:H\rt \text{End}(V_1),\ p_{V_2}:H\rt \text{End}(V_2)$ as $p:H\rt \text{End}(V_1\otimes V_2)$ s.t.
$$p(h):=(p_{V_1}\otimes p_{V_2})\circ \triangle(h)$$
Since $\triangle$ is an algebra homomorphism, and the tensor product of algebra homomorphisms is an algebra homomorphism, this composition is indeed an algebra homomorphism as required. Again in module language we can define the action of $H$ on $V\otimes W$ as
$$h\rhd v\otimes w=\sum (h_{(1)}\rhd v)\otimes (h_{(2)}\rhd w)$$
for $\triangle(h)=\sum h_{(1)}\otimes h_{(2)}$.\bb

\nt Finally for finite-dimensional representations we have duals: for $p:H\rt \text{End}(V)$, define $p^*:H\rt \text{End}(V^*)$ such that
$$p^*(h)(\phi)(v):=\phi(p(S(h))v)$$
\end{proof}
\end{proposition}

\nt In the special case that $H=kG$ a group algebra, where $\epsilon(g)=1$,$\triangle(g)=g\otimes g$, and $S(g)=g^{-1}$, we see that the trivial, tensor product and dual reprsentations for $kG$ as a Hopf algebra coincide with those of the group $G$.

%the trivia Then the counit of $H$ is $\epsilon(g)=1\ \forall g$, meaning it coincides with the trivial representation for groups. Additionally $\triangle: g\mapsto g\otimes g$ tells us the tensor product representation of group algebras coincides with the tensor product of group representations. Finally using the fact $S(g)=g^{-1}$ the dual representation on $kG$ coincides with that of dual group representation. So we see group representation theory is a special case of Hopf algebra representation theory.

\subsection{Quasitriangular structures}
\nt Next we give a few important definitions that crop up regularly in the theory of Hopf algebras.
\begin{definition}\begin{itemize}
  \item A Hopf algebra is \define{commutative} if its underlying algebra is commutative, i.e. $m\circ \tau=m$.
  \item A Hopf algebra is \define{cocommutative} if its underlying coalgebra satisfies $\tau \circ \triangle=\triangle$.
  \item A non-zero $x\in H$ is \define{group-like} if $\triangle(x)=x\otimes x$. (Compare this with the coproduct on a group algebra!)
  \item An element $x\in H$ is \define{primitive} if $\triangle(x)=x\otimes 1+1\otimes x$.
\end{itemize}
\end{definition}

\nt The set of grouplikes inside a Hopf algbra form a group, whilst the set of primitives are somewhat like elements of a Lie algebra. , whilst the set of primitives forms a Lie algebra with respect to commutator product $[x,y]:=x\cd y-y\cd x$. As we stated above, the universal enveloping algebra $U(\mathfrak{g})$ of Lie algebra $\mathfrak{g}$ is a Hopf algebra, and the subset of primitives is precisely $\mathfrak{g}$. An important theorem of Cartier-Konstant-Milnor-Moore states that every cocommutative Hopf algebras has a decomposition into a (smash) product of the universal enveloping algebra of the Lie algebra formed by its primitive elements with the group algebra created by its group-like elements. Hence cocommutative Hopf algebras can be viewed as structures that merge group theory with Lie theory.\bb

\nt In the following we generalise cocommutative Hopf algebras, allowing for cocommutativity ``up to conjugation'':
\begin{definition}A \define{quasitriangular} Hopf algebra is a pair $(H, R)$ for Hopf algebra $H$ and invertible $R=\sum_i R_i^{(1)}\otimes R_i^{(2)}\in H\otimes H$ (called the ``quasitriangular structure''), such that for the twist map $\tau$:
$$\tau\circ \triangle(h)=R\cd \triangle(h)\cd R^{-1}\hspace{.5cm} \forall h\in H$$
and for $R_{12}:=R\otimes 1,\ R_{23}:=1\otimes R,\ R_{13}:=\sum_i R_i^{(1)}\otimes 1\otimes R_i^{(2)}$ then:
$$(\triangle\otimes \id)(R)=R_{13}R_{23}\hspace{1cm} (\id\otimes \triangle)(R)=R_{13}R_{12}$$
\end{definition}

\nt Clearly if the Hopf algebra is cocommutative, $\tau\circ \triangle=\triangle$, so it is quasitriangular with $R=1\otimes 1$.

\begin{definition} A quasitriangular Hopf algebra $(H,R)$ is \define{triangular} if $\tau(R)R=1\otimes 1$.
\end{definition}

\begin{proposition}If $(H,R)$ is a quasitriangular Hopf Algebra, then $R$ satisfies the \define{quantum Yang-Baxter equation}: $R_{12}R_{13}R_{23}= R_{23}R_{13}R_{12}$. This is essentially one of the relations in the braid group.
\end{proposition}

\section{Braided categories and Knots}
For monoidal category $(C,\otimes,1,\Phi)$ (recall $\Phi$ is the associator), define the functor $\cd \otimes^{\op}\cd:C\times C\rt C,\ (V,W)\mapsto W\otimes V$.

\begin{definition} A \define{braided monoidal category} is a monoidal category $(C,\otimes,1,\Phi)$ with a natural isomorphism $\psi: \cd \otimes \cd \rt \cd \otimes^{\text{op}}\cd $ (i.e. $\psi_{V,W}:V\otimes W \xrt{\sim} W\otimes V\ \forall V,W$) satisfying the ``hexagon conditions":
\begin{useimager}
$$\xymatrix{
  & V\otimes (W\otimes Z) \ar[ld]_{\id\otimes \psi} \ar[rd]^{\Phi^{-1}} & \\
V\otimes (Z\otimes W) \ar[d]_{\Phi^{-1}} & & (V\otimes W)\otimes Z \ar[d]^{\psi}\\
(V\otimes Z)\otimes W \ar[rd]_{\psi\otimes \id} & & Z\otimes (V\otimes W) \ar[ld]^{\Phi^{-1}}\\
 & (Z\otimes V)\otimes W & \\
}$$
$$
\xymatrix{
  & (V\otimes W)\otimes Z \ar[ld]_{\Phi} \ar[rd]^{\psi\otimes \id} & \\
V\otimes (W\otimes Z) \ar[d]_{\psi} & & (W\otimes V)\otimes Z \ar[d]^{\Phi}\\
(W\otimes Z)\otimes V \ar[rd]_{\Phi} & & W\otimes (V\otimes Z) \ar[ld]^{\id\otimes \psi}\\
 & W\otimes (Z\otimes V) & \\
}
$$
\end{useimager}

\nt The category is \define{symmetric monoidal} if the braiding satisfies $\psi_{V,W}=\psi_{W,V}^{-1}$.
\end{definition}

\nt Recall we defined an algebra in Section \ref{mon_cat}, and suggested this could be generalised to monoidal categories. We return finally to this point:
\begin{definition}\label{algebra} \begin{itemize}
  \item An \define{algebra} $(A,m,u)$ in a monoidal category $(\mathcal{C},\otimes,1)$ is an object $A$ in $\mathcal{C}$ with morphisms $m:A\otimes A\rt A$ and $u:1\rt A$, called product and unit respectively, such that the diagrams we gave above commute. Such objects form a subcategory $\text{Alg}(\mathcal{C})$ of $\mathcal{C}$.

  \item If $(A,m,u)$ is an algebra in a braided monoidal category $D$ with braiding $\psi$, then $A$ is \define{commutative} if $m\circ \psi_{A,A}=m$. Commutative algebras form a full subcategory of $\text{Alg}(\mathcal{D})$ denoted $\text{ComAlg}(\mathcal{D})$.
\end{itemize}
\end{definition}

\nt At this part in my talk I introduced the notation of string diagrams for working with braided categories. I haven't got around to figuring out how to latex these diagrams yet, so in the mean time the reference I used (not neccessarily the best) is \cite{alma9916633704401631} Chapter 9 and 12, and for applications to knot theory see Chapter 13. The final result, that ties up (get it?) Hopf algebras, braided categories and knot theory is the following:

\begin{theorem}\label{hopf_braiding} The module category $H$-$\Mod$ of a quasitriangular Hopf algebra $(H,R)$ is a braided monoidal category. In particular for $R=\sum R^{(1)}\otimes R^{(2)}$, we define components of the braiding as $\psi_{V,W}:V\otimes W \rt W\otimes V$,
$$v\otimes w \mapsto \tau(R\rhd v\otimes w)=\sum (R^{(2)}\rhd w)\otimes (R^{(1)}\rhd v)$$
When $R$ is triangular (i.e. $\tau(R)=R^{-1}$) then $H$-$\Mod$ is symmetric monoidal.\end{theorem}
\nt Note when $H$ is cocomutative (i.e. for group algebras) we have quasitriangular structure $R:=1\otimes 1$ on $H$, and for this choice the braiding $\psi_{V,W}$ is just the flip map $\tau$.\bb

%\nt Claim: there is a bijection between quasitriangular structures on $H$ and braidings on the category $H$-$\Mod$.\bb

\newpage

\bibliographystyle{plain}
\bibliography{mybib2}

\end{document}


% !Mode:: "TeX:UTF-8"
% !TEX program  = xelatex
\title[The Geometric Progression]{How to Calculate the Total Amount of Your Salary?}
\author[MA320 Group]{
    \begin{tabular}{ll}
        1. & Jin Cai \\
        2. & Zeyu Dong \\
        3. & Yi'an Yu \\
        4. & Daoyuan Lai \\
        5. & Guoyang Qin \\
        6. & Iydon Liang
    \end{tabular}
}
\date{\today}
\institute[SUSTech]{
    Department of Mathematics \\
    Southern University of Science and Technology
}

\begin{frame}
    \maketitle
\end{frame}

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

\section{Introduction}
\begin{frame}[<+->]{Introduction}
    \begin{exmp}
        \begin{itemize}
            \item Many jobs offer an annual cost-of-living increase to keep salaries consistent with inflation.
            \item A recent college graduate finds a position as a sales manager earning an annual salary of \$ 26,000.
            \item He is promised a 2\% cost of living increase each year.
        \end{itemize}
    \end{exmp}
    \begin{itemize}
        \item So how could we determine how much this college graduate will get after $n$, which is a natural integer, years' hard work?
        \item This question arises naturally as payment is one of the most significant factors people will consider when finding a job.
    \end{itemize}
\end{frame}

\section{The Geometric Progression}
\begin{frame}[<+->]{The Geometric Progression}
    \begin{itemize}
        \item Let's review the definition of \textbf{arithmetic progression} (Doe(2019)) first.
    \end{itemize}
    \begin{defn}
        In an \textbf{arithmetic progression}, the difference between $n^\text{th}$ term and $(n-1)^\text{th}$ term will be a constant which is known as the common difference of the arithmetic progression.
    \end{defn}
    \begin{itemize}
        \item What if the ratio of $n^\text{th}$ term to $(n-1)^\text{th}$ term in a sequence is a constant?
    \end{itemize}
\end{frame}

\begin{frame}[<+->]{The Geometric Progression}
    \begin{defn}
        A \textbf{geometric progression} is a sequence in which each term is derived by multiplying or dividing the preceding term by a fixed number called the \textbf{common ratio}.
    \end{defn}
    \begin{defn}
        If we define the initial term of a sequence $\{a_n\}$ as $a_1$, then $\{a_n\}$ is a \textbf{geometric progression} ($a_n\neq 0$ for any $n$) if and only if for any positive integer $n$,
        \[
            \frac{a_{n+1}}{a_n} = r,
        \]
        where $r$ is a constant.
    \end{defn}
\end{frame}

\section{Summation of Geometric Progression (Finite Case)}
\begin{frame}[<+->]{Summation of Geometric Progression}
    \begin{defn}
        The sum of the terms in a geometric sequence is called a \textbf{geometric series}.
    \end{defn}
    \begin{thm}
        The formula for $S_n$ is
        \[
            S_n = \frac{a_1(1-r^n)}{1-r},\quad r\neq 1,
        \]
        where $S_n$ is the geometric series.
    \end{thm}
    \begin{itemize}[<+->]
        \item How to derive this theorem?
    \end{itemize}
\end{frame}

\begin{frame}[<+->]{Summation of Geometric Progression}
    \begin{proof}
        \begin{itemize}
            \item Recall that a geometric progression is a sequence in which the ratio of any two consecutive terms is the common ratio, $r$. We can write the sum of the first $n$ terms of a geometric series as
                \begin{equation}\label{E:proof-gp-1}
                    S_n = a_1 + ra_1 + r^2a_1 + \cdots + r^{n-1}a_1.
                \end{equation}
            \item We will begin by multiplying both sides of the equation by $r$,
                \begin{equation}\label{E:proof-gp-2}
                    rS_n = ra_1 + r^2a_1 + r^3a_1 + \cdots + r^na_1.
                \end{equation}
            \item Next, if we subtract \eqref{E:proof-gp-2} from \eqref{E:proof-gp-1},
                \[
                    S_n-rS_n = (a_1 + ra_1 + r^2a_1 + \cdots + r^{n-1}a_1) - (ra_1 + r^2a_1 + r^3a_1 + \cdots + r^na_1).
                \]
        \end{itemize}
        \vspace{-.7 cm}
    \end{proof}
\end{frame}

\begin{frame}[<+->]{Summation of Geometric Progression}
    \begin{proof}
        \begin{itemize}
            \item Notice that when we subtract, all but the first term of the top equation and the last term of the bottom equation are canceled.
            \item And it is trivial to obtain the formula for $S_n$,
                \begin{equation}\label{E:gp-formula}
                    S_n = \frac{a_1(1-r^n)}{1-r},\quad r\neq 1.
                \end{equation}
            \item Notice that we have assumed that the common ratio $r$ does not equal to 1.
        \end{itemize}
    \end{proof}
\end{frame}

\section{Summation of Geometric Progression (Infinite Case)}
\begin{frame}[<+->]{Summation of Geometric Progression}
    \begin{itemize}
        \item The number of terms in infinite geometric progression will approach infinity ($n=\infty$).
        \item The formal definition of infinity has been discussed in Zhang(2018).
        \item Sum of infinity geometric progression can only be defined at the range of $-1<r<1 (r\neq 0)$ exclusive.
    \end{itemize}
    \begin{thm}
        The sum of an infinite geometric progression is
        \[
            S = \frac{a_1}{1-r}.
        \]
    \end{thm}
\end{frame}

\section{Application to the Salary Example}
\begin{frame}[<+->]{Application to the Salary Example}
    \begin{exmp}[Salary Problem]
        \begin{itemize}
            \item There will be a 102\% annual increment. So the common ratio $r$ is 1.02.
            \item If we consider the first 5 years' total amount of the salary, we could calculate $S_5$ by directly substituting $n=5$, $r=1.02$, $a_1=26,000$ into Equation~\eqref{E:gp-formula}.
            \item We will get $S_5=137,907.06$. I.e.This graduate will get \$137,907.06 after 5 years' working.
        \end{itemize}
    \end{exmp}
\end{frame}

\section{Conclusion}
\begin{frame}{Conclusion}
    \begin{itemize}[<+->]
        \item We derived the formula of the geometric series.
        \item Furthermore, with a proper choice of the common ratio, we showed that this formula can be generalized to infinite case.
        \item A real problem is analyzed to illustrate the proposed formula and answered the question in the title: by using the formula proposed in this paper, we could calculate the total amount of the salary if it has a constant multiple of the common ratio each payment period.
    \end{itemize}
\end{frame}

\section{Acknowledgments}
\begin{frame}{Acknowledgments}
    \begin{itemize}[<+->]
        \item The author would like to thank the Associate Editor and one referee for their valuable comments which have greatly improved the paper.
        \item The author's research is fully supported by the National Baby Natural Science Foundation of China(No. 1000001).
    \end{itemize}
\end{frame}

\begin{frame}
    \centering\Huge Thank you!
\end{frame}

\section{References}
\begin{frame}[c, allowframebreaks]{Reference}
    \begin{thebibliography}{9}\large
        \bibitem{Doe2019} Doe,J.(2019). The Arithmetic Progression. \emph{Mathematics for Beginners} 33:1465–1480.
        \bibitem{Smith2019} Smith,J., Smith A.J., Smith B.J.(2019). Summation of Arithmetic Progression. \emph{Journal of the Royal Baby Statistical Society, Series B} 63:111–126. 33:1465–1480.
        \bibitem{Zhang2018} Zhang,J.(2018). The Formal Discussion of Infinity. \emph{Annals of Baby Mathematics} 9:705–724.
    \end{thebibliography}
\end{frame}


\section{Derived expression types}
\label{derivedsection}

This section gives rewrite rules for the derived expression types.  By
the application of these rules, any expression can be reduced to a
semantically equivalent expression in which only the primitive
expression types (literal, variable, call, \ide{lambda}, \ide{if},
\ide{set!}) occur.

% \todo{Expressions such as {\tt (cond)} aren't legal, but they make the
% rewrite rules work.}

\newcommand{\iet}{\hbox to 2em{\hfil $\equiv$}}  % is equivalent to

\begin{schemenoindent}
(cond (\hyper{test} \hyper{sequence})
      \hyperii{clause} \dotsfoo)
\iet  (if \hyper{test}
          (begin \hyper{sequence})
          (cond \hyperii{clause} \dotsfoo))

(cond (\hyper{test})
      \hyperii{clause} \dotsfoo)
\iet  (or \hyper{test} (cond \hyperii{clause} \dotsfoo))

(cond (\hyper{test} => \hyper{recipient})
      \hyperii{clause} \dotsfoo)
\iet  (let ((test-result \hyper{test})
            (thunk2 (lambda () \hyper{recipient}))
            (thunk3 (lambda () (cond \hyperii{clause} \dotsfoo))))
        (if test-result
            ((thunk2) test-result)
            (thunk3)))

(cond (else \hyper{sequence}))
\iet  (begin \hyper{sequence})

(cond)
\iet  \hyper{some expression returning an unspecified value}

(case \hyper{key}
  ((d1 \dotsfoo) \hyper{sequence})
  \dotsfoo)
\iet  (let ((key \hyper{key})
            (thunk1 (lambda () \hyper{sequence}))
            \dotsfoo)
        (cond ((\hyper{memv} key '(d1 \dotsfoo)) (thunk1))
               \dotsfoo))

(case \hyper{key}
  ((d1 \dotsfoo) \hyper{sequence})
  \dotsfoo
  (else f1 f2 \dotsfoo))
\iet  (let ((key \hyper{key})
            (thunk1 (lambda () \hyper{sequence}))
            \dotsfoo
            (elsethunk (lambda () f1 f2 \dotsfoo)))
        (cond ((\hyper{memv} key '(d1 \dotsfoo)) (thunk1))
               \dotsfoo
              (else (elsethunk))))%
\end{schemenoindent}
where \hyper{memv} is an expression evaluating to the \ide{memv} procedure.

\begin{schemenoindent}
(and)         \=\iet  \schtrue
(and \hyper{test})\>\iet  \hyper{test}
(and \hyperi{test} \hyperii{test} \dotsfoo)
\iet  (let ((x \hyperi{test})
            (thunk (lambda () (and \hyperii{test} \dotsfoo))))
        (if x (thunk) x))

(or)          \>\iet  \schfalse
(or \hyper{test})\>\iet  \hyper{test}
(or \hyperi{test} \hyperii{test} \dotsfoo)
\iet  (let ((x \hyperi{test})
            (thunk (lambda () (or \hyperii{test} \dotsfoo))))
        (if x x (thunk)))

(let ((\hyperi{variable} \hyperi{init}) \dotsfoo)
  \hyper{body})
\iet  ((lambda (\hyperi{variable} \dotsfoo) \hyper{body}) \hyperi{init} \dotsfoo)

(let* () \hyper{body})
\iet  ((lambda () \hyper{body}))
(let* ((\hyperi{variable} \hyperi{init})
       (\hyperii{variable} \hyperii{init})
       \dotsfoo)
  \hyper{body})
\iet  (let ((\hyperi{variable} \hyperi{init}))
        (let* ((\hyperii{variable} \hyperii{init})
               \dotsfoo)
          \hyper{body}))

(letrec ((\hyperi{variable} \hyperi{init})
         \dotsfoo)
  \hyper{body})
\iet  (let ((\hyperi{variable} \hyper{undefined})
            \dotsfoo)
         (let ((\hyperi{temp} \hyperi{init})
               \dotsfoo)
           (set! \hyperi{variable} \hyperi{temp})
           \dotsfoo)
         \hyper{body})%
\end{schemenoindent}
where \hyperi{temp}, \hyperii{temp}, \dotsfoo{} are variables, distinct
from \hyperi{variable}, \dotsfoo{}, that do not free occur in the
original \hyper{init} expressions, and \hyper{undefined} is an expression
which returns something that when stored in a location makes it an
error to try to obtain the value stored in the location.  (No such
expression is defined, but one is assumed to exist for the purposes of this
rewrite rule.)  The second \ide{let} expression in the expansion is not
strictly necessary, but it serves to preserve the property that the
\hyper{init} expressions are evaluated in an arbitrary order.

\begin{schemenoindent}

(begin \hyper{sequence})
\iet  ((lambda () \hyper{sequence}))%
\end{schemenoindent}
The following alternative expansion for \ide{begin} does not make use of
the ability to write more than one expression in the body of a lambda
expression.  In any case, note that these rules apply only if
\hyper{sequence} contains no definitions.
\begin{schemenoindent}
(begin \hyper{expression})\iet  \hyper{expression}
(begin \hyper{command} \hyper{sequence})
\iet  ((lambda (ignore thunk) (thunk))
       \hyper{command}
       (lambda () (begin \hyper{sequence})))%
\end{schemenoindent}

The following expansion for \ide{do} is simplified by the assumption
that no \hyper{step} is omitted.  Any \ide{do} expression in which a
\hyper{step} is omitted can be replaced by an equivalent \ide{do}
expression in which the corresponding \hyper{variable} appears as
the \hyper{step}.

\begin{schemenoindent}
(do ((\hyperi{variable} \hyperi{init} \hyperi{step})
     \dotsfoo)
    (\hyper{test} \hyper{sequence})
  \hyperi{command} \dotsfoo)
\iet  (letrec ((\hyper{loop}
                (lambda (\hyperi{variable} \dotsfoo)
                  (if \hyper{test}
                      (begin \hyper{sequence})
                      (begin \hyperi{command}
                             \dotsfoo
                             (\hyper{loop} \hyperi{step} \dotsfoo))))))
        (\hyper{loop} \hyperi{init} \dotsfoo))%
\end{schemenoindent}
where \hyper{loop} is any variable which is distinct from
\hyperi{variable},~\dotsfoo, and which does not occur free in the \ide{do}
expression.

\begin{schemenoindent}
(let \hyper{variable$_0$} ((\hyperi{variable} \hyperi{init}) \dotsfoo)
  \hyper{body})
\iet  ((letrec ((\hyper{variable$_0$} (lambda (\hyperi{variable} \dotsfoo)
                             \hyper{body})))
          \hyper{variable$_0$})
       \hyperi{init} \dotsfoo)

(delay \hyper{expression})
\iet  (\hyper{make-promise} (lambda () \hyper{expression}))%
\end{schemenoindent}
where \hyper{make-promise} is an expression evaluating to some procedure
which behaves appropriately with respect to the \ide{force} procedure;
see section~\ref{force}.

% `a                =  Q_1[a]
% `(a b c ... . z)  =  `(a . (b c ...))
% `(a . b)          =  (append Q*_0[a] `b)
% `(a)              =  Q*_0[a]
% Q*_0[a]           =  (list 'a)
% Q*_0[,a]          =  (list a)
% Q*_0[,@a]         =  a
% Q*_0[`a]          =  (list 'quasiquote Q*_1[a])
% `#(a b ...)       =  (list->vector `(a b ...))
%  ugh.


\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\author{Pranav Satheesh}
\title{Relativity Assignments}
\begin{document}
\maketitle

\section{Einstein's velocity addition}

In this problem, you will derive the velocity addition rule in relativity using Lorentz transformations. Consider a particle A in the frame B. Her velocity w.r.t frame B is $V_{AB}$. In another frame C moving w.r.t B with a velocity $V_{CB}$. Show that the velocity of A w.r.t to the frame C using \textbf{Lorentz transformation}:

\begin{equation}
V_{AC} = \frac{V_{AB} + V_{BC}}{1 + (V_{AB} V_{BC} / c^2)}
\end{equation}

(\textit{\textbf{Hint} : You can use consider the velocity to be $u =\frac{dx}{dt}$ in the frame B and then write the lorentz transformation equations for $dx$ and $dt$ to the frame C where these become $\bar{dx}$ and $\bar{dt}$})

\section{Superluminal Motion}
Astronomers observed radio galaxies moving with velocities exceeding the velocity of c!
M87 is an example in the Virgo cluster
The distance to this galaxy, M87, is about D = 62 million light years. One can use this distance to convert angular separations into linear separations across the line of sight.

\begin{figure}[htbp]
\centering
\includegraphics[scale=0.3]{lumino.png}
\caption{Blobs}
\end{figure}

\begin{enumerate}
 \item Now, look at one of the blobs: the innermost one, which appears most clearly in 1996 and 1997. Approximately calculate the velocity of the blob.Hold on a minute! Is this against special relativity postulate 2 ?
 \item This calculation is not correct. The clouds are actually movng traight towards us with a velocity below c. As the cloud rapidly approaches, the distance light has to travel reduces and hence it would appear to reach us sooner. This effect can be understood from the second diagram. The cloud stars at N and moves at an angle $\theta$ w.r.t the line of sight of the observer O. Let $\vec{V}$ be the velocity of the cloud and let $t_{obs}$ be the time the observer sees the light emitted from the cloud at time $t$. From the distance travelled by light calculare the  relation between $t_{obs}$ and $t$.

\begin{figure}[htbp]
\centering
\includegraphics[scale=0.5]{superlum2.png}
\caption{Apparent motion of the cloud}
\end{figure}

\item Now we using the $t_{obs}$ relation, figure out the transverse speed $V_{T}$ observed by the observer using $V_{T} = dx/d t_{obs}$.
\item Can you now plot $V_{T}$ for different $\theta$ and see at what angles you see an apparent motion greater than c ?

\end{enumerate}

\section{Relativistic Doppler Effect}

In this exercise you will derive the Doppler effect using Lorentz transformations.

Consider the source to be at rest and the reciever is moving away with some welovity $v$ and $v>0$. Use suscript $s$ for source and $r$ for reciever.

\begin{enumerate}
\item Consider the first pulse recieved by the recieber at $t_s = 0$ and $x_s = 0$. $\lambda_s$ is the wavelength of the wave. Now is time $t_{rs}$ the reciever recieves the secon pulse. Then show that

$$ c t_{rs} = \lambda_s + v t_{rs} $$

\item We now need to make a lorentz transformation to reciever frame and change $t_{rs}$ to $t_{r}$. Show that after doing Lorentz transformation

$$ t_{r} = \frac{t_{rs}}{\gamma}$$

\item Now subsitiute this in the previous relation and obtain the fampus relation between the frequencies.

$$ f_{r} = \sqrt{\frac{1- \frac{v}{c}}{1+ \frac{v}{c}}} f_{s} $$

\end{enumerate}

\end{document}


\documentclass[twoside,11pt]{article}

% Any additional packages needed should be included after jmlr2e.
% Note that jmlr2e.sty includes epsfig, amssymb, natbib and graphicx,
% and defines many common macros, such as 'proof' and 'example'.
%
% It also sets the bibliographystyle to plainnat; for more information on
% natbib citation styles, see the natbib documentation, a copy of which
% is archived at http://www.jmlr.org/format/natbib.pdf

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Style file settings DO NOT MODIFY THIS SECTION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{jmlr2e}
\setlength{\parskip}{0.25em}
\renewcommand{\arraystretch}{1.2}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Handy packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb, mathtools, amsfonts}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{trees}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usetikzlibrary{automata,positioning}
\usepackage{multirow}
\allowdisplaybreaks

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definitions of handy macros can go here
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Operators for drawing in-text edges for PAGs, DAGs, ADMGs, CGs etc
\DeclareMathOperator{\circlearrow}{\hbox{$\circ$}\kern-1.5pt\hbox{$\rightarrow$}}
\DeclareMathOperator{\circlecircle}{\hbox{$\circ$}\kern-1.2pt\hbox{$--$}\kern-1.5pt\hbox{$\circ$}}
\DeclareMathOperator{\diedgeright}{\textcolor{blue}{\boldsymbol{\rightarrow}}}
\DeclareMathOperator{\diedgeleft}{\textcolor{blue}{\boldsymbol{\leftarrow}}}
\DeclareMathOperator{\biedge}{\textcolor{red}{\boldsymbol{\leftrightarrow}}}
\DeclareMathOperator{\udedge}{\textcolor{brown}{\boldsymbol{\textendash}}}

% Operators for relations in graphs
\DeclareMathOperator{\an}{an}
\DeclareMathOperator{\pa}{pa}
\DeclareMathOperator{\ch}{ch}
\DeclareMathOperator{\pre}{pre}
\DeclareMathOperator{\de}{de}
\DeclareMathOperator{\nd}{nd}
\DeclareMathOperator{\sib}{sib}
\DeclareMathOperator{\dis}{dis}
\DeclareMathOperator{\mb}{mb}

% Operator for ``do''
\DeclareMathOperator{\doo}{do}

% Operator for odds ratio
\DeclareMathOperator{\odds}{\text{OR}}

% Operators for optimization problems
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}

% Operators for independence, expectation and calligraphy G
\def\ci{\perp\!\!\!\perp}
\newcommand{\E}{\mathbb{E}}
\newcommand{\G}{\mathcal{G}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Pick and abbreviated title for your project and put down your
% last name. This title and your name will appear alternating
% pages of the project writeup at the top
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ShortHeadings{An Abbreviated Title For Your Project If Needed}{Put your last name here}
\firstpageno{1}

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Insert the title of your project and details abouy you here
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{Title of Your Project
}

\author{\name {Put your name here}
		\email {email here} \\
       	\addr {Department/major here} \\
      	{jhed here}
	}

\maketitle

%%%%%%%%%%%%%%%%%%%%%%%%
% Introduction
%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
\label{sec:intro}
Introduce high-level background and highlights of your analysis here$\dots$ Example of citing your data sources. I used protein/phospholipid expression data from \cite{sachs2005causal}. Citations without parantheses when it flows naturally in the text use the \texttt{$\backslash$cite} command. Citations with the parantheses use the \texttt{$\backslash$citep} command.

%%%%%%%%%%%%%%%%%%%%%%%%
% Preliminaries
%%%%%%%%%%%%%%%%%%%%%%%%
\section{Preliminaries}
\label{sec:prelims}
Technical background for explaining your project goes here$\dots$

A compressed example of how to provide technical background for causal models of a directed acyclic graph (DAG) is given below.

Causal models of a DAG $\G$ defined over a set of variables $V$ may be interpreted as a tuple consisting of the DAG itself, and a system of non-parametric structural equations with independent errors equipped with the do-operator. Each variable is determined as a function of its parents and an independent error term. This induces a distribution $p(V)$ that factorizes according to the DAG $\G$ as follows,
%
\begin{align*}
p(V) = \prod_{V_i \in V} p(V_i \mid \pa_\G(V_i)),
\end{align*}
%
where $\pa_\G(V_i)$ denotes the parents of $V_i$ in $\G.$ Under this interpretation, a directed edge $V_i \diedgeright V_j$ may be interepreted as saying that $V_i$ is potentially a direct cause of $V_j$. Conditional independences in $p(V)$ can be read off from the DAG via d-separation, i.e., $(X \ci Y \mid Z)_\text{d-sep} \implies (X \ci Y \mid Z)_{\text{in } p(V)}.$ To facilitate structure learning, I will restrict my analysis to the set of \emph{faithful} distributions where $(X \ci Y \mid Z)_\text{d-sep} \iff (X \ci Y \mid Z)_{\text{in } p(V)}.$ In addition, I make the simplifying assumption that the relations between my variables are linear.

%%%%%%%%%%%%%%%%%%%%%%%%
% Methods
%%%%%%%%%%%%%%%%%%%%%%%%
\section{Methods}
\label{sec:methods}
Introduce specifics of your analysis and methods you used here$\dots$ The following sentences provide contrived examples of how to  state and cite a method you used in your analysis.

Greedy Equivalence Search (GES), a score-based method for learning DAGs \citep{chickering2002optimal}, was used to learn an equivalence class of possible causal structures with no unmeasured confounders.

A non-parametric conditional independence test known as the Fast Conditional Independence Test was used to check for conditional independences \citep{chalupka2018fast}.

%%%%%%%%%%%%%%%%%%%%%%%%
% Results
%%%%%%%%%%%%%%%%%%%%%%%%
\section{Results}
\label{sec:results}
Write up and visualize your results here $\dots$

%%%%%%%%%%%%%%%%%%%%%%%%%
% Discussion + Conclusion
%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Discussion and Conclusion}
\label{sec:discussion}
Provide a discussion on the results of your analysis based on results presented in Section~\ref{sec:results}$\dots$

%%%%%%%%%%%%%%%%%%%%%%%%%
% References
%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\bibliography{references}

\end{document}


\documentclass{article}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\begin{document}

\title{Papers I Love}
\author{Daniel Frederico Lins Leite}

\maketitle

\tableofcontents

\section{Computer Science}

\subsection{Algorithms}

\subsubsection{Analysis}
\begin{enumerate}
	\item {Recursive Algorithms in Computer Science Courses: Fibonacci Numbers and Binomial Coefficients\\
\url{http://venus.cs.qc.edu/~waxman/cs211%20spring%202009/why%20is%20recursive%20fibonacci%20so%20slow.pdf}}
	\item {Binomial Coefficient Computation: Recursion or Iteration?\\
\url{http://delab.csd.auth.gr/papers/SBI02m.pdf}}	\item {Binomial Coefficient Computation: Recursion or Iteration?\\
\url{http://delab.csd.auth.gr/papers/SBI02m.pdf}}

\end{enumerate}

\subsubsection{Compression}
\begin{enumerate}
\item{A Universal Algorithm for Sequential Data Compression\\ \url{	http://citeseer.ist.psu.edu/viewdoc/download?doi=10.1.1.118.8921}}
\item {Data Compression Using Long Common Strings\\
\url{http://www.cs.brandeis.edu/~dilant/cs175/%5BSiying-Dong%5D.pdf}}
\end{enumerate}

\subsubsection{Hash}
\begin{enumerate}
	\item {SHA-1 and the Strict Avalanche Criterion\\
\url{https://arxiv.org/pdf/1609.00616.pdf}}
\end{enumerate}

\subsubsection{Data Structures}
\begin{enumerate}
	\item{Lists and why they are useful\\ \url{https://academic.oup.com/comjnl/article-pdf/7/4/278/1013051/7-4-278.pdf}}
	\item{Hashed and Hierarchical Timing Wheels: Data Structures for the Efficient Implementation of a Timer Facility\\ \url{https://web.archive.org/web/20130319034954/https://www.cs.columbia.edu/~nahum/w6998/papers/sosp87-timing-wheels.pdf}}
\item {Bitlist New Full-Text Index for Low Space Cost and Efficient Keyword Search\\
\url{http://www.vldb.org/pvldb/vol6/p1522-rao.pdf}}
\end{enumerate}

\subsubsection{Elections + Consensus}

\begin{enumerate}
	\item {Elections in a Distributed Computing System\\
\href{http://academic.research.microsoft.com/Publication/716253/elections-in-a-distributed-computing-system}{http://academic.research.microsoft.com/Publication/716253/elections-in-a-distributed-computing-system}\\
\url{http://homepage.cs.uiowa.edu/~ghosh/Bully.pdf}}
	\item {The Part-Time Parliament\\
\href{http://research.microsoft.com/en-us/um/people/lamport/pubs/lamport-paxos.pdf}{http://research.microsoft.com/en-us/um/people/lamport/pubs/lamport-paxos.pdf}}
	\item {In Search of an Understandable Consensus Algorithm\\
\href{https://ramcloud.atlassian.net/wiki/download/attachments/6586375/raft.pdf}{https://ramcloud.atlassian.net/wiki/download/attachments/6586375/raft.pdf}}
\end{enumerate}

\subsubsection{Computer Graphics}
\begin{enumerate}
	\item {Algorithm for computer control of a digital plotter by J. E. Bresenham\\\url{https://www.cse.iitb.ac.in/~paragc/teaching/2013/cs475/papers/bresenham_line.pdf}}
	\item {Bresenham's Algorithm\\
\url{http://graphics.idav.ucdavis.edu/education/GraphicsNotes/Bresenhams-Algorithm.pdf}}
	\item {Simplex noise demystified\\\url{http://webstaff.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf}}

	\item{Pose Space Deformation: A Unified Approach to Shape Interpolation and
		Skeleton-Driven Deformation \\\url{http://scribblethink.org/Work/PSD/PSD.pdf}}
\end{enumerate}

\subsection{Architectures}

\subsubsection{Computer Architecture}
\begin{enumerate}
	\item {Quantifying the Cost of Context Switch\\
\url{http://www.cs.rochester.edu/u/cli/research/switch.pdf}}
	\item {What Every Programmer Should Know About Memory\\
\url{https://people.freebsd.org/~lstewart/articles/cpumemory.pdf}}
\end{enumerate}

\subsubsection{Multi Tenancy}
\begin{enumerate}
	\item {Enabling Multi-Tenancy an Industrial Experience Report\\
\href{http://swerl.tudelft.nl/twiki/pub/Main/TechnicalReports/TUD-SERG-2010-030.pdf}{http://swerl.tudelft.nl/twiki/pub/Main/TechnicalReports/TUD-SERG-2010-030.pdf}}
	\item {Multi-Tenant Saas Applications: Maintenance Dream or Nightmare\\
\href{http://swerl.tudelft.nl/twiki/pub/Main/TechnicalReports/TUD-SERG-2010-031.pdf}{http://swerl.tudelft.nl/twiki/pub/Main/TechnicalReports/TUD-SERG-2010-031.pdf}}
	\item {Towards an Elastic and Autonomic Multitenant Database\\ \url{http://research.microsoft.com/en-us/um/people/srikanth/netdb11/netdb11papers/netdb11-final8.pdf}}
\end{enumerate}

\subsubsection{REST}
\begin{enumerate}
	\item {Architectural Styles and the Design of Network-Based Software Architectures\\
\href{http://academic.research.microsoft.com/Publication/1309313/architectural-styles-and-the-design-of-network-
	based-software-architectures}{http://academic.research.microsoft.com/Publication/1309313/architectural-styles-and-the-design-of-network-
	based-software-architectures}\\
\url{http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm}}
\end{enumerate}

\subsubsection{SEDA}
\begin{enumerate}
	\item {An Architecture for Highly Concurrent, Well-Conditioned Internet Services\\
\href{http://academic.research.microsoft.com/Publication/112151/seda-an-architecture-for-well-conditioned-scalable-internet-services}{http://academic.research.microsoft.com/Publication/112151/seda-an-architecture-for-well-conditioned-scalable-internet-services}\\
\url{http://www.eecs.harvard.edu/~mdw/papers/mdw-phdthesis.pdf}}
\end{enumerate}

\subsubsection{Servers}
\begin{enumerate}
	\item {Flash an Efficient and Portable Web Server\\
\url{https://www.usenix.org/event/usenix99/full_papers/pai/pai.pdf}}
\end{enumerate}

\subsubsection{Other Architectures}
\begin{enumerate}
	\item {The Monad Manifesto\\
\url{http://www.jsnover.com/Docs/MonadManifesto.pdf}}
	\item {The Hla Tutorial\\
\url{http://www.pitch.se/hlatutorial}}
\end{enumerate}

\subsubsection{Patterns}
\begin{enumerate}
	\item {Active Object: An Object Behavioral Pattern for Concurrent Programming\\
\url{http://www.cs.wustl.edu/~schmidt/PDF/Act-Obj.pdf}}
	\item {Plop Half-Sync/half-Async: An Architectural Pattern for Efficient and Well-Structured Concurrent I/o\\
\url{http://www.cs.wustl.edu/~schmidt/PDF/PLoP-95.pdf}}
	\item{EASTL -- Electronic Arts Standard Template Library \url{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html}}
\end{enumerate}

\subsubsection{Overlay Networks}
\begin{enumerate}
	\item {Architectures for an Event Notification Service Scalable to Wide-Area Networks\\
\href{http://academic.research.microsoft.com/Publication/314658/architectures-for-an-event-notification-service-scalable-to-wide-area-networks}{http://academic.research.microsoft.com/Publication/314658/architectures-for-an-event-notification-service-scalable-to-wide-area-networks}\\
\url{http://www.inf.usi.ch/carzaniga/papers/phd_thesis.pdf}}
\end{enumerate}

\subsubsection{Distributed Systems}
\begin{enumerate}
	\item {Time, Clocks and the Ordering of Events in a Distributed System\\
\href{http://academic.research.microsoft.com/Publication/775212/time-clocks-and-the-ordering-of-events-in-a-distributed-system}{http://academic.research.microsoft.com/Publication/775212/time-clocks-and-the-ordering-of-events-in-a-distributed-system}\\
\href{http://research.microsoft.com/en-us/um/people/lamport/pubs/pubs.html#time-clocks}{http://research.microsoft.com/en-us/um/people/lamport/pubs/pubs.html\#time-clocks}\\
\href{http://research.microsoft.com/en-us/um/people/lamport/pubs/time-clocks.pdf}{http://research.microsoft.com/en-us/um/people/lamport/pubs/time-clocks.pdf}}
	\item {Paxos Made Simple\\
	\url{https://www.microsoft.com/en-us/research/publication/paxos-made-simple/}}
	\item {Distributed Snapshots: Determining Global States of Distributed Systems\\
\href{http://academic.research.microsoft.com/Publication/803548/distributed-snapshots-determining-global-states-of-distributed-systems}{http://academic.research.microsoft.com/Publication/803548/distributed-snapshots-determining-global-states-of-distributed-systems}\\
\href{http://research.microsoft.com/en-us/um/people/lamport/pubs/pubs.html#chandy}{http://research.microsoft.com/en-us/um/people/lamport/pubs/pubs.html\#chandy}\\
\href{http://research.microsoft.com/en-us/um/people/lamport/pubs/chandy.pdf}{http://research.microsoft.com/en-us/um/people/lamport/pubs/chandy.pdf}}
	\item {Your Coffee Shop Doesn’t Use Two-Phase Commit\\
\href{http://www.enterpriseintegrationpatterns.com/docs/IEEE_Software_Design_2PC.pdf}{http://www.enterpriseintegrationpatterns.com/docs/IEEE\_Software\_Design\_2PC.pdf}}
	\item {Life Beyond Distributed Transactions: An Apostate’s Opinion\\
\url{http://www-db.cs.wisc.edu/cidr/cidr2007/papers/cidr07p15.pdf}}
	\item {Conflict-free Replicated Data Types\\
\url{https://hal.inria.fr/inria-00609399/document}}
\end{enumerate}

\subsubsection{Process Algebra}
\begin{enumerate}
	\item {A Brief History of Process Algebra\\
\url{http://alexandria.tue.nl/extra1/wskrap/publichtml/200402.pdf}}
	\item {Some of My Favourite Results in Classic Process Algebra (Version of September 9, 2003)\\
\url{https://www.researchgate.net/publication/228785318_Some_of_My_Favourite_Results_in_Classic_Process_Algebra_Version_of_September_9_2003}}
	\item {Reactive Systems: Modelling, Speciﬁcation and Veriﬁcation\\
\url{https://www.semanticscholar.org/paper/Reactive-Systems-Modelling-Specification-and-Aceto-Larsen/454e1c72efc65270649e10efb11f4390606b7ea7}}
\end{enumerate}

\subsubsection{Event Based Architecture}
\begin{enumerate}
	\item {Design of a Scalable Event Notification Service Interface and Architecture\\
\href{http://academic.research.microsoft.com/Publication/312680/design-of-a-scalable-event-notification-service-interface-and-architecture}{http://academic.research.microsoft.com/Publication/312680/design-of-a-scalable-event-notification-service-interface-and-architecture}\\
\url{http://www.inf.usi.ch/carzaniga/papers/CU-CS-863-98.pdf}}
	\item {Fast Forwarding for Content-Based Networking\\
\href{http://academic.research.microsoft.com/Publication/7217/fast-forwarding-for-content-based-networking}{http://academic.research.microsoft.com/Publication/7217/fast-forwarding-for-content-based-networking}\\
\href{http://www.inf.usi.ch/carzaniga/papers/cucs-922-01-r1.pdf}{http://www.inf.usi.ch/carzaniga/papers/cucs-922-01-r1.pdf}}
	\item {Real-Time Modelling of Dds for Event-Driven Applications\\
\url{http://www.ctr.unican.es/publications/hpt-jjg-2012a.pdf}}
\end{enumerate}

\subsubsection{Resiliency}

\begin{enumerate}
	\item {Adaptive Overload Control for Busy Internet Servers\\
\href{http://academic.research.microsoft.com/Publication/634136/adaptive-overload-control-for-busy-internet-servers}{http://academic.research.microsoft.com/Publication/634136/adaptive-overload-control-for-busy-internet-servers}\\
\url{http://www.eecs.harvard.edu/~mdw/papers/control-usits03.pdf}}
\end{enumerate}

\subsection{Programming}
\subsubsection{Language Analysis}
\begin{enumerate}
	\item {Evaluating the Design of the R Language\\ \url{http://r.cs.purdue.edu/pub/ecoop12.pdf}}
	\item{A Modest Proposal: C++ Resyntaxed\\
\url{http://users.monash.edu/~damian/papers/HTML/ModestProposal.html}}
	\item{Meta-Compilation for C++\\
\url{http://www.computing.surrey.ac.uk/research/dsrg/fog/FogThesis.pdf}}
\end{enumerate}
\subsubsection{Process Theory}
\begin{enumerate}
	\item {A Brief History of Process Algebra\\
\url{http://alexandria.tue.nl/extra1/wskrap/publichtml/200402.pdf}}
\end{enumerate}
\subsubsection{Object Oriented}
\begin{enumerate}
	\item {A Theory of Objects\\
\url{http://academic.research.microsoft.com/Publication/1354440/a-theory-of-objects}\\
\url{http://lucacardelli.name/Talks/1997-06\%20A\%20Theory\%20of\%20Object\%20(ECOOP\%20Tutorial).pdf}}
	\item {Traits: Composable Units of Behaviour\\
\url{http://scg.unibe.ch/archive/papers/Scha03aTraits.pdf}}
	\item {Applying Traits to the Smalltalk Collection Hierarchy\\
\url{http://www.researchgate.net/publication/2564879_Applying_Traits_to_the_Smalltalk_Collection_Hierarchy}}
	\item {A Laboratory for Teaching Object-Oriented Thinking\\
\url{http://www.inf.ed.ac.uk/teaching/courses/seoc/2007_2008/resources/CRC_OOthinking.pdf}}
\end{enumerate}
\subsubsection{Generic Programming}
	\begin{enumerate}
	\item {Design Patterns for Generic Programming in C++\\ \url{https://www.lrde.epita.fr/dload/papers/coots01.html}}
	\end{enumerate}
\subsubsection{Dynamic Dispatch}
\subsubsection{Functional Programming}
\begin{enumerate}
	\item{The essence of functional programming \\
\url{http://homepages.inf.ed.ac.uk/wadler/papers/essence/essence.ps.gz}}
	\item {Monadic Parser Combinators\\
\url{http://www.cs.nott.ac.uk/~pszgmh/monparsing.pdf}}
\end{enumerate}
\begin{enumerate}
	\item {Design and evaluation of C++ open multi-methods\\
\url{https://parasol.tamu.edu/~yuriys/papers/OMM10.pdf}}
\end{enumerate}

\subsection{Database}
\begin{enumerate}
	\item {The Ubiquitous B-Tree\\
\url{http://people.cs.aau.dk/~simas/aalg06/UbiquitBtree.pdf}}
	\item {Generalized Search Trees for Database Systems\\
\url{http://db.cs.berkeley.edu/papers/vldb95-gist.pdf}}
	\item {Concurrency and Recovery in Generalized Search TreeS\\
\url{http://db.cs.berkeley.edu/papers/sigmod97-gist.pdf}}

	\item {Data Cube: A Relational Aggregation Operator Generalizing Group-By, Cross-Tab, and Sub-Totals\\
	\url{http://research.microsoft.com/pubs/69578/tr-95-22.pdf}}
	\item {Query Optimization in Microsoft Sql Server PDW\\
\href{http://academic.research.microsoft.com/Publication/56916436/query-optimization-in-microsoft-sql-server-pdw}{http://academic.research.microsoft.com/Publication/56916436/query-optimization-in-microsoft-sql-server-pdw}}
	\item {Druid: A Real-Time Analytical Data Store
\url{http://static.druid.io/docs/druid.pdf}}
	\item {Map-Reduce: Simplified Dataprocessing on Large Clusters\\
\url{http://static.googleusercontent.com/media/research.google.com/en/us/archive/mapreduce-
	osdi04.pdf}}
	\item {Google’s Mapreduce Programming Model — Revisited\\
\url{http://www.idt.mdh.se/kurser/cd5100/ht06/MapReduce/Ralf-Laemmel-paper/paper.pdf}}
	\item {Cassandra - a Decentralized Structured Storage System\\
\url{http://www.cs.cornell.edu/projects/ladis2009/papers/lakshman-ladis2009.pdf}}
	\item {Bigtable: A Distributed Storage System for Structured Data\\
\url{http://static.googleusercontent.com/media/research.google.com/en//archive/bigtable-osdi06.pdf}}
	\item {Dynamo: Amazon’s Highly Available Key-Value Store\\
\url{http://s3.amazonaws.com/AllThingsDistributed/sosp/amazon-dynamo-sosp2007.pdf}}
	\item {Solving Big Data Challenges for Enterprise Application Performance Management\\
\url{http://vldb.org/pvldb/vol5/p1724_tilmannrabl_vldb2012.pdf}}
\end{enumerate}

\subsection{Data Fusion}

\begin{enumerate}
	\item {A Generic Architecture for Fusion-Based Intrusion Detection Systems\\
\url{https://rcdeboer.home.xs4all.nl/rcdb_thesis.pdf}}
\end{enumerate}

\subsection{Artificial Intelligence}
\begin{enumerate}
	\item {Computing Machinery and Intelligence\\ \url{http://orium.pw/paper/turingai.pdf}}
\end{enumerate}

\subsection{Text Mining}
\begin{enumerate}
	\item {Text Mining Infrastructure in R\\ \url{https://www.jstatsoft.org/article/view/v025i05}}
	\item {Checkers Is Solved\\ \url{http://www.eecs.wsu.edu/~holder/courses/CptS570/fall07/papers/Schaeffer07.pdf}}
	\item{Mastering the Game of Go with Deep Neural Networks and Tree Search  \url{https://gogameguru.com/i/2016/03/deepmind-mastering-go.pdf}}
\end{enumerate}

\subsection{VIPs}
\begin{enumerate}
	\item {Richard Bellman's contributions to computer science\\\url{http://www.sciencedirect.com/science/article/pii/0022247X86901460}}
\end{enumerate}

\section{Mathematics}

\subsection{Geometry}
\begin{enumerate}
	\item {An Elementary Course in Synthetic Projective Geometry}
\end{enumerate}

\subsection{Linear Algebra}
\begin{enumerate}
	\item {Basic Linear Algebra Subprograms for Fortran Usage\\
\url{https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19780018835.pdf}}
\item {An Extended Set of FORTRAN Basic Linear Algebra Subprograms\\\url{http://www.ma.man.ac.uk/~sven/pubs/Level2BLAS-1-TOMS14-88.pdf}}
	\item{FLAME: Formal Linear Algebra Methods Environment\\
\url{http://tinyurl.com/ycxkmzw7}}
	\item{The Five Greatest Applications of Markov Chains\\
\url{http://langvillea.people.cofc.edu/MCapps7.pdf}}
	\item{Linear Algebra for Computer Vision \\\url{http://buzzard.ups.edu/courses/2014spring/420projects/math420-UPS-spring-2014-wills-computer-vision.pdf}}
\end{enumerate}

\subsection{Real Analysis}
\begin{enumerate}
	\item {Coisas que o Luís precisa aprender\\
\url{http://www.todasasconfiguracoes.com/wp-content/uploads/2012/04/luis.pdf}}
\end{enumerate}

\subsection {Statistics}
\begin{enumerate}
	\item {A Note on the Generation of Random Normal Deviates\\
\url{http://projecteuclid.org/euclid.aoms/1177706645}}
	\item {Tidy Data\\
\url{http://vita.had.co.nz/papers/tidy-data.pdf}}
	\item {A Tutorial on Principal Component Analysis - Derivation, Discussion and Singular Value Decomposition\\
\url{https://www.cs.princeton.edu/picasso/mats/PCA-Tutorial-Intuition_jp.pdf}}
	\item{An introduction to ROC analysis\\
\url{https://ccrma.stanford.edu/workshops/mir2009/references/ROCintro.pdf}}
	\item{TEACHING SURVEY SAMPLING WITH THE ‘SAMPLING’ R PACKAGE
	\url{http://iase-web.org/documents/papers/icots8/ICOTS8_4J1_TILLE.pdf}}
	\item{Data Mining and Statistics: What's the Connection\\ \url{http://docs.salford-systems.com/dm-stat.pdf}}
\end{enumerate}

\subsection{Differential Equations}
\begin{enumerate}
	\item {Euler Methods, Explicit, Implicit, Symplectic\\
\url{https://www.researchgate.net/publication/302468139_Euler_Methods_Explicit_Implicit_Symplectic}}
\end{enumerate}

\subsection {Matrix Calculus}
\begin{enumerate}
	\item {The Matrix Calculus You Need For Deep Learning\\
		\url{https://arxiv.org/abs/1802.01528}}
\end{enumerate}

\subsection{Forecast}
\begin{enumerate}
	\item {Forecasting Global Climate Change\\
\url{https://faculty.wharton.upenn.edu/wp-content/uploads/2015/02/GlobalClimateChange-FWP-(2)_2.pdf}}
\end{enumerate}

\section{Science}

\subsection{Research}
\begin{enumerate}
	\item {Why Most Published Research Findings Are False\\
	\url{http://journals.plos.org/plosmedicine/article?id=10.1371/journal.pmed.0020124}}
\end{enumerate}
\section{Physics}
\begin{enumerate}
	\item {Seven Possible Alternative Interpretations of the ‘cosmological Red Shift’ Which Can do Away with the Dark Energy\\
\url{http://www.vixra.org/pdf/1403.0005v1.pdf}}
\end{enumerate}
\section{Economy}
\subsection {Political Economy}
\subsubsection{Taxes}
\begin{enumerate}
	\item {The Laffer Curve Past, Present, and Future\\
\url{http://s3.amazonaws.com/thf_media/2004/pdf/bg1765.pdf}}
	\item {Dynamic Revenue Estimation\\
\url{https://ideas.repec.org/a/aea/jecper/v10y1996i1p141-57.html}}
	\item {Dynamic Scoring an Introduction to the Issues\\
\url{https://www.aeaweb.org/annual_mtg_papers/2005/0107_1430_1304.pdf}}
\end{enumerate}

\end{document}


%%% exercise 08 %%%
% template modified by Derek Huang, original by Sean Cox.
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath, amssymb, amsfonts, enumitem, fancyhdr, tikz}
% get rid of paragraph indent
\setlength{\parindent}{0 pt}
% allow section.equation numbering
\numberwithin{equation}{section}
% allows you to copy-paste code segments. requires pygments to be installed
% natively, i.e. not just in a Python venv! for example, on WSL Ubuntu you
% need to sudo apt-get install python3-pygments (unfortunately, the version
% will be a bit dated) and cannot rely on your venv Pygments version.
\usepackage{minted}
% makes clickable links to sections
\usepackage{hyperref}
% make the link colors blue, as well as cite colors. urls are magenta
\hypersetup{
    colorlinks, linkcolor = blue, citecolor = blue, urlcolor = magenta
}
% fancy pagestyle so we can use fancyhdr for fancy headers/footers
\pagestyle{fancy}
% add logo in right of header. note that you will have to adjust logo path!
\fancyhead[R]{\includegraphics[scale = 0.15]{../bac_logo1.png}}
% don't show anything in the left and center header
\fancyhead[L, C]{}
% give enough space for logo by reducing top margin height, head separator,
% increasing headerheight. see Figure 1 in the fancyhdr documentation. if
% \topmargin + \headheight + \headsep = 0, original text margins unchanged.
\setlength{\topmargin}{-60 pt}
\setlength{\headheight}{50 pt}
\setlength{\headsep}{10 pt}
% remove decorative line in the fancy header
\renewcommand{\headrulewidth}{0 pt}

% title, author + thanks, date
\title{Exercise 8}
\author{Derek Huang\thanks{NYU Stern 2021, BAC Advanced Team.}}
\date{June 10, 2021}

% shortcut commands. the % strips additional spacing.
\newcommand{\pytest}{\href{https://docs.pytest.org/en/stable/}{pytest}}
\newcommand{\pdb}{%
    \href{https://docs.python.org/3/library/pdb.html}{\texttt{pdb}}%
}
\newcommand{\minimize}{%
    \href{%
        https://docs.scipy.org/doc/scipy/reference/generated/%
        scipy.optimize.minimize.html%
    }{\texttt{scipy.optimize.minimize}}%
}
\newcommand{\minimizetrustconstr}{%
    \href{%
        https://docs.scipy.org/doc/scipy/reference/optimize.%
        minimize-trustconstr.html%
    }{\texttt{minimize(method="trust-constr")}}%
}
\newcommand{\coomatrix}{%
    \href{%
        https://docs.scipy.org/doc/scipy/reference/generated/%
        scipy.sparse.coo_matrix.html%
    }{\texttt{scipy.sparse.coo\_matrix}}%
}
\newcommand{\Bounds}{%
    \href{%
        https://docs.scipy.org/doc/scipy/reference/generated/%
        scipy.optimize.Bounds.html%
    }{\texttt{Bounds}}%
}
\newcommand{\LinearConstraint}{%
    \href{%
        https://docs.scipy.org/doc/scipy/reference/generated/%
        scipy.optimize.LinearConstraint.html%
    }{\texttt{LinearConstraint}}%
}

\begin{document}

\maketitle
% need to include this after making title to undo the automatic
% \thispagestyle{plain} command that is issued.
\thispagestyle{fancy}

% remove some space between title and first section to keep text on one page.
% comment this line out or adjust the space reduction as needed. generally,
% try to remove as little space as possible if you are trying to keep content
% on one page, else comment this line out if content spans multiple pages.
%\vspace{-20 pt}

\section{Introduction}

The goal of this exercise is to implement a hinge loss linear support vector classifier, solving both the primal and dual formulations using \minimize{} with \texttt{method="trust-constr"}.

\section{Instructions}

\subsection{General}

The \texttt{exercise\_08.py} file contains the \texttt{LinearSVC} class, unit
tests, and \pytest{} fixtures. Complete the \texttt{fit} method of the
\texttt{LinearSVC} class by replacing
\texttt{\#\#\# your code goes here \#\#\#} comment blocks with appropriate
Python code. Note that some comment blocks inside \texttt{if} statements may
contain the \texttt{pass} statement, which is included only to silence
language parser/linter complaints about improper block indentation.

\medskip

Your code \textbf{must} be written in the areas marked by these blocks. Do
\textbf{not} change any of the pre-written code. The exercise is complete
$ \Leftrightarrow $ \texttt{pytest /path/to/exercise\_08.py} executes with
zero test failures.

\subsection{Using \texttt{trust-constr}}

For this exercise, we solve both the primal and dual linear SVC problems
using \minimize{}, the \textit{de facto} standard Python open-source
minimization routine, using a trust region method\footnote{
    We did not cover trust region methods last lecture, but knowledge of how
    they work is not needed for this exercise.
} for constrained optimization, i.e. the \texttt{trust-constr} solver, with
analytical gradient and Hessian. To do so, there are a few things that must
be done when invoking \minimize.

\begin{enumerate}
    \item
    \texttt{"trust-constr"} must be passed to the \texttt{method} keyword
    argument of \minimize.

    \item
    A function that returns the gradient of the required objective
    \texttt{fun} must be passed to the \texttt{jac} keyword argument and a
    function that returns the Hessian of \texttt{fun} must be passed to the
    \texttt{hess} keyword argument.

    \item
    Bounds on the optimization variable must be specified. When using an
    instance of the \Bounds{} class, the recommended practice, as the
    \Bounds{} class provides an easier way to express bounds compared to a
    list of tuples, \texttt{keep\_feasible} should not be specified and left
    to take its default value \texttt{False}.

    \item
    Problem constraints must be specified. Written in matrix-vector form as
    a function of the optimization variable, both primal and dual constraints
    are linear and can thus be expressed with a single \LinearConstraint{}
    instance with \texttt{keep\_feasible=False}.

    \item
    Solver convergence options must be specified if necessary, passed as a
    \texttt{dict} to the \texttt{options} keyword argument. The documentation
    for \minimizetrustconstr{} enumerates the key-value pairs that can be
    specified in the \texttt{dict} passed to \texttt{options} when
    \texttt{method="trust-constr"}.
\end{enumerate}

Here we show an example of using \minimize{} with
\texttt{method="trust-constr"} to solve a mean-variance portfolio
optimization problem, i.e. finding the portfolio
$ \mathbf{w}^* \in \mathbb{R}^n $ that solves the convex QP
\begin{equation} \label{eq:max_norm_port_opt}
    \begin{array}{ll}
        \displaystyle\min_{\mathbf{w}} &
            \frac{1}{2}\mathbf{w}^\top\mathbf{Cw} \\
        \text{s.t.} & \mathbf{1}^\top\mathbf{w} = 1 \\
            & \Vert\mathbf{w}\Vert_\infty \le \tau
    \end{array}
\end{equation}

Here $ \mathbf{C} \succ \mathbf{0} \in \mathbb{R}^{n \times n} $ is the
covariance matrix of the asset returns and $ \tau > 0 $ limits the maximum
fraction of wealth that can be invested in any asset. Assume that
$ \mathbf{C} $, represented in code by \texttt{cov}, has already been
computed and has shape \texttt{(n\_assets, n\_assets)} and that $ \tau $,
represented in code with \texttt{thres}, has been set to some positive value.
Furthermore, suppose that we want \texttt{trust-constr} to run for only 800
iterations with \texttt{gtol=1e-7} and initial guess $ \frac{1}{n}\mathbf{1}
\in \mathbb{R}^n $. We can then appropriately solve
(\ref{eq:max_norm_port_opt}) numerically using

\begin{minted}[autogobble]{python3}
import numpy as np
from scipy.optimize import Bounds, LinearConstraint, minimize
# objective, gradient, hessian
fobj = lambda w: 0.5 * w @ cov @ w
fgrad = lambda w: cov @ w
fhess = lambda w: cov
# linear equality constraint, max norm constraint expressed using Bounds
eq_cons = LinearConstraint(np.ones(n_assets), 1, 1)
norm_bd = Bounds(-thres, thres)
# get optimization result and print computed portfolio
res = minimize(
    fobj, np.ones(n_assets) / n_assets, method="trust-constr", jac=fgrad,
    hess=fhess, bounds=norm_bd, constraints=eq_cons,
    options=dict(gtol=1e-7, maxiter=800)
)
print(res.x)
\end{minted}

However, since the linear SVC primal problem requires minimization over
multiple variables, we must reformulate the primal in order to solve using
\minimize.

\subsection{Primal reformulation} \label{sec:primal_reform}

Let $ \mathbf{X} \in \mathbb{R}^{N \times d} $ be the matrix of training
points, where $ \mathbf{x}_k^\top $ is the $ k $th row, and let
$ \mathbf{y} \in \{-1, 1\}^N $ be the response vector of labels. For
convenience, define the ``signed'' data matrix
$ \mathbf{Z} \in \mathbb{R}^{N \times d} $, where
\begin{equation} \label{eq:signed_X}
    \mathbf{Z} \triangleq \begin{bmatrix}
        \ y_1\mathbf{x}_1^\top \ \\ \ \vdots \ \\ \ y_N\mathbf{x}_N^\top \
    \end{bmatrix}
\end{equation}

We can then concisely write the primal linear SVC problem using
$ \mathbf{Z} $ defined in (\ref{eq:signed_X}) as
\begin{equation} \label{eq:primal_svc_opt}
    \begin{array}{ll}
        \displaystyle\min_{\mathbf{w}, b, \xi} &
            \frac{1}{2}\Vert\mathbf{w}\Vert_2^2 +
            C\mathbf{1}^\top\xi \\
        \text{s.t.} & \mathbf{Zw} + b\mathbf{y} \succeq
            \mathbf{1} - \xi  \\
            & \xi \succeq \mathbf{0}
    \end{array}
\end{equation}

Here we are jointly optimizing over $ \mathbf{w} \in \mathbb{R}^d $,
$ b \in \mathbb{R} $, $ \xi \in \mathbb{R}^N $, where $ \xi $ is the vector
of slack variables. However, we cannot directly send (\ref{eq:primal_svc_opt})
to \minimize, as the routine requires that the objective be a function of a
single variable, say $ \beta $, but we can define $ \beta \in
\mathbb{R}^{d + N + 1} $ such that $ \beta^\top \triangleq
\begin{bmatrix} \ \mathbf{w}^\top & b & \xi^\top \ \end{bmatrix} $. Letting
$ f : \mathbb{R}^{d + N + 1} \rightarrow \mathbb{R} $ be the objective, a
function of $ \beta $, we have that $ \forall \beta \in
\mathbb{R}^{d + N + 1} $,
\begin{equation} \label{eq:primal_obj_joint}
    f(\beta) \triangleq \frac{1}{2}\beta^\top\mathbf{D}\beta +
    \mathbf{a}^\top\beta
\end{equation}

Here the diagonal matrix $ \mathbf{D} \in \mathbb{R}^{(d + N + 1) \times
(d + N + 1)} $ and vector $ \mathbf{a} \in \mathbb{R}^{d + N + 1} $ are such
that
\begin{equation} \label{eq:primal_hess_and_lin_joint}
    \mathbf{D} \triangleq \begin{bmatrix}
        \ \mathbf{I}_d & \mathbf{0}_{d \times (N + 1)} \ \\
        \ \mathbf{0}_{(N + 1) \times d} & \mathbf{0}_{(N + 1) \times (N + 1)} \
    \end{bmatrix} \quad\quad \mathbf{a} \triangleq \begin{bmatrix}
        \ \mathbf{0}_{d + 1} \ \\ \ C\mathbf{1}_N \
    \end{bmatrix}
\end{equation}

From (\ref{eq:primal_obj_joint}), it's then clear that $ f $ is a
convex\footnote{
    Since $ f $ is quadratic, it is convex $ \Leftrightarrow \mathbf{D}
    \succeq \mathbf{0} $. We know that $ \mathbf{D} \succeq \mathbf{0} $ since
    $ \forall \beta \in \mathbb{R}^{d + N + 1} $, we have
	\begin{equation*}
	    \beta^\top\mathbf{D}\beta = \begin{bmatrix}
	        \ \mathbf{w}^\top & b & \xi^\top \
	    \end{bmatrix}\begin{bmatrix}
	        \ \mathbf{w} \ \\ \ 0 \ \\ \ \mathbf{0}_N \
	    \end{bmatrix} = \Vert\mathbf{w}\Vert_2^2 \ge 0
	\end{equation*}
} quadratic function of $ \beta $, so $ \nabla f $ and $ \nabla^2 f $ are
such that
\begin{equation} \label{eq:primal_grad_hess_joint}
    \nabla f(\beta) \triangleq \mathbf{D}\beta + \mathbf{a} \quad\quad
    \nabla^2f(\beta) \triangleq \mathbf{D}
\end{equation}

Now, having reformulated the objective, gradient, and Hessian of
(\ref{eq:primal_svc_opt}) to be functions of $ \beta \in
\mathbb{R}^{d + N + 1} $, we can also write the linear constraint in
(\ref{eq:primal_svc_opt}) in terms of $ \beta $. Putting the optimization
variables on one side, the constraint in terms of $ \mathbf{w} $, $ b $,
$ \xi $ is $ \mathbf{Zw} + b\mathbf{y} + \xi \succeq \mathbf{1} $, which in
terms of $ \beta $ can be written as $ \mathbf{A}\beta \succeq \mathbf{1} $,
where the linear constraint coefficient matrix $ \mathbf{A} \in
\mathbb{R}^{N \times (d + N + 1)} $ is such that
\begin{equation} \label{eq:primal_cons_mat_joint}
    \mathbf{A} \triangleq \begin{bmatrix}
        \ \mathbf{Z} & \mathbf{y} & \mathbf{I}_N \
    \end{bmatrix}
\end{equation}

Note that only $ \xi $ is bounded, in particular (\ref{eq:primal_svc_opt})
requires $ \xi \succeq \mathbf{0} $, while $ \mathbf{w} $, $ b $ are unbounded.
Although there is no easy way to express partial bounding of $ \beta $
mathematically, it is not hard to use the \Bounds{} class to require only the
$ \xi $ block of $ \beta $ to be nonnegative while leaving the $ \mathbf{w} $,
$ b $ blocks unbounded.

\subsection{Solving the primal}

To solve the reformulation of (\ref{eq:primal_svc_opt}) described in
\nameref{sec:primal_reform} using \minimize, there are a few particulars that
must be paid attention to in order to ensure correctness and efficiency.

\medskip

\begin{enumerate}
    \item
    The initial guess $ \beta_0 \in \mathbb{R}^{d + N + 1} $ provided to the
    \texttt{x0} positional argument of \minimize{} should be $ \mathbf{0} $,
    i.e. a \texttt{numpy.ndarray} shape
    \texttt{(n\_features + n\_samples + 1,)} filled with zeroes.

    \item
    $ f $, $ \nabla f $ involve the inverse regularization parameter $ C $,
    which corresponds to \texttt{self.C}.

    \item
    The primal Hessian $ \mathbf{D} $ defined in
    (\ref{eq:primal_hess_and_lin_joint}) is very sparse, as only the first
    $ d $ diagonal elements, which are all ones, are nonzero. We can save
    memory by storing its nonzero elements using a sparse matrix type, for
    example \coomatrix, and have $ \nabla^2 f $ simply return a reference to
    $ \mathbf{D} $. The memory required by $ \mathbf{D} $ is $ O(d) $ if
    $ \mathbf{D} $ is stored as a \coomatrix\footnote{
        COO sparse matrices do not support sparse arithmetic
        operations, but \minimizetrustconstr{} introduces a \href{%
            https://github.com/scipy/scipy/blob/master/scipy/optimize/%
            % need to escape the # but not the _
            _differentiable_functions.py\#L162-L185%
        }{wrapper for the Hessian} that converts sparse matrices to CSR
        sparse matrices, which do support sparse arithmetic.
    }, but is $ O((d + N + 1)^2) $ if $ \mathbf{D} $ is stored as a
    \texttt{numpy.ndarray}. Note that both $ f $, $ \nabla f $ can be
    evaluated without $ \mathbf{D} $.

    \item
    The linear constraint coefficient matrix $ \mathbf{A} $ defined in
    (\ref{eq:primal_cons_mat_joint}) is also sparse, as only $ N(d + 2) $
    elements out of $ N(d + N + 1) $ are nonzero, so memory can be saved by
    storing $ \mathbf{A} $ as a \coomatrix. The linear constraint
    $ \mathbf{A}\beta \succeq \mathbf{1} $ can be easily expressed as a
    \LinearConstraint{} with $ \mathbf{A} $ passed to \texttt{A}.

    \item
    \texttt{self.tol} and \texttt{self.max\_iter} must be respectively paired
    with the \texttt{gtol} and \texttt{maxiter} keys of the \texttt{dict} sent
    to the \texttt{options} keyword argument of \minimize.
\end{enumerate}

%\subsection{Solving the dual}

%The linear SVC dual problem can be written as
%\begin{equation*}
%    \begin{array}{ll}
%        \displaystyle\min_\alpha & \frac{1}{2}\alpha^\top\mathbf{ZZ}^\top\alpha
%            - \mathbf{1}^\top\alpha \\
%        \text{s.t.} & \alpha^\top\mathbf{y} = 0 \\
%            & \mathbf{0} \preceq \alpha \preceq C\mathbf{1}
%    \end{array}
%\end{equation*}

\subsection{Tips}

\begin{enumerate}
    % need to add more important tips later

    \item
    \href{%
        https://numpy.org/doc/stable/reference/generated/numpy.hstack.html%
    }{\texttt{numpy.hstack}} is very useful for creating matrices from smaller
    blocks. For example, let $ \mathbf{A} \in \mathbb{R}^{m \times n_1} $ be
    represented by \texttt{A}, a \texttt{numpy.ndarray} with shape
    \texttt{(m, n1)}, and let $ \mathbf{B} \in \mathbb{R}^{m \times n_2} $ be
    represented by \texttt{B}, a \texttt{numpy.ndarray} with shape
    \texttt{(m, n2)}. Then, \texttt{numpy.hstack((A, B))} returns a
    \texttt{numpy.ndarray} shape \texttt{(m, n1 + n2)} representing the block
    matrix $ \begin{bmatrix} \ \mathbf{A} & \mathbf{B} \ \end{bmatrix} $.

    \item
    Use NumPy functions whenever possible for efficiency, brevity, and ease
    of debugging.

    \item
    Invoke \pytest{} with the \texttt{--pdb} flag to start \pdb, the Python
    debugger. Doing so allows you to inspect the variables in the current call
    frame and look more closely at what went wrong.
\end{enumerate}

\end{document}


\subsection{Calculating the total enhancement}

To get the total enhancement in the square simulated area (see figure~\ref{fig:symmetry}) the $\mathbf{|E|}^4$ approximation in equation \ref{eq:enhancement} was used. The measured enhancement of this area is the mean of the values within the slice.

\begin{figure}[!h]
  \centering
  \includegraphics[width=0.5\textwidth]{./images/fwhm-chart.jpg}
  \caption{The simulated square area (green box) compared to the calculated area (white box) compared to the total area measured by the laser (approximated as circle). The laser has a fwhm of \SI{570}{nm} according to ref.~\cite{heeg}.}
  \label{fig:symmetry}
\end{figure}

The average enhancement is $60.2$ for the \SI{2}{nm} corner radius, $60.2$ for the \SI{5}{nm} corner radius (both in the plane of graphene) and $59.2$ for the \SI{5}{nm} corner radius for a planar slize at $z=\SI{40}{nm}$. The similarity between these values shows that the estimation of ref.~\cite{heeg} to use the $z=\SI{40}{nm}$ plane is surprisingly accurate.

There is one last factor to be taken into account: The used laser spot with a fwhm of \SI{570}{nm} can be estimated by a circle of radius \SI{285}{nm}. The simulated area of \SI{160 000}{nm^2} just accounts for $62.7\%$ of the area of the laser spot. As the Raman signal arises from the area of the entire laser spot, the calculated total enhancement decreases when accounting for this area (see figure~\ref{fig:symmetry}).

The area around the simulated area is approximated as the mean of the outer points of the simulated area.

Taking the laser geometry into account the resulting enhancement values are $38.1$ for the \SI{2}{nm} corner radius, $37.8$ for the \SI{5}{nm} corner radius (both in the plane of graphene) and $37.2$ for the \SI{5}{nm} corner radius for a planar slice at $z=\SI{40}{nm}$.

\subsection{Spatial coherence in near-field Raman scattering}

Classical Raman scattering is treated as a spatially incoherent process which means that light emitted from several spatially distinct locations is considered to be uncorrelated and the scattered signal is proportional to the scattering volume. A recent publication suggested that at the nanoscale this assumption does not hold and there is a correlation length of about \SI{30}{nm} for Raman scattering in graphene \cite{coherence}.

To account for this effect the outgoing enhancement has to be adapted. The easiest approximation is to take the mean of a radius of \SI{30}{nm} around each point instead of the point's value directly for the outgoing enhancement, effectively blurring the slice as shown in figure~\ref{fig:coherence}. From the incoming and outgoing enhancement, the total enhancement can be calculated as\cite{maier2007}

\begin{equation}
  Enh_\mathrm{loc}(\mathbf{r},\omega_L)=\frac{\left|\mathbf{E}_\mathrm{loc}(\mathbf{r}, \omega_L)\right|^2}{\left|\mathbf{E}_0\right|^2}\frac{\left|\mathbf{E}_\mathrm{loc}(\mathbf{r}, \omega_L-\omega_\mathrm{ph})\right|^2}{\left|\mathbf{E}_0\right|^2}.
\end{equation}

Taking this approximation into account for the \SI{40}{nm} slice the total enhancement decreases from $37.2$ to $23.0$ which almost matching the measured value of $12.8$ from ref.~\cite{heeg}.

\begin{figure}[!h]
  \centering
  \includegraphics[width=0.7\textwidth]{./images/coherence.png}
  \caption{Outgoing local enhancement for a $z=\SI{40}{nm}$ slice. Due to the spatial coherence effect in near-field Raman scattering the outgoing enhancement is effectivly blurred with a radius of \SI{30}{nm} which decreases the total enhancement.}
  \label{fig:coherence}
\end{figure}


\documentclass{beamer}
\usetheme{metropolis}

\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{tcolorbox}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{array}
\usepackage{tabularx}
\usepackage{lmodern}
\usefonttheme[onlymath]{serif}
\usepackage{amsmath}

\begin{document}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}

\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}

\lstset{
	language=C++,
	basicstyle=\scriptsize\ttfamily,
	keywordstyle=\color{magenta},
	stringstyle=\color{codepurple},
	numbers=left,
	numbersep=5pt,
	numberstyle=\tiny\color{codegray},
	backgroundcolor=\color{backcolour},
	showstringspaces=false,
	tabsize=4
}

\title{Brute Force: Common Strategies}
\subtitle{Keep it simple, keep it neat}
\author{UTEC - Competitive Programming}
\date{}

\maketitle

\section{Fixing Variables}

\begin{frame}
	\frametitle{Fixing Variables}

	\begin{itemize}
		\item One of the most intuitive techniques.
		\item Usually this problems involve an equation of $m$ variables.
		\item You will \textit{fix} a variable by making it constant and then try to find the solution under this new constrain.
		\item You will iterate through all possible values of the fixed variable and see how this fixed solution contributes to the general solution of the problem.
	\end{itemize}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Fixing Variables - Example}

	Given numbers $n$, $a$, $b$ and $c$ find:
	$$|\{(x, y, z) | x, y, z \in \mathbb{Z}^{+0}
	\wedge x \leq a \wedge y \leq b \wedge z \leq c
	\wedge \frac{x}{2} + y + 2z = n\}|$$

	\begin{itemize}
		\item<2-> Fix $x$ and treat it as a constant: $y + 2z = n_0$.
		\item<3-> Fix $y$: $2z = n_1$
		\item<4-> Check if there exists a value of $z$ that satisfies the equation.
		\item<5-> This soultion has a complexity of $O(ab)$. Can we do better?
	\end{itemize}
\end{frame}

\section{Simulation with Brute Force}

\begin{frame}
	\frametitle{Simulation}

	\begin{itemize}
		\item Problems that can be solved using this strategy usually have an underlying pattern or rules that we can compute easily.
		\item To find the answer we just need to let our simulation run until we get the expected results.
		\item \textbf{Problem:} Consider the following function:
			$$ f(n) = \begin{cases} \frac{n}{2} & n \equiv 0 \pmod{2}\\
			3n + 1 & \text{otherwise} \end{cases}$$

			The cycle of a number $n$ is the number of times we need to apply function $f$ so that $n = 1$. Find the maximum cycle between two given numbers $i$ and $j$. $i, j < 10^5$
	\end{itemize}
\end{frame}

\begin{frame}
	\frametitle{Simulation: Example}

	\begin{itemize}
		\item \textit{Collatz Conjecture:} It's guaranteed that $n$ will reach $1$.
		\item<2-> Make a function \texttt{count(x)} that counts how many times we need to apply a $f$ to $x$ get $1$:
		\item<3-> Run that function for all $x$ between $i$ and $j$ and save the maximum.
		\item<4-> Complexity? Smallest cycle smaller than $10^{5} \approx 400$, therefore $O(400m)$. Where $m = max\{i - j\}$
	\end{itemize}
\end{frame}

\section{Weak Constrains}

\begin{frame}
	\frametitle{Weak Constrains}

	\begin{itemize}
		\item This problems usually seem hard until you realize an underlying constrain that reduces significantly the search space.
		\item Even the problem might have some constrains, this might be very far from the constrains that can be deduced by the statement.
		\item After finding this new constrains we can use simple brute-force.
	\end{itemize}
\end{frame}

\begin{frame}
	\frametitle{Weak Constrains: Example}

	Given $n$ and $s$ ($n,s \leq 10^{18}$), find:
	$$|\{x | x \leq n \wedge x - f(x) \geq s\}|$$
	Where $f(x)$ is the sum of digits of $x$.

	\begin{itemize}
		\item Iterating through all possible values of $n$ will never work.
		\item<2-> Observation 1: $x < s \rightarrow x - f(x) < s$
		\item<3-> Observation 2: $f(x) \leq 9 \cdot 18$
		\item<4-> Observation 3: $x \geq s + 9 \cdot 18 \rightarrow x - f(x) \geq s$
		\item<5-> We only need to check $x \in [s, s + 9 \cdot 18]$!
		\item<5-> Answer will be \texttt{count}$(s, s + 9 \cdot 18) + n - (s + 9 \cdot 18)$.
	\end{itemize}
\end{frame}

\section{Thanks for Listening!}

\end{document}