% 08VectorFields.tex
% Fund Science! & Help Ernest finish his Physics Research! : quantum super-A-polynomials - a thesis by Ernest Yeung
%
% http://igg.me/at/ernestyalumni2014
%
% Facebook     : ernestyalumni
% github       : ernestyalumni
% gmail        : ernestyalumni
% google       : ernestyalumni
% linkedin     : ernestyalumni
% tumblr       : ernestyalumni
% twitter      : ernestyalumni
% youtube      : ernestyalumni
% indiegogo    : ernestyalumni
%
% Ernest Yeung was supported by Mr. and Mrs. C.W. Yeung, Prof. Robert A. Rosenstone, Michael Drown, Arvid Kingl, Mr. and Mrs. Valerie Cheng, and the Foundation for Polish Sciences, Warsaw University.
%
% Caltech Honor Code and the spirit of Open Source/Creative Commons
%

\exercisehead{4.1}
Consider $ \begin{aligned} & \quad \\
  & 1 : \mathbb{R}^n \to \mathbb{R}^n \\ & x^i(x) = x^i \end{aligned}$, \quad \, smooth structure on $\mathbb{R}^n$, that's open.

Consider $\begin{aligned} & \quad \\
  & F: T\mathbb{R}^n \to \mathbb{R}^{2n} \\
& F(x^1 \dots x^n, v^1 \dots v^n ) = (x^1 \dots x^n, v^1 \dots v^n) \end{aligned}$ \\
$F= F^{-1}$, so clearly $F = 1_{T\mathbb{R}^n} $ is cont., bijective, and it's inverse cont. and smooth.  $F$ diffeomorphism.

\exercisehead{4.2}  $F:M \to N$.  Consider (3.6)

\[
\begin{gathered}
  \begin{aligned}
    & (U , \varphi) \subset M \quad \quad \, \varphi = (x^1 \dots x^m) \\
    & (V, \psi ) \subset N \quad \quad \, \psi = (y^1 \dots y^n)
\end{aligned}  \quad \quad \quad \, \begin{aligned} & X = X^i \frac{ \partial }{ \partial x^i } \\
    & Y = Y^j \frac{ \partial }{ \partial y^j } \end{aligned}
\end{gathered}
\]

\[
(F_* X)(f) = Y^j \frac{ \partial }{ \partial y^j} f = X(fF) = X^i \frac{ \partial }{ \partial x^i } fF = X^i \frac{ \partial (f\psi^{-1})}{ \partial y^j} \frac{ \partial }{ \partial x^i } (\psi F^j \varphi^{-1})(\varphi(p)) = X^i \frac{ \partial F^j}{ \partial x^i }(p) \frac{ \partial f}{ \partial y^j}
\]
where
\[
fF = f\psi^{-1} \psi F\varphi^{-1} \varphi \Longrightarrow fF(p) = (f\psi^{-1})(y) (\psi F\varphi^{-1})(\varphi(p))
\]
(a serious case of abuse of notation)

For $F_*X$,
\[
Y^j = X^i \frac{ \partial F^j}{ \partial x^i}
\]

\[
F_* \left. \frac{ \partial }{ \partial x^i } \right|_p = F_* \frac{ \partial }{ \partial x^i} = \delta_i^{ \, \, k } \frac{ \partial F^j}{ \partial x^k} \frac{ \partial }{ \partial y^j} = \frac{ \partial F^j}{ \partial x^i } \frac{ \partial }{ \partial y^j} = \frac{ \partial F^j}{ \partial x^i}(p) \left. \frac{ \partial }{ \partial y^j } \right|_{F(p)}
\]
with $X^k = \delta_i^{\, \, k}$

\[
\begin{aligned}
  &  F_* : TM \to TN \\
  & F_*( x^1 \dots x^n, v^1 \dots v^n) = (y^1(x) \dots y^n(x), v^i \frac{ \partial F^1}{ \partial x^i} \dots v^i \frac{ \partial F^n}{ \partial x^i} )
\end{aligned}
\]
Clearly $F_*$ smooth since $F$ smooth.

\begin{lemma}[4.8] Suppose smooth $F: M \to N$, \, $\begin{aligned} & \quad \\ & Y \in \tau(M) \\ & Z \in \tau(N) \end{aligned}$ \\
$Y,Z$, $F$-related iff $\forall \, $ smooth $\mathbb{R}$-valued $f$ on open $V \subset N$,
\[
Y(fF) = (Zf) F \quad \quad \quad (4.4)
\]
\end{lemma}

\begin{proof}
  $\forall \, p \in M$, $\forall \, $ smooth $\mathbb{R}$-valued $f$, $f$ defined near $F(p)$
\[
\begin{gathered}
  Y(fF)(p) = Y_p(fF) = (F_* Y_p)f \quad \quad \quad (F_*Y)f = Y(fF) \\
  (Zf)F(p) = (Zf)(F(p)) = Z_{F(p)}f
\end{gathered}
\]
if $(Zf) F(p) = Y(fF)(p) = Zf = (F_*Y) f $
\[
(Zf)F = Y(fF) \Longleftrightarrow Z = F_* Y \text{ i.e. iff $Y, Z$ \, $F$-related }
\]

\end{proof}

\subsubsection*{ Vector Fields on a Manifold with Boundary}

\subsection*{ Lie Brackets }

\begin{lemma}[4.12] Lie bracket of smooth vector fields $V,W$, $\begin{aligned} & \quad \\
    & [V, W ] : C^{\infty} M \to C^{\infty} M \\
    & [V, W ] f = VW f - WV f \end{aligned}$ \quad is a smooth vector fields.
\end{lemma}

\begin{proof}
  By Prop. 4.7.  ($M$ smooth, map $\mathcal{Y} : C^{\infty}M \to C^{\infty} M$ is a derivation iff $\mathcal{Y} f = Yf$, $Y$ some smooth vector field $Y \in \tau(M)$.  \\
Suffices to show $[V,W]$ derivation of $C^{\infty}M$
\[
\begin{gathered}
  [V,W] (fg) = V(W(fg)) -  W(V(fg)) = V(fWg + gWf) - W( fVg  + gVf) = \\
   = VfWg + fVW g + Vg Wf + gVWf - WfVg - fWVg - WgVf - gWVf  = \\
   =fVWg + gVWf - fWV g - gWVf = f[V,W] g + g[V,W]f
\end{gathered}
\]
\end{proof}

extremely useful coordinate formula for Lie bracket
\begin{lemma}[4.13]
  Let $\begin{aligned} & \quad \\
    & V = V^i \frac{ \partial }{ \partial x^i} \\
    & W = W^j \frac{ \partial }{ \partial x^j} \end{aligned}$ \quad \quad $\begin{aligned}
    & [V,W] = \left( V^i \frac{ \partial W^j}{ \partial x^i } - W^i \frac{ \partial V^j}{ \partial x^i } \right) \frac{ \partial }{ \partial x^j } \quad \quad \quad (45) \\
    & [V,W]  = (VW^j - WV^j) \frac{\partial }{ \partial x^j} \quad \quad \quad (46) \end{aligned}$

\end{lemma}

\begin{proof}
  $[V,W]$ smooth vector field already, its values are determined locally $\left. ([V,W] f ) \right|_U = [V,W] ( \left. f \right|_U )$  \\
It suffices to compute in a single smooth chart.
\[
\begin{gathered}
[V,W] f = V^i \frac{ \partial }{ \partial x^i } \left( W^j \frac{ \partial f}{ \partial x^j} \right) - W^j \frac{ \partial }{ \partial x^j} \left( V^i \frac{ \partial f}{ \partial x^i }\right) = V^i \frac{ \partial W^i}{ \partial x^i } \frac{ \partial f}{ \partial x^j} + V^i W^j \frac{ \partial^2 f}{ \partial x^i \partial x^j } - W^j \frac{ \partial V^i }{ \partial x^j} \frac{ \partial f}{ \partial x^i } - W^j V^i \frac{ \partial^2 f}{ \partial x^j  \partial x^i } = \\
= \left( V^i \frac{ \partial W^j}{ \partial x^i } - W^i \frac{ \partial V^j}{ \partial x^i} \right) \frac{ \partial f}{ \partial x^j}
\end{gathered}
\]

\end{proof}

\exercisehead{4.6}

For Lemma 4.15 (Properties of the Lie Bracket), part (d),

the point is to use the derivative properties of the vector fields.

\[
\begin{gathered}
  \left[fV, gW \right] h = fV( gW h ) - gW (fVh) = (fVg)(Wh) + g(fV(Wh)) - (gWf)(Vh) - f(gW)(Vh) = \\
  = g( f VW) h - (fgWV)h +   f(Vg)W h - g(Wf)Vh
\end{gathered}
\]

\begin{proposition}[4.16] (Naturality of the Lie Bracket)
  Let smooth $F:M \to N$, \quad $\begin{aligned} & \quad \\ & V_1, V_2 \in \tau(M) \\ & W_1, W_2 \in \tau(N) \end{aligned}$, \quad $V_i$ \, $F$-related to $W_i$, $i=1,2$.

Then $[V_1, V_2 ]$ $F$-related to $[W_1, W_2]$

\end{proposition}

\begin{proof}
Use Lemma 4.8, and given $V_i$, \, $F$-related to $W_i$

\[
\begin{aligned}
  & V_1 V_2 (fF) = V_1 (W_2 f) F = W_1 W_2 fF \\
  & V_2 V_1 (fF) = (W_2 W_1 f) F
\end{aligned} \quad \quad \Longrightarrow [V_1, V_2](fF) = ( [W_1, W_2] f)F
\]
So $[V_1, V_2]$ , \, $F$-related to $[W_1, W_2]$
\end{proof}

\begin{corollary}[4.17]
  Suppose $F: M \to N$ diffeomorphism, $V_1, V_2 \in \tau(M)$ \\
Then $F_*[V_1, V_2] = [F_* V_1, F_* V_2 ]$

\end{corollary}

\begin{proof} $F$ diffeomorphism.  Then Lemma 4.9, $\exists \, $ push-forward (or alternatively, by Prop. 4.16, $W_i = F_* V_i$ i.e. $F$-related).
\[
F_*[V_1, V_2 ] = [W_1, W_2 ] =  [F_* V_1, F_*V_2]
\]
\end{proof}

\subsection*{ The Lie Algebra of a Lie Group }

\[
L_g = m i_g
\]

\begin{tikzpicture}
  \matrix (m) [matrix of math nodes, row sep=2em, column sep=3em, minimum width=1em]
  {
%    U_i \subset \mathbb{R}^{n+1} - 0 &  \\
%    V_i \subset \mathbb{R}P^n  & \mathbb{R}^n  \\ };
G & G \times G & G   \\  };
%  \path[-stealth]
  \path[->]
  (m-1-1) edge node [right] {$i_g$} (m-1-2)
  (m-1-2) edge node [below] {$m$} (m-1-3);
\end{tikzpicture}

$i_g(h) = (g,h)$, $m$ is multiplication, follows $L_g$ smooth.

$L_g$ diffeomorphism of $G$, since $L_{g^{-1}}$ smooth inverse.

$\forall \, $ 2 pts. $g_1, g_2 \in G$, \, $\exists \, ! \, L_{g_2 g_1^{-1}}$ s.t. $L_{g_2 g_1^{-1}} g_1 = g_2$  many important properties of Lie groups follow from $L_{g_2 g_1^{-1}}$ as diffeomorphism.

vector field $X$ on $G$ \emph{left invariant} if
\begin{equation}
  (L_g)_* X_{g'} = X_{gg'} \quad \quad \forall \, g, g' \in G \quad \quad \quad (4.8)
\end{equation}

$L_g$ diffeomorphism.
\[
(L_g)_*(aX+ bY) = a(L_g)_*X + b(L_g)_* Y
\]
set of all smooth left-invariant vector fields on $G$ is a linear subspace $\tau(M)$, \emph{ and } closed under Lie bracket.

\begin{lemma}[4.18]
Let $G$ Lie group, suppose $X,Y$ smooth left-invariant vector fields on $G$ \\
Then $[X,Y]$ also left invariant.
\end{lemma}

\begin{proof}
  Given $\begin{aligned} & \quad \\ & (L_g)_*X = X \\ & (L_g)_* Y = Y \end{aligned}$ by def. of left-invariance.
\end{proof}

\subsection*{Vector Fields on Manifolds}

\begin{lemma}[8.6] \textbf{(Extension Lemma for Vector Fields)} \\
  $M$ smooth manifold with or without boundary \\
$A \subseteq M$ closed subset. \\
Suppose $X$ smooth vector field along $A$.  \\
Give open $U \supset A$, $\exists \, $ smooth global vector field $\widetilde{X}$ on $M$ s.t. $\left. \widetilde{X} \right|_A = X$ and $\text{supp}{\widetilde{X}} \subseteq U$
\end{lemma}

\exercisehead{8.9}

\begin{enumerate}
\item[(a)] $\forall \, p \in M$, \, $\begin{aligned} & \quad \\
  & X_p = X^i(p) \frac{ \partial }{ \partial x^i} \\
  & Y_p = Y^i(p) \frac{ \partial }{ \partial x^i } \end{aligned}$ \\
$f,g \in C^{\infty}{(M)}$

\[
\begin{aligned}
  & (fX)_p = f(p)X_p = f(p) X^i(p) \frac{ \partial }{ \partial x^i } \\
  & (gY)_p = g(p)Y_p = g(p)Y^i(p) \frac{ \partial }{ \partial x^i }
\end{aligned}
\]
\[
(fX + gY)_p  = f(p)X_p + g(p)Y_p = f(p) X^i(p) \frac{ \partial}{ \partial x^i} + g(p)Y^i(p) \frac{ \partial }{ \partial x^i } = (f(p)X^i(p) + g(p) Y^i(p)) \frac{ \partial }{ \partial x^i }
\]
$f(p)X^i(p) + g(p)Y^i(p)$ smooth so $(fX+gY)_p$ smooth.
\item[(b)] Let $g=f$
\[
(fX+fY)_p = f(p)X_p + f(p)Y_p = f(p)X^i(p) \frac{ \partial }{ \partial x^i} + f(p)Y^i(p)\frac{ \partial}{\partial x^i} = f(p)(X^i(p) + Y^i(p))\frac{ \partial }{ \partial x^i } = (f(X+Y))_p
\]
Let $Y=X$ so $\forall \, p$,
\[
(fX+gX)_p  = f(p)X_p + g(p)X_p = f(p)X^i(p)\frac{ \partial}{ \partial x^i} +g(p)X^i(p) \frac{ \partial }{ \partial x^i} = (f(p) + g(p))X^i(p)\frac{ \partial }{ \partial x^i } = ((f+g)X)_p
\]

\[
(g(fX))_p = g(p)(fX)_p= g(p)f(p)X_p = ((gf)X)_p
\]
Let $f=1$, $g=0$, $1X=X$
\end{enumerate}

\hrulefill

\subsubsection*{Local and Global Frames}

\subsubsection*{Vector Fields as Derivations of $C^{\infty}(M)$}

if $X \in \mathfrak{X}(M)$, smooth $f$ defined on open $U\subseteq M$, obtain
\[
\begin{aligned}
  & Xf : U \to \mathbb{R} \\
  & (Xf)(p) = X_p F
\end{aligned}
\]
From J. Lee: (Be careful not to confuse the notations $fX$ and $Xf$: the former is the smooth \emph{vector field} on $U$ obtained by multiplying $X$ by $f$, while the latter is the real-valued \emph{function} on $U$ obtained by applying the vector field $X$ to the smooth function $f$)

\begin{proposition}[8.14]
$X: M \to TM$

equivalent
\begin{enumerate}
\item[(a)] $X$ smooth
\item[(b)] $\forall \, f \in C^{\infty}(M)$, $Xf $ smooth on $M$
\item[(c)] $\forall \, $ open $U \subseteq M$, $\forall \, f \in C^{\infty}(M)$, $Xf \in C^{\infty}(U)$
\end{enumerate}
\end{proposition}

\begin{proof}
  (a) $\Longrightarrow $ (b), assume $X$ smooth, \\
let $f\in C^{\infty}(M)$ \\
$M$ manifold, $\forall \, p \in M$, choose smooth $x^i$ on open $U\ni p$ \\
Then $\forall \, x \in U$,
\[
Xf(x) = \left( \left. X^i(x) \frac{ \partial }{ \partial x^i} \right|_x \right) f = X^i(x) \frac{ \partial f}{ \partial x^i}(x)
\]
$X^i$ smooth on $U$ by Prop. 8.1, $Xf$ smooth in $U$
\end{proof}

\subsection*{Vector Fields and Smooth Maps}

\begin{proposition}[8.16]
  Suppose smooth $F:M\to N$, \quad \, $\begin{aligned} & \quad \\
    & X \in \mathfrak{X}(M) \\
    & Y \in \mathfrak{X}(N) \end{aligned}$ \\

Then $X,Y$ $F$-related iff $\forall \, $ smooth $h$, defined on open $V \subset N$
\[
X(hF) = (Yh)F
\]

\end{proposition}

\begin{proof}
$\forall \, p \in M$, $\forall \, $ smooth $h$ defined on open $V \ni F(p)$
\[
\begin{aligned}
  & X(hF)(p) = X_p(hF) = dF_p(X_p)h \\
  & (Yh)F(p) = Yh(F(p)) = Y_{F(p)}h
\end{aligned}
\]
$X(hF) = (Yh)F$ \quad \, $\forall \, h \in C^{\infty}(N)$ iff $dF_p(X_p) = Y_{F(p)}$ \, $\forall \, p$

\end{proof}

\begin{proposition}[8.19]
  smooth $M,N$, diffeomorphism $F:M \to N$ \\
$\forall \, X \in \mathfrak{X}(M)$, $\exists \, !$ smooth vector field on $N$ $F$-related to $X$
\end{proposition}

\begin{proof}
$\forall \, p \in M$, $F(p) = q\in N$  \\

define $Y$ by
\[
\begin{aligned}
  & Y_q = dF_{F^{-1}(q)}(X_{F^{-1}(q)} ) = dF_p(X_p) \\
  \Longrightarrow & Y_{F(p)} = dF_p(X_p)
\end{aligned}
\]
$Y: N \to TN$
\[
Y = N \xrightarrow{F^{-1}} M \xrightarrow{X} TM \xrightarrow{dF} TN
\]
$Y = dF \circ X \circ F^{-1}$

$dF, X, F^{-1}$ smooth.  $Y$ smooth.
\end{proof}
\textbf{pushforward} of $X$ by $F$, denote $F_*X$
\begin{equation}
  (F_*X)_q = dF_{F^{-1}(q)}(X_{F^{-1}(q) } ) \quad \quad \quad \, (8.7)
\end{equation}
$(F_*X)_q = dF_p(X_p)$

\begin{corollary}[8.21]
  Suppose diffeomorphism $F: M \to N$, $X \in \mathfrak{X}(M)$ \\
  $\forall \, h \in C^{\infty}(N)$
\[
((F_*X)h) \circ F = X(h\circ F)
\]
\end{corollary}

\subsubsection*{Vector Fields and Submanifolds}

\subsection*{Lie Brackets}

\begin{proposition}[8.26] \textbf{(Coordinate Formula for the Lie Bracket)}
  \begin{equation}
    [X,Y] = \left( X^i \frac{ \partial Y^j}{ \partial x^i } - Y^i \frac{ \partial X^j}{ \partial x^i } \right) \frac{\partial}{ \partial x^j }  \quad \quad \quad \, (8.8)
\end{equation}
\end{proposition}

\subsection*{The Lie Algebra of a Lie Group}

Recall that $G$ acts smoothly and transitively on itself by left translation:
\[
L_g(h) = gh
\]

$X$ on $G$ \textbf{left-invariant} if
\begin{equation}
d(L_g)_{g'}(X_{g'}) = X_{gg'} \quad \, \forall \, g, g' \in G \quad \quad \quad \, (8.12)
\end{equation}

$L_g$ diffeomorphism, so
\[
(L_g)_*X = X \quad \quad \, \forall \, g \in G
\]

\textbf{Example 8.36 (Lie Algebras)}

\begin{enumerate}
\item[(a)]
\item[(b)]
\item[(c)]
\item[(d)]
\item[(e)]
\item[(f)] $\forall \, $ vector $V$ becomes Lie algebra if $[,]=0$ \\
such a Lie algebra is \textbf{abelian}
\end{enumerate}

$\text{Lie}{G}$ Lie algebra of all smooth left-invariant vector fields on Lie Group $G$ \textbf{ Lie algebra of $G$ }

\begin{theorem}[8.37] $\begin{aligned}  & \quad \\
    & \epsilon : \text{Lie}{(G)} \to T_eG \\
    & \epsilon(X) = X_e \end{aligned}$

$\epsilon$ vector space isomorphism
\end{theorem}

\begin{proof}
  If $\epsilon(X) = X_e = 0$ for some $X \in \text{Lie}{(G)}$

left invariant $d(L_g)_{g'}(X_{g'}) = X_{gg'}$
\[
d(L_g)_e(X_e) = X_g=0 \quad \, \forall \, g \in G, \text{ so } X= 0
\]
$\epsilon$ injective

Let $V \in T_eG$ arbitrary. \\
\quad define (rough) vector field $v^L$ on $G$ by
\begin{equation}
  \left. v^L \right|_g = d(L_g)_e(v) \quad \quad \quad \, (8.13)
\end{equation}

\end{proof}

\textbf{Example 8.40}
\begin{enumerate}
\item[(a)] $L_b(x) = b + x$  \quad \quad \, $bx = b + x$ \quad \quad \, $y = x + b$ \\

$d(L_g) = 1$ \\
$X_x = X^i \frac{ \partial }{ \partial x^i }$ \\
$d(L_b)_x X_x = 1 X_x = X_x = \widetilde{X}^i \frac{ \partial }{ \partial (x+b)} = \widetilde{X}^i(x+b) \frac{ \partial }{ \partial x} = X^i(x) \frac{ \partial }{ \partial x^i }$

$X^i$ constants \\

$[X,Y]=0$ if $X,Y$ constants.

lie algebra of $\mathbb{R}^n$ abelian (cf. Example 8.36, (f))
\item[(b)]
\item[(c)]
\end{enumerate}

\begin{proposition}[8.41] \textbf{(Lie Algebra of the General Linear Group)}
  \begin{equation}
    \text{Lie}{(GL(n,\mathbb{R}))} \to T_{1_n}GL(n,\mathbb{R}) \to \mathfrak{gl}{(n,\mathbb{R})} \quad \quad \, (8.14)
\end{equation}
is isomorphism
\end{proposition}

\begin{proof}
global coordinates $X^i_{ \, \, j}$ on $GL(n,\mathbb{R})$

natural isomorphism
\[
\begin{gathered}
  T_1GL(n,\mathbb{R}) \longleftrightarrow \mathfrak{gl}(n,\mathbb{R}) \\
  A^i_{ \, \, j } \left. \frac{ \partial }{ \partial X^i_{ \, \, j }} \right|_{1_n} \longleftrightarrow (A^i_{ \, \, j})
\end{gathered}
\]

Recall
\[
d(L_g)_{g'}(X_{g'}) = X_{gg'}
\]
Recall Lie algebra of all smooth left invariant vector fields on $G$ \\
Recall (8.13)
\begin{equation}
\left. v \right|_g = d(L_g)_e(v) \quad \quad \quad \, (8.13)
\end{equation}

$L_X$ is restriction to $GL(n,\mathbb{R})$ of linear map $A \mapsto XA$ on $\mathfrak{gl}{(n,\mathbb{R})}$

\[
\begin{aligned}
  & L_X g = Xg = X^i_{ \, \, k } g^k_{ \, \, j } \\
  & L_X 1 = X1 = X^i_{ \, \, k } \delta^k_{ \, \, j } = X^i_{ \, \, j } = X
\end{aligned}
\]

$X^i_{ \, \, j}$ global coordinates on $GL(n,\mathbb{R})$, so
\[
\left. \frac{ \partial }{ \partial X^i_{\, \, j}} \right|_1 = \left. \frac{ \partial }{ \partial X^i_{\, \, j}} \right|_X
\]

\[
DL_X = \frac{ \partial}{ \partial A^k_{ \, \, j} } ( XA)^i_{ \, \, j} = \frac{ \partial }{ \partial A^k_{ \, \, l} } X^i_{ \, \, m} A^m_{ \, \, j} = X^i_{ \, \, m} \delta^m_{ \, \, k } \delta^l_{ \, \, j } = X^i_{ \, \, k } \delta^i_{ \, \, j}
\]

\[
(DL_X)_1(A) = ((DL_X)^{i \, \, \, l }_{ \, \, j \, \, \, k } A^k_{\, \, l} \left. \frac{ \partial }{ \partial X^i_{ \, \, j } } \right|_X = ( X^i_{ \, \, k } \delta^l_{ \, \, j} A^k_{ \, \, l } ) \left. \frac{ \partial }{ \partial X^i_{ \, \, j } }\right|_X = (X^i_{ \, \, k} A^k_{ \, \, j} ) \left. \frac{ \partial }{ \partial X^i_{ \, \, j} } \right|_X
\]

\end{proof}

\subsection*{Problems}

\problemhead{8-1}

$\forall \, p \in A$, choose neighborhood $W_p$ of $p$, smooth $\widetilde{X}:A \to TM$ s.t. $\widetilde{X} = X$ on $W_p \bigcap A$

Replace $W_p$ by $W_p \bigcap U$, so $W_p \subseteq U$

$\lbrace W_p | p \in A \rbrace \bigcup \lbrace M \backslash A \rbrace$ open cover of $M$

Let $\lbrace \psi_p | p \in A \rbrace \bigcup \lbrace \psi_0 \rbrace$ smooth partition of unity subordinate to this cover, with $\text{supp}{\psi_p} \subseteq W_p$, $\text{supp}{\psi_0} \subseteq M \backslash A$

$\forall \, p \in A$, $(U_p,x^i)$ smooth coordinate chart

\[
\begin{gathered}
  X_p = \left. X^i(p) \frac{ \partial }{ \partial x^i } \right|_p \\
  X^i: U_p \to \mathbb{R}
\end{gathered}
\]

$\psi_p \widetilde{X}^i(p)$ smooth on $W_p$

$\psi_p\widetilde{X}^i(p)$ has smooth extension to all of $M$ if $\psi_p \widetilde{X}^i(p) =0$ on $M\backslash \text{supp}{\psi_p}$ \\

on open $W_p \backslash \text{supp}{ \psi_p}$, they agree

define $\widetilde{X}^i:M \to \mathbb{R}$
\[
\widetilde{X}^i(x) = \sum_{p \in A} \psi_p(x) \widetilde{X}^i(p)
\]

$\lbrace \text{supp}{\psi_p} \rbrace$ locally finite, so $\sum_{p\in A} \psi_p(x) \widetilde{X}^i(p)$ has only finite number of nonzero terms in neighborhood of $\forall \, x \in M$, so $\widetilde{X}^i(x)$ smooth

If $x\in A$, $\psi_0(x) = 0$, $\widetilde{X}^i(x) = X^i(x)$ \quad \, $\forall \, p $ s.t. $\psi_p(x) \neq 0$, so
\[
\widetilde{X}^i(x) = \sum_{p\in A} \psi_p(x) X^i(x) = (\psi_0(x) + \sum_{p\in A} \psi_p(x)) X^i(x) = X^i(x)
\]
so $\widetilde{X}^i$ extension of $X$

\hrulefill

\problemhead{8-2} \textsc{Euler's Homogeneous Function Theorem}
$y = \lambda x$
\[
\frac{ \partial f}{ \partial y^i } \frac{ \partial y^i}{ \partial \lambda} = x^i \frac{ \partial f}{ \partial y^i} = x^i \frac{ \partial f}{ \partial ( \lambda x^i)} = \frac{d}{d\lambda} f(y) = \frac{d}{d\lambda} f(\lambda x) = \frac{d}{d\lambda} ( \lambda^c f(x)) = c \lambda^{c-1} f(x)
\]

$\lambda = 1$

\[
\boxed{ x^i \frac{ \partial f}{ \partial x^i } = V_x f(x) = cf(x) }
\]

\hrulefill

\problemhead{8-29}

\[
\begin{aligned}
  & \mathfrak{o}{(n)} = \lbrace A \in \mathfrak{gl}(n,\mathbb{R}) | A^T + A = 0 \rbrace \\
  & \mathfrak{o}{(3)} = \lbrace A \in \mathfrak{gl}(3,\mathbb{R}) | A^T + A = 0 \rbrace
\end{aligned}
\]

\[
\begin{aligned}
& \mathfrak{su}(n) = \lbrace A \in \mathfrak{gl}(n,\mathbb{C}) | A^* + A = 0 , \text{tr}A = 0 \brace \\
& \mathfrak{su}(2) = \lbrace A \in \mathfrak{gl}(2,\mathbb{C}) | A^* + A = 0 , \text{tr}A = 0 \brace \\
\end{aligned}
\]

$\forall \, A \in \mathfrak{su}(2)$, $A$ is of the form, for $a,b,c \in \mathbb{R}$,
\[
A = \left( \begin{matrix} ia & b + ic \\
  -b + i c & -ia \end{matrix} \right)
\]
$\forall \, B \in \mathfrak{o}(3)$, $B$ is of the form
\[
B = \left( \begin{matrix}  & a & b \\
  -a & & c \\
  -b & -c & \end{matrix} \right)
\]
Then the following identification, $F$ is clearly an isomorphism, as its 1-to-1 and onto:
\[
\begin{aligned}
  & F : \mathfrak{su}(2) \to \mathfrak{o}(3) \\
  & F\left( \begin{matrix} ia & b + ic \\
    -b + ic & -ia \end{matrix} \right) = \left( \begin{matrix} & a & b \\
    -a & & c \\
    -b & -c & \end{matrix} \right)
\end{aligned}
\]


\documentclass[12pt]{article}

\usepackage{sbc-template}

\usepackage{graphicx,url}
\usepackage{amsmath}
\usepackage{float}
\usepackage[brazil]{babel}
%\usepackage[latin1]{inputenc}
\usepackage[utf8]{inputenc}
% UTF-8 encoding is recommended by ShareLaTex

\sloppy

\title{A study on the numerical methods to solve the n-body problem\\Symplectic Integrators}

\author{Gil S. M. Neto}

\address{Instituto de Matemática - Departamento de Matemática Aplicada\\ Universidade Federal do Rio de Janeiro
  (UFRJ)\\
 Rio de Janeiro -- RJ -- Brazil
  \email{gil.neto@ufrj.br}
}

\begin{document}

\maketitle

\begin{abstract}
  This is a study on the numerical solutions for the n-body problem, modeling
  the solar system and solving Newton's Law of Gravity for the position of the planets we can take a look on how different numerical approaches behaves on this system.\\

\end{abstract}

\section{Introduction}
One might be interested in how a determined particle moves along other particles, how to determine how this system of particles evolve? If we are talking about particles, or bodies, in the macroscopic world we should take a look at Newton's Law of Universal Gravitation\\
\[
F = G \frac{m_1m_2}{r^2}
\]
Where \(G = 6.67428 \cdot 10^{-11} \frac{m^3}{kg\cdot s^2}\) is the Gravitational constant, \(m_1\) is the mass of the first body, typically the body that we are interested in the position, \(m_2\) is the body interacting with our desired body, and \(r\) is the distance between the bodies.\\
But how can this equation be of any help to determine a body position? Well, combining this with Newton's Second Law of Motion
\[
F = ma
\]
We get
\begin{align*}
m_1a &= G \frac{m_1m_2}{r^2}\\
a &= G \frac{m_2}{r^2}
\end{align*}
But acceleration is just the second derivative of position, so what we truly have is the differential equation
\[
\ddot{r} = G \frac{m_2}{\lVert r \rVert^2}
\]
So, by transforming this into an initial value problem we can solve for the body's position.\\
The N-Body problem is a well know problem, the equations described above only tells us about a system of two bodies. But what about systems with more bodies? How to simulate a galaxy, for example, or how to determine where a GPS satellite must be in Earth's orbit?\\
This article is a case study of the N-Body problem, where N = 9, so we have the sun and the eight planets of the solar system (sorry Pluto). And we will take a look at how to model Newton's Equation of Motion on the computer, as a system of linear differential equations that we can solve.
\section{One Differential Equation to rule them all} \label{sec:thediffeq}
(...) One Differential Equation to find them all. And inspired by a Lord of The Rings line, we can use our One Differential Equation to determine all bodies' position.
\[
\ddot{r} = G \frac{m_2}{\lVert r \rVert^2}
\]
Rewriting this as a system of first order linear equations:
\begin{align*}
  \begin{cases}
    \dot{r} = v \\
    \ddot{v} = G \frac{m_2}{\lVert r \rVert^2}
  \end{cases}
\end{align*}
Give us an easy way to determine a body's position. But we are dealing with a system of 9 bodies, so the force acting on our main body is the sum of all forces from all the bodies, and our differential equation for the i-th body is:
\[
\ddot{r_i} = G\sum_{j=1}^{8}\left(\frac{m_j}{\lVert r_j \rVert^2}\right), j \neq i
\]
And our system of equations to solve becomes
\begin{align*}
  \begin{cases}
    \dot{r} = v \\
    \ddot{v} = G (\frac{m_1}{\lVert r_1 \rVert^2}\right + \frac{m_2}{\lVert r_2 \rVert^2}\right + \dots + \frac{m_8}{\lVert r_8 \rVert^2})
  \end{cases}
\end{align*}
Solving this for each planet gives us all the position of planets in the solar system.
\section{The Pyshics of the problem}
Going through the Physics Laws of the problem will give us tools to verify if our model is a good model, and if the numerical solutions are, in fact, solving the right model.

\subsection{Hamiltonian and Angular Momentum}
This system under Newton's Law is a conservative system, in other words, it conserves energy, as Professor Alan Sokal from University College London says, and we can look at the Hamiltonian of the system.\\
Here \(q\) denotes position vector, so \(\dot{q}\) is the velocity vector. \\
First of all, the self potential energy
\[
U = G \displaystyle \sum_{i,j}^n \frac{m_i m_j}{\lVert q_i - q_j \rVert}
\]
The linear momentum
\[
p_i = m_i \dot{q_i}
\]
And finally the Hamiltonian
\[
H = \displaystyle \sum_{i = 1}^{n} \frac{\lVert p_i \rVert ^2}{2m_i} - U
\]
And so \(H\) is constant.\\ yy
Another conserved quantity is the Angular Momentum, which is defined as:
\[
L = r \times p
\]
\(r\) begin the position vector and \(p = mv\) the linear momentum vector.\\
We can simplify the equation for an easy one to solve
\begin{align*}
  L &= r \times p\\
  \lVert L \rVert &= \sqrt{\rVert r \lVert^2 \rVert p \lVert^2(sin(\theta))^2} \\
  &= \sqrt{\rVert r \lVert^2 \rVert p \lVert^2 - \rVert r \lVert^2 \rVert p \lVert^2(cos(\theta))^2} \\
  &= \sqrt{\rVert r \lVert^2 \rVert p \lVert^2 - \langle r, p \rangle ^2}
\end{align*}
In the second step we used the trigonometric identity \(sin^2 (t) + cos^2(t) = 1\), and in the third step \(\langle \cdot \rangle\) stands for the scalar product.\\
With this in mind, we expect that the numerical method for solving the n-body problem also conserves Energy and Angular Momentum.

\subsection{Kepler's Law}
\begin{enumerate}
  \item Planets move around the Sun in ellipses, with the Sun at one focus
  \item The line connecting the Sun to a planet sweeps equal areas in equal times
  \item The square of the orbital period of a planet is proportional to the cube of the mean distance from the Sun
\end{enumerate}
\subsubsection{First Law}
For the first Law, we will check for the eccentricity \(\epsilon \) of the orbits, if \(\lvert \epsilon \rvert < 1\) the orbit is indeed an ellipse. Also we will compare the numerical result of eccentricity to the data from NASA about the orbits.\\
Working on some Analytical Geometry, eccentricity is given by:
\[
\epsilon = \frac{ap - pe}{ap + pe}
\]
Where \(ap\) is the Aphelion (i.e. the furthest distance to the Sun) distance, \(pe\) is the Perihelion (i.e. the closest distance to the Sun) distance

\section{The numerical methods}
Given the energy conservative nature of the problem, the Euler Method and Runge-Kutta methods won't give us satisfactory results, because they don't conserve energies. Methods that conserves energy are called Symplectic methods.
In this article we will make use of the non-symplectics:
\begin{itemize}
  \item Euler (First Order)
\end{itemize}
 and the symplectic ones:
 \begin{itemize}
   \item Semi implicit Euler (Euler-Cromer - Second Order)
   \item 3 Step Verlet Integrator (Leapfrog - Second Order)
   \item 7 Step Verlet Integrator (Leapfrog - Higher Order)
 \end{itemize}
  \(V(t, x), A(t, x)\) are the velocity and acceleration at time \(t\) and position \(x(t)\), \(x_t\) is the position at time \(t\), \(v_t\) is the velocity at time \(t \), \(h\) is the time step.
 \subsubsection{Euler}
 \begin{align*}
   x_{t+1} &= x_t + h v_t\\
   v_{t+1} &= v_t + h a_t
 \end{align*}
 \subsubsection{Euler-Cromer}
 \begin{align*}
  v_{t+1} &= v_t + h a_t \\
  x_{t+1} &= x_t + h v_{t+1}
 \end{align*}
 \subsection{Velocity-Verlet}
 3 Step Verlet comes in two flavors, Velocity-Verlet and Position-Verlet, they yield the same results, so we will deal only with the velocity version, position one can be found in the source code.\\
 \begin{align*}
  v_{t+\frac{1}{2}} &= v_t + \frac{1}{2} h a_t \\
  x_{t+1} &= x_t + h v_{t+\frac{1}{2}}\\
  v_{t+1} &= v_{t+\frac{1}{2}} + \frac{1}{2} h A(t+1, x_{t+1})
 \end{align*}

 \subsection{7 Step Verlet - Leapfrog Integrator}
 \begin{align*}
  w &= \sqrt[3]{2}\\
  f &= 2 - w\\
  leap_1 = leap_7 &= \frac{h}{2f}\\
  leap_2 = leap_6 &= \frac{h}{f}\\
  leap_3 = leap_5 &= (1-w) \frac{h}{2f}\\
  leap_4 &= -h \frac{w}{f}\\
  x_{1} &= x_t + leap_1 \cdot v_t\\
  v_{2} &= v_t + leap__2 \cdot A(x_{1})\\
  x_{3} &= x_{1} + leap_3 \cdot v_{2}\\
  v_{4} &= v_{2} + leap_4 \cdot A(x{3})\\
  x_{5} &= x_{3} + leap_5 \cdot v_{4}\\
  v_{t+1} &= v_{4} + leap_6 \cdot A(x_{5})\\
  x_{t+1} &= x_{5} + leap_7 \cdot v_{t+1}
 \end{align*}

\section{Results}\label{sec:figs}
Now we will look at some results, the initial values for the simulation where choosen as: initial \(x\) coordinate: Aphelion distance; initial \(y\) coordinate: 0; initial velocity: Data from NASA Fact Sheet. The time step \(h\) is measured in seconds, \(h = 3600\) means \(1\) hour step.

\begin{figure}[H]
  \includegraphics[width=.4\textwidth, height =.3\textheight]{euler-3600-orbit.png}
  \includegraphics[width=.4\textwidth, height =.3\textheight]{eulercromer-3600-orbit.png}

  \includegraphics[width=.4\textwidth, height =.3\textheight]{verlet-3600-orbit.png}
  \includegraphics[width=.4\textwidth, height =.3\textheight]{leapfrog-3600-orbit.png}
  \caption{Orbits for \(h = 3600\) and simulated \(100000\) times (\(\approx 4100\) days)}
  \label{Euler Method}
\end{figure}
Just as the picture shows, the Euler Method gets off orbit, and the symplectic ones stay in orbit.
Now let's take a look at the Energy.
\begin{figure}[H]
  \includegraphics[width=.92\textwidth, height =.5\textheight]{h_euler.png}

  \includegraphics[width=.92\textwidth, height =.5\textheight]{h_leap.png}
  \caption{Mechanical Energy simulated \(100000\) times}
  \label{Euler Method}
\end{figure}
\begin{figure}[H]
  \includegraphics[width=.92\textwidth, height =.5\textheight]{an_euler.png}

  \includegraphics[width=.92\textwidth, height =.5\textheight]{an_leap.png}
  \caption{Angular momentum simulated \(40000\) times)}
  \label{Euler Method}
\end{figure}
The symplectic methods conserves the hamiltonian with bigger steps while euler methods only conserves with really small steps, also the hamiltonian with euler method is decreasing and not only a senoidal movement, while the leapfrog hamiltonian is bounded.\\
On the angular momentum graphs we can see this same characteristic.

\begin{table}[H]
\centering
\caption{Eccentricity values comparison for Kepler's third Law}
\label{tab:exTable1}
\smallskip
\begin{tabular}{|l|c|c|}
\hline
& Leapfrog Value & NASA Data\\[0.5ex]
\hline
&&\\[-2ex]
Mercury & 0.196 & 0.206\\[0.5ex]
\hline
&&\\[-2ex]
Venus & 0.018 & 0.007\\[0.5ex]
\hline
&&\\[-2ex]
Earth & 0.0164 & 0.017\\[0.5ex]
\hline
&&\\[-2ex]
Mars & 0.09 & 0.093\\[0.5ex]
\hline
&&\\[-2ex]
Jupiter & 0.05 & 0.048\\[0.5ex]
\hline
\end{tabular}
\end{table}
And so, our Model is pretty close from the pyshical data.
\section{Conclusion and links}
While the model and algorithm can be improved, like it's velocity (100000 simulations took 25 minutes on a i7 computer), we can really see the differences between the Symplectic and non-symplectic methods.\\
The 7 step Leapfrog has complexity \(\mathcal{O}(n^2)\), there's an algorithm worth mentioning: Barnes-Hut algorithm because it has complexity \(\mathcal{O}(\log{}n)\), it's widely used and it's main principle is to group distant bodies into one big body, so you reduce the amount of calculations.\\
Links for the souce code of the simulation can be found in \url{https://github.com/mirandagil/university-courses/tree/master/analise-numerica-edo-2019-1/project}

\begin{figure}[H]
  \includegraphics[width=.7\textwidth, height =.4\textheight]{planets.png}
  \caption{Leapfrog simulation with \( h = 7200 \) simulated \(100000\) times}
  \label{Euler Method}
\end{figure}

\section{References}
\begin{thebibliography}{9}
\bibitem{latexcompanion}
Alan Sokal.
\textit{Notes on MATH 0054 - Analytical Dynamics - University College London}.
\url{https://www.ucl.ac.uk/~ucahad0/}.

\bibitem{latexcompanion2}
Peter Young.
\textit{Notes on Computational Physics - University of California}.
\url{https://young.physics.ucsc.edu/115/}.

\bibitem{latexcompanion3}
Brian Tyrrell
\textit{Using numerical methods to solve the Gravitational n-Body Problem & represent the result graphically using OpenGL}.
\url{https://www.maths.tcd.ie/~btyrrel/nbody.pdf}.

\bibitem{knuthwebsite}
Planetary Fact Sheet - NASA,
\\\texttt{https://nssdc.gsfc.nasa.gov/planetary/factsheet/index.html}

\bibitem{knu2thwebsite}
MITx: 8.01.2x Mechanics: Momentum and Energy
\\\texttt{https://courses.edx.org/courses/course-v1:MITx+8.01.2x+3T2018/course/}
\end{thebibliography}

\end{document}


\section{Roll decay system identification to determine roll damping}
\subsection{PIT approach}
Investigate the Parameter Identification Technique (PIT) approach \parencite{soder_assessment_2019}.
\input{../paper/general_content/roll_diff_equation_quadratic}


\documentclass[oneside]{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{xurl}
\usepackage{hyperref}

\begin{document}
\title{How to Register WinRAR for a License File}
\author{GreenYun}
\maketitle

\section{Introduction}
WinRAR is a file archiver developed by Eugene Roshal.
Trail version of WinRAR can be download and distributed freely.
Sold and supported by win.rar GmbH, WinRAR is allowed to be used in a 40-day test period.
A license should be purchased to continue using the software.

After a person/organization/company pay to win.rar GmbH, one will receive a file named ``RARreg.key'' for registering the software.
The file may be sent on a CD or via email. Put the file and the installer within a same directory or copy it to the installation directory and complete the registration.

The proper way to register for a license file is pay to win.rar GmbH.
Yet this article will discuss the generation process of ``RARreg.key''. (Valid from version 4.x till current.)

\section{Prerequisites}
To generate the license file, one must provide his name or the company name --- referred to as ``Name''. Name containing characters other than ASCII characters is discouraged. (May lead to wrong key.)

Another information is provided by the receipt after the payment.
``License Type'' is a string that usually describes how many copies is authorized the buyer to keep.
For instance, ``Single PC usage license'', ``1000 PC usage license'', etc.

\section{A Variant of SHA-1 Algorithm}\label{SHA-1}
WinRAR adopted SHA-1 algorithm as message hash method. In general SHA-1 algorithm implementation, the digest $S$ is combined with 5 state values as
\[S=S_0S_1S_2S_3S_4\]
where $S_i$ ($i\in\left\{0,1,2,3,4\right\}$) are 32-bit unsigned integers.

The extra step before generate $S$ is doing byte-wise reverse for each $S_i$. After that concatenate them as $S$, a 160-bit unsigned integer. Note that we will store $S$ or other data discussed below in big-endian (or network order) --- the most significant byte in the front (or ``on the left'').

\subsection{Yet Another Variant}\label{YA-SHA-1}
There is another SHA-1 function used by WinRAR with all initial state values set to zero.
This function is found as the only use to generate a secret numbers with a zero-length string input, and the answer is
\[\mathtt{1050D90D0F27A54653461BD1B4E33C7C0FFD8D43}\]

\section{Digital Signature Algorithm}
The digital signature algorithm (the DSA) used by WinRAR is a variant of the SM2 digital signature algorithm.

\subsection{The Composite Field}
WinRAR chose a composite field of $\mathbb{F}_{\left(2^{15}\right)^{17}}$, described as follows.

\subsubsection{The Base Field}
The base field of $\mathbb{F}_{2^{15}}$ is generated by the primitive polynomial
\[B\left(x\right)=x^{15}+x+1\]
where the coefficients are in $\mathbb{F}_{2}$.

$\forall a\left(x\right)\in\mathbb{F}_{2^{15}}$,
\[a\left(x\right)=a_{14}x^{14}+a_{13}x^{13}+\cdots+a_1x+a_0\]
coefficients are combined as a 15-bit series, denoted as
\[a=a_{14}a_{13}\cdots a_1a_0\]

\subsubsection{The Extension Field}
The extension field of $\mathbb{F}_{\left(2^{15}\right)^{17}}$ is constructed by the primitive polynomial
\[E\left(x\right)=x^{17}+x^3+1\]
where the coefficients are in finite field $\mathbb{F}_{2^{15}}$.

$\forall b\left(x\right)\in\mathbb{F}_{\left(2^{15}\right)^{17}}$,
\[b\left(x\right)=b_{16}x^{16}+b_{15}x^{15}+\cdots+b_1x+b_0\]
and $b$ is denoted $b$ as
\[b=b_{16}b_{15}\cdots b_1b_0\]

Note that, $\forall b_i\in\mathbb{F}_{2^{15}}$, $i\in\left\{0,1,\cdots,15,16\right\}$, which means $b_i$ can be translated into a 15-bit series, and the total length of $b$ is $15\times 17=255$ bits.

\subsection{The Elliptic Curve}\label{curve}
The selected curve $C$ is
\[y^2+xy=x^3+\alpha x^2+\beta\]
where $x, y, \alpha, \beta\in\mathbb{F}_{\left(2^{15}\right)^{17}}$. WinRAR chose $\alpha=0$ and $\beta=161$, and a base point $G\in C$: (all numbers below are denoted as hexadecimal)
\begin{align*}
      G   & = \left(x_G, y_G\right)                                                     \\
      x_G & = \mathtt{56FDCBC6A27ACEE0CC2996E0096AE74FEB1ACF220A2341B898B549440297B8CC} \\
      y_G & = \mathtt{20DA32E8AFC90B7CF0E76BDE44496B4D0794054E6EA60F388682463132F931A7}
\end{align*}
And the order of $G$:
\[\mu=\mathtt{1026DD85081B82314691CED9BBEC30547840E4BF72D8B5E0D258442BBCD31}\]

\subsection{Key Generation}\label{key-gen}
WinRAR use some string (ASCII) as seed to generate private--public key pair.

\subsubsection{The Private Key}
\paragraph{First, generate hash digest for the input message.}
Calculate the digest for the input message if the length of input message is not zero, use the method described in section \ref{SHA-1}. Assign the digest to $g$.

If zero-length string is input, directly assign
\[g=\mathtt{CDE43B4C6847B9D5DC5EF4A350265329EB3EB781}\]

Now we treat $g$ a 20-byte octet stream, (significant byte first,) and concatenate a counter $c$ of a 32-bit unsigned integer after the last byte of $g$.
We will use $\parallel$ to denote ``concatenation'', which means a message $M$ should be
\[M=g\parallel c\]
which is a 25-byte stream.

\paragraph{The loop strats} by setting the counter $c$ to $1$. Send $M$ as message to the SHA-1 function described in section \ref{SHA-1}, and store the digest as $S$.
Obviously, $S$ is a 20-byte octet stream, denoted as
\[S=S_{19}S_{18}\cdots S_1S_0\]
in network order, where $S_i$ ($i\in\left\{0,1,\cdots,18,19\right\}$) are the bytes.

Assume $k$ is another octet stream, with zero-length before the loop starts.
The most least two bytes of $S$ will be taken to append to the left side of $k$:
\[k=S_1\parallel S_0\parallel k\]

Loop this process for 15 rounds, after each round increment $c$ by 1 and update to $M$.

If the digest after the $i$-time loop is denoted as $S^i$, the final $k$ after all 15 round will looks like:
\[k=S^{15}_1S^{15}_0S^{14}_1S^{14}_0\cdots S^2_1S^2_0S^1_1S^1_0\]
and this is the private key we generated.

\paragraph{To verify the key generator,} check if an empty message input generates $k=k_0$, and $k_0$ described as follows:
\[k_0=\mathtt{59FE6ABCCA90BDB95F0105271FA85FB9F11F467450C1AE9044B7FD61D65E}\]

\subsubsection{The Public Key}
As the base point $G$ on the elliptic curve is known (section \ref{curve}), the public key is calculated by multiplying the private key $k$ to the base point, according to elliptic curve arithmetics
\[P=k\cdot G\]

\paragraph{To verify the key generator,} check if $k_0$ (as described before) generates $P=P_0$, and
\begin{align*}
      P_0 & =(x_P,y_P)                                                                 \\
      x_P & =\mathtt{3861220ED9B36C9753DF09A159DFB148135D495DB3AF8373425EE9A28884BA1A} \\
      y_P & =\mathtt{12B64E62DB43A56114554B0CBD573379338CEA9124C8443C4F50E6C8B013EC20}
\end{align*}

\paragraph{A public key compress method} is used by the SM2 digital signature algorithm.
But WinRAR followed only some simplified steps:
\begin{enumerate}
      \item Let $P=\left(x_P,y_P\right)$ on the elliptic curve. if $x_P=0$, $\tilde{y}_P=0$; or else $\tilde{y}_P$ is the most least (right-most) bit of $e=y_P\cdot x_P^{-1}$ of the composite field $\mathbb{F}_{\left(2^{15}\right)^{17}}$;
      \item Concatenate $x_P$ and $\tilde{y}_P$ and obtain the bit stream.
\end{enumerate}

The compressed public key is denoted as
\[\tilde{P}=x_P\parallel\tilde{y}_P\]

\subsection{The Signing Process}\label{sign}
A message $M$ is signed using a private key $k$, following these steps:
\begin{enumerate}
      \item Pick a random number $n$, which satisfies $0<n<\mu$;\label{signing-start}
      \item Generate a digest $h$ via the algorithm described in section \ref{SHA-1}, and extend $h$ by pushing the least 10 bytes of the secret number (described in \ref{YA-SHA-1}) to its left side, which has total 30 bytes and may looks like
            \[h=\mathtt{1BD1B4E33C7C0FFD8D43}\parallel\mathrm{Sha}_1\left(M\right)\]
      \item For a point $P=\left(x_P,y_P\right)$ on the elliptic curve, let $X\left(P\right)=x_P$, then calculate
            \[r\equiv X\left(n\cdot G\right)+h\mod{\mu}\]
      \item Check if either $r=0$ or $r+n=\mu$, go to step \ref{signing-start}, else continue;
      \item Calculate
            \[s\equiv n-k\cdot r\mod{\mu}\]
      \item Check if $s=0$, go to step \ref{signing-start} or obtain signature $\left(r,s\right)$.
\end{enumerate}

\section{The Generation of the License}
Assume the input message ``Name'' and ``License Type'' are denoted as $U$ and $L$, and follow the next steps to generate the license:
\begin{enumerate}
      \item Follow the steps in section \ref{key-gen} to obtain private--public key pair with input $U$, and convert to the compressed public key form $\tilde{P}_U$;
      \item Convert $\tilde{P}_U$ into hexadecimal string form, pad with \texttt{0} on the left side until the length of the string is 64;
      \item Split the string form of $\tilde{P}_U$ into two parts --- the first 48 characters ($s^+$) and the remainders ($s^-$);
      \item Let $D_3$ be a string that is constructed as follows:
            \[D_3=\texttt{"60"}\parallel s^+\]
            where text between two double quotation mark is a string literal;
      \item Follow the steps in section \ref{key-gen} to obtain private--public key pair with input $D_3$, and convert to the compressed public key form $\tilde{P}_3$;
      \item Convert $\tilde{P}_3$ into hexadecimal string form, pad with \texttt{0} on the left side until the length of the string is 64, denoted as $D_0$;
      \item Let $I$ be a 20-character string that is constructed as follows:
            \[I=s^-\parallel D_{0,0}D_{0,1}D_{0,2}D_{0,3}\]
            where $D_{0,i}$ is the $i$th character of the string $D_0$;\\
            (\emph{Note:} In practice, WinRAR does not case the contents of $I$ at all.)
      \item Use the algorithm described in \ref{sign} with $L$ as message input and $k_0$ as private key input, obtain signature $\left(r_L,s_L\right)$;
      \item Convert $r_L$ and $s_L$ into hexadecimal string form, $s_L^+$ and $s_L^-$, pad each with \texttt{0} on its left side until both length are 60; (Remain unchanged if the length is greater than 60)
      \item Let $D_1$ be a string that is constructed as follows:
            \[D_1=\texttt{"60"}\parallel s_L^-\parallel s_L^+\]
      \item Construct a message string $M_1$ as
            \[M_1=U\parallel D_0\]
            and sign it with private key $k_0$, obtain $\left(r_1,s_1\right)$;
      \item Convert $r_1$ and $s_1$ into hexadecimal string form, $s_1^+$ and $s_1^-$, pad each with \texttt{0} on its left side until both length are 60; (Remain unchanged if the length is greater than 60)
      \item Construct a string $D_2$ as
            \[D_2=\texttt{"60"}\parallel s_1^-\parallel s_1^+\]
      \item A CRC32 checksum is calculated using the message string
            \[L\parallel U\parallel D_0\parallel D_1\parallel D_2\parallel D_3\]
      \item Convert the checksum into \textbf{decimal} string form $s_c$, pad with \texttt{0} on the left side until the length is 10;
      \item Let $l_0$, $l_1$, $l_2$ and $l_3$ are the length of $D_0$, $D_1$, $D_2$ and $D_3$, respectively, and convert $l_i$ into decimal string forms $s_{l,i}$;
      \item Let $D$ be a string constructed as follows:
            \[D=s_{l,0}\parallel s_{l,1}\parallel s_{l,2}\parallel s_{l,3}\parallel D_0\parallel D_1\parallel D_2\parallel D_3 \parallel s_c\]
\end{enumerate}

\subsection{Output}
\textbf{The first line:} a string literal: \texttt{"RAR registration data"}.\\
\textbf{The second line:} $U$.\\
\textbf{The third line:} $L$.\\
\textbf{The fourth line:} combined with a string literal \texttt{"UID="} and $I$.\\
\textbf{The following lines:} $D$ separated into 7 lines, while the first 6 lines have 54 characters each.

\section*{Reference}
\begin{enumerate}
      \item \url{https://en.wikipedia.org/wiki/WinRAR}
      \item \url{https://github.com/bitcookies/winrar-keygen}
      \item \url{https://github.com/obaby/winrar-keygen}
      \item ``GB/T 32918—2016: Information security technology—Public key cryptographic algorithm SM2 based on elliptic curves''
\end{enumerate}

\end{document}


\documentclass{memoir}
\usepackage{notestemplate}

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

\begin{document}

% \maketitle

% Notes taken on 02/10/21

\section{Generating Sets}
\label{sec:generating_sets}

\begin{defn}
	Take an \(R\)-module \(\prescript{}{R}M\) and a subset \(X \subset M\).
	\begin{enumerate}
		\item The \textbf{\(R\)-submodule generated by \(X\)} is
			\begin{align*}
				RX = \left\{r_1x_1+\ldots+r_mx_m \mid r_i \in R, \; x_i \in X, \; m \in \Z>0 \right\} .
			\end{align*}
			The set \(X\) is called the \textbf{generating set} of \(RX\).
		\item A \(R\)-submodule \(\prescript{}{R}N\) of \(\prescript{}{R}M\) is \textbf{finitely generated} if \(N = RX\) for \(\left| X \right| <\infty\) and \textbf{cyclic} if \(N=RX\) for \(\left| X \right| =1\).
	\end{enumerate}
\end{defn}

\subsection{Free Modules}
\label{sub:free_modules}

\begin{defn}[Linear independence by \(R\)-modules]
	We say that \(X = \left\{x_1,\ldots,x_n \right\} \) is \textbf{\(R\)-linearly independent} if
	\begin{align*}
		r_1x_1+\ldots+r_nx_n = 0 \implies r_i = 0 \quad \forall i = 1,\ldots,n
	\end{align*}
\end{defn}

\begin{defn}
	We say that an \(R\)-module \(\prescript{}{R}M\) is \textbf{free on the subset \(X\)} of \(M\) if
	\begin{align*}
		M = RX\\
		X \text{ is \(R\)-linearly independent}
	\end{align*}
In this case, we call \(X\) the \textbf{basis} of \(\prescript{}{R}M\), and sometimes denote \(\prescript{}{R}M\) by \(F_R(X)\).\\

If \(R\) is commutative, then we call \(\left| X \right| \) the \textbf{rank} of \(\prescript{}{R}M\).
\end{defn}
This illustrates a key difference between vector spaces and modules-- vector spaces are always free, while modules need not be.

\begin{exmp}[Free and non-free modules]
Most modules have no basis! A free \(\Z\)-module is also called a \textbf{free abelian group}; lattices in \(\R^2\) are free abelian groups, while finite, non-zero abelian groups are not free.
\end{exmp}

\begin{defn}[R-Matrix]
	Let \(R\) be a ring. An \textbf{\(R\)-matrix} is a matrix whose entries are in \(R\). An \textbf{invertible \(R\)-matrix} is an \(R\)-matrix that has an inverse that is also an \(R\)-matrix. The \(n \times n\) invertible \(R\)-matrices form a group called the \textbf{general linear group over \(R\)}:
	\begin{align*}
		GL_n(R) = \left\{n\times n \text{ invertible \(R\)-matrices} \right\} .
	\end{align*}
	The \textbf{determinant} of an \(R\)-matrix \(A = (a_{ij})\) is defined in the usual way
	\begin{align*}
		\textrm{det}(A) = \sum_{p} \pm a_{1,p 1}\ldots a_{n, pn}.
	\end{align*}
	or the sum over all permutations of the indices and the sign being the sign of the permutation. Of course, all the usual properties of determinants hold for \(R\)-matrices.
\end{defn}

\begin{lemma}
	Le \(R\) be a non-zero ring. Then a square \(R\)-matrix \(A\) is invertible if and only if it has either a left inverse or a right inverse, and only if its determinant is a unit of the ring. Furthermore, an invertible \(R\)-matrix is square.
\end{lemma}

\begin{prop}[Free modules and \(R\)-matrices]
	Let \(R\) be a non-zero ring. Then the matrix \(P\) of a change of basis in a free module is an invertible \(R\)-matrix. Furthermore, any two bases of the same free module over \(R\) have the same cardinality.
\end{prop}
Every homomorphism \(f\) between two free modules is given by left multiplication by an \(R\)-matrix.

\begin{thm}[Universal Property of Free Modules]
	For any set \(A\) there is a free \(R\)-module \(F_R(A)\) on the set \(A\) and \(F_R(A)\) satisfies the \textit{universal property}: if \(\prescript{}{R}M\) is any \(R\)-module and \(\varphi :A\to M\) is any map of sets, then there is a unique \(R\)-module homomorphism \(\Phi:F_R(A) \to M\) such that \(\Phi (a) = \varphi (a)\) for all \(a \in A\). In other words, the following diagram commutes:
\begin{center}
			\begin{tikzpicture}
  \matrix (m)
    [
      matrix of math nodes,
      row sep    = 3em,
      column sep = 4em
    ]
    {
	    A & F_R(A) \\
	     & M            \\
    };
  \path
  (m-1-2) edge [->] node [right] {\(\Phi \)} (m-2-2)
    (m-1-1.east |- m-1-2)
    edge [->] node [above] {inclusion} (m-1-2)
      (m-1-1) edge [->] node [below] {$\varphi$} (m-2-2);
\end{tikzpicture}
\end{center}
Furthermore, if \(A = \left\{ a_1,\ldots,a_n \right\} \), then
\begin{align*}
	F_R(A) = Ra_1 \oplus Ra_2 \oplus \ldots \oplus Ra_n \stackrel{R}{\cong} R^{n}
\end{align*}
\end{thm}
This corresponds to the notion of free groups from group theory.

\begin{hw}
	If \(F_R,F_R'\) are free modules on the same set \(A\), there is a unique isomorphism between \(F_R\) and \(F_R'\) which is the identity map on \(A\).\\

	If \(\prescript{}{R}F\) is any free \(R\)-module with basis \(A\), then \(\prescript{}{R}F \cong F_R(A)\).
\end{hw}
If we have a free \(R\)-module with a basis \(A\), the above statement says that we can define \(R\)-module homomorphisms from the free module into other \(R\)-modules by simply specifying how the homomorphism acts on elements of \(A\).\\

The free module \(F_\Z(A)\) is called the \textbf{free abelian group on \(A\)}. If \(A\) is finite, then we say it is of \textbf{rank \(\left| A \right| \)} and is isomorphic to
\begin{align*}
	\Z \oplus \ldots^{n} \oplus \Z.
\end{align*}

%---
%
%diagonalizaton of modules etc
%
%---

\end{document}

Abstract Algebra - Introductory/Algebra II/Notes/source/Lecture8 - GeneratingSets_FreeModules.tex


\input{Homework-header}
\newcommand{\currentHW}{8}

\begin{document}

\homeworkOnATopic{}{Prerequisite Exponential Function Topics \\\standardHomeworkSubtitle}{0}{%
%DesiredHomeworkName: Prerequisite_Exponential_Function_Topics_Not_Tested
\item \input{../../freecalc/modules/logarithms/homework/derivatives-non-const-exponent}
\item \input{../../freecalc/modules/logarithms/homework/e-as-a-limit-problems-2}
\input{../../freecalc/modules/logarithms/homework/e-as-a-limit-problems-2-solutions}
\item \input{../../freecalc/modules/logarithms/homework/e-as-a-limit-and-compound-interest}
\input{../../freecalc/modules/logarithms/homework/e-as-a-limit-and-compound-interest-solutions}
\item \input{../../freecalc/modules/logarithms/homework/e-as-a-limit-various-interesting-problems}
}

\homeworkOnATopic{}{on Lecture 1 \\ \standardHomeworkSubtitle}{1}{
%DesiredHomeworkName: Inverse_Trig
\item \input{../../freecalc/modules/inverse-trig/homework/trig-evaluated-on-inverse-trig-1}
\input{../../freecalc/modules/inverse-trig/homework/trig-evaluated-on-inverse-trig-1-solutions}
\item \input{../../freecalc/modules/inverse-trig/homework/trig-evaluated-on-inverse-trig-2}
\input{../../freecalc/modules/inverse-trig/homework/trig-evaluated-on-inverse-trig-2-solutions}
\item \input{../../freecalc/modules/inverse-trig/homework/trig-evaluated-on-inverse-trig-3}
\input{../../freecalc/modules/inverse-trig/homework/trig-evaluated-on-inverse-trig-3-solutions}
\item \input{../../freecalc/modules/inverse-trig/homework/inverse-trig-derivatives}
\item \input{../../freecalc/modules/inverse-trig/homework/artan-sum-problem}
\input{../../freecalc/modules/inverse-trig/homework/artan-sum-problem-solution}
}

\homeworkOnATopic{}{on Lecture 3 \\\standardHomeworkSubtitle}{3}{
%DesiredHomeworkName: Integration_By_Parts
\item \input{../../freecalc/modules/integration-by-parts/homework/integration-by-parts2}
\input{../../freecalc/modules/integration-by-parts/homework/integration-by-parts2-solutions}
\item \input{../../freecalc/modules/integration-by-parts/homework/integration-by-parts}
\input{../../freecalc/modules/integration-by-parts/homework/integration-by-parts-solutions}
\item \input{../../freecalc/modules/integration-by-parts/homework/integrate-x-power-n-e-power-x}
\input{../../freecalc/modules/integration-by-parts/homework/integrate-x-power-n-e-power-x-solution}
}

\homeworkOnATopic{}{on Lecture 4 \\\standardHomeworkSubtitle}{4}{
%DesiredHomeworkName: Integration_Rational_Functions_Building_Blocks
\item \input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-building-blocks}
\input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-building-blocks-solutions}
\item \input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-building-block-II-and-III-parametric}
\input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-building-block-II-and-III-parametric-solution}
\item \input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-building-block-III-b-parametric}
\input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-building-block-III-b-parametric-solution}
}

\homeworkOnATopic{}{on Lecture 5 \\ \standardHomeworkSubtitle}{5}{
%DesiredHomeworkName: Integration_Rational_Functions_Partial_Fractions
\item \input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-quadratics-in-denominator-1}
\input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-quadratics-in-denominator-1-solutions}
\item \input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-complete-1}
\input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-complete-1-solutions}
\item \input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-complete-large-example-1}
\input{../../freecalc/modules/partial-fractions/homework/integration-rational-functions-complete-large-example-1-solution}
}

\homeworkOnATopic{}{on Lecture 6 \\ \standardHomeworkSubtitle}{6}{
%DesiredHomeworkName: Trig_Integrals
\item \input{../../modules/trig-integrals/homework/rationalizing-substitution-1}
\input{../../modules/trig-integrals/homework/rationalizing-substitution-1-solutions}
\item \input{../../modules/trig-integrals/homework/sinn-cosm-1}
\item \input{../../modules/trig-integrals/homework/sin-cos-1}
\item \input{../../modules/trig-integrals/homework/tan-sec-1}
\input{../../modules/trig-integrals/homework/tan-sec-1-solutions}
}

\homeworkOnATopic{}{on Lecture 7 \\\standardHomeworkSubtitle}{7}{
%DesiredHomeworkName: Integration_Radicals_Of_Quadratics
\item \input{../../modules/trig-substitution/homework/prepare-radical-of-quadratic-for-integration-complete-square}
\input{../../modules/trig-substitution/homework/prepare-radical-of-quadratic-for-integration-complete-square-solutions}
\section{Trig or Euler substitution, solutions use trig sub}
\subsection{Case 1: $\sqrt{x^2+1}$}
\item \input{../../modules/trig-substitution/homework/trig-substitution-tan-sec-1}
\input{../../modules/trig-substitution/homework/trig-substitution-tan-sec-1-solutions}
\subsection{Case 2: $\sqrt{1-x^2}$}
\item \input{../../modules/trig-substitution/homework/trig-substitution-sin-cos-1}
\input{../../modules/trig-substitution/homework/trig-substitution-sin-cos-1-solutions}
\section{Trig or Euler substitution, solutions use Euler sub}
\subsection{Case 1: $\sqrt{x^2+1}$}
\item \input{../../modules/trig-substitution/homework/integration-euler-substitution-case1}
\input{../../modules/trig-substitution/homework/integration-euler-substitution-case1-solutions}
\item \textbf{This problem will not be quizzed.}
\input{../../modules/trig-substitution/homework/integration-euler-substitution-case1-integral-radical-quadratic}
\subsection{Case 2: $\sqrt{1-x^2}$}
\item \input{../../modules/trig-substitution/homework/integration-euler-substitution-case2}
\input{../../modules/trig-substitution/homework/integration-euler-substitution-case2-solutions}
\subsection{Case 3: $\sqrt{x^2-1}$}
\item \input{../../modules/trig-substitution/homework/integration-euler-substitution-case3}
\section{Theory through problems (Optional homework, will not be quizzed, will not be tested)}
\subsection{Case 1: $\sqrt{x^2+1}$}
\subsubsection{$x=\cot \theta$}
\item \input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case1-cot}
\input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case1-cot-solution}
\item \input{../../modules/trig-substitution/homework/euler-substitution-theory-alternative-case1-cot}
\input{../../modules/trig-substitution/homework/euler-substitution-theory-alternative-case1-cot-solution}
\subsubsection{$x=\tan \theta$}
\item \input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case1-tan}
\input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case1-tan-solution}
\item \input{../../modules/trig-substitution/homework/euler-substitution-theory-alternative-case1-tan}
\subsection{Case 2: $\sqrt{1-x^2}$}
\subsubsection{$x=\cos \theta$}
\item \input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case2-cos}
\input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case2-cos-solution}
\item \input{../../modules/trig-substitution/homework/euler-substitution-theory-alternative-case1-cos}
\input{../../modules/trig-substitution/homework/euler-substitution-theory-alternative-case1-cos-solution}
\subsubsection{$x=\sin \theta$}
\item \input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case2-sin}
\input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case2-sin-solution}
\item \input{../../modules/trig-substitution/homework/euler-substitution-theory-alternative-case1-sin}
\subsection{Case 3: $\sqrt{x^2-1}$}
\subsubsection{$x=\sec \theta$}
\item \input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case2-sec}
\input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case2-sec-solution}
\item \input{../../modules/trig-substitution/homework/euler-substitution-theory-alternative-case1-sec}
\input{../../modules/trig-substitution/homework/euler-substitution-theory-alternative-case1-sec-solution}
\subsubsection{$x=\csc \theta$}
\item \input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case2-csc}
\input{../../modules/trig-substitution/homework/trig-and-euler-substitution-theory-case2-csc-solution}
\item \input{../../modules/trig-substitution/homework/euler-substitution-theory-alternative-case1-csc}
}

\homeworkOnATopic{}{on Lecture 8 \\\standardHomeworkSubtitle}{8}{
%DesiredHomeworkName: L'Hospital's_Rule
\item \input{../../freecalc/modules/lhospital/homework/lhospital-rule-coming-from-Maclaurin-series-1}
Problem \ref{eqProblemLimlixto0(arcsinx-x-x^3/6)/(sin^5 x)} can be done easily using Maclaurin series, but we challenge the student to try it using L'Hospital's rule.

\input{../../freecalc/modules/lhospital/homework/lhospital-rule-coming-from-Maclaurin-series-1-solutions}

\item
\input{../../freecalc/modules/logarithms/homework/e-as-a-limit-problems-2}
\input{../../freecalc/modules/logarithms/homework/e-as-a-limit-problems-2-solutions}
\item
\input{../../freecalc/modules/logarithms/homework/e-as-a-limit-problems}
}

\homeworkOnATopic{}{on Lecture  9\\\standardHomeworkSubtitle}{9}{
%DesiredHomeworkName: Improper_Integrals
\item \input{../../modules/improper-integrals/homework/improper-integral-convergent-or-divergent-1}
\input{../../modules/improper-integrals/homework/improper-integral-convergent-or-divergent-1-solutions}
\item \input{../../modules/improper-integrals/homework/improper-integral-convergent-or-divergent-2}
}

\homeworkOnATopic{}{on Lecture 11\\ \standardHomeworkSubtitle}{11}{
%DesiredHomeworkName: Curve_Basics_Polar_Curves
\item \input{../../modules/parametric-curves/homework/match-x-t-and-y-t-graph-to-x-y-graph-1}
\item \input{../../modules/polar-curves/homework/match-polar-curve-graph-to-formula}
\item \input{../../modules/polar-curves/homework/sketch-the-curve-1}
\input{../../modules/polar-curves/homework/sketch-the-curve-1-solutions}
}

\homeworkOnATopic{}{on Lecture 12 \\ \standardHomeworkSubtitle}{12}{
%DesiredHomeworkName: Tangents_Curve_Length
\item \input{../../modules/parametric-curves/homework/find-horizontal-vertical-tangents}
\item \input{../../modules/parametric-curves/homework/show-multiple-tangents}
\item \input{../../modules/parametric-curves/homework/curve-length-1}
\input{../../modules/parametric-curves/homework/curve-length-1-solutions}
\item \input{../../modules/parametric-curves/homework/curve-length-2}
}

\homeworkOnATopic{}{on Lecture 13\\ \standardHomeworkSubtitle}{13}{
%DesiredHomeworkName: Area_Locked_By_Curves
\item \input{../../modules/parametric-curves/homework/area-under-curve-1}
\item \input{../../modules/polar-curves/homework/area-locked-by-curve-1}
\input{../../modules/polar-curves/homework/area-locked-by-curve-1-solutions}
\item \input{../../modules/polar-curves/homework/area-locked-by-curve-2}
}

\homeworkOnATopic{}{on Lecture 15 \\\standardHomeworkSubtitle}{15}{
%DesiredHomeworkName: Sequences
\item \input{../../modules/sequences/homework/sequence-list-sequence-terms-1}
\item \input{../../modules/sequences/homework/sequence-list-sequence-recursive-terms-1}
\item \input{../../modules/sequences/homework/guess-sequence-formula-1}
\item
\input{../../modules/sequences/homework/convergent-or-divergent-sequence-1}
\input{../../modules/sequences/homework/convergent-or-divergent-sequence-1-solutions}
}

\homeworkOnATopic{}{on Lecture 16 \\\standardHomeworkSubtitle}{16}{
%DesiredHomeworkName: Series
\item \input{../../modules/series/homework/express-infinite-decimal-as-rational-1}
\input{../../modules/series/homework/express-infinite-decimal-as-rational-1-solutions}
\item  \input{../../modules/series/homework/geometric-series-sum-1}
\input{../../modules/series/homework/geometric-series-sum-1-solutions}
\item \input{../../modules/series/homework/telescoping-series-2}
\input{../../modules/series/homework/telescoping-series-2-solutions}
\item \textbf{Problems b, c, d will not appear on the quiz.}
\input{../../modules/series/homework/telescoping-series-1}
\input{../../modules/series/homework/telescoping-series-1-solutions}
}

\homeworkOnATopic{}{on Lecture 17 \\\standardHomeworkSubtitle}{17}{
%DesiredHomeworkName: Basic_Convergence_Divergence_Tests_Integral_Test
\item \input{../../modules/series/homework/series-basic-tests-1}
\input{../../modules/series/homework/series-basic-tests-1-solutions}
\input{../../modules/series/homework/series-integral-or-comparison-test-1}
\input{../../modules/series/homework/series-integral-or-comparison-test-1-solutions}
}

\homeworkOnATopic{}{on Lecture 18 \\\standardHomeworkSubtitle}{18}{
%DesiredHomeworkName: Absolute_Convergence_Ratio_Root_Test
\item \input{../../modules/series/homework/series-ratio-and-or-root-test-2}
\input{../../modules/series/homework/series-ratio-and-or-root-test-2-solutions}
\item \input{../../modules/series/homework/convergence-x-to-the-nth-n-factorial-div-n-to-the-n-th}
}

\homeworkOnATopic{}{on Lecture 19 \\\standardHomeworkSubtitle}{19}{
%DesiredHomeworkName: Power_Series
\item \input{../../modules/power-series/homework/interval-of-convergence-1}
\input{../../modules/power-series/homework/interval-of-convergence-1-solutions}
\item \input{../../modules/power-series/homework/find-maclaurin-series-1}
\item \input{../../modules/power-series/homework/find-maclaurin-series-4}
\item \input{../../modules/power-series/homework/find-maclaurin-series-5}
\input{../../modules/power-series/homework/find-maclaurin-series-5-solutions}
\item \input{../../modules/power-series/homework/newton-binomial-integer-generalized}
\input{../../modules/power-series/homework/newton-binomial-integer-generalized-solution}
\item
\input{../../modules/power-series/homework/newton-binomial-generalized}
\input{../../modules/power-series/homework/newton-binomial-generalized-solution}
\item
\input{../../modules/power-series/homework/find-maclaurin-series-6}
\input{../../modules/power-series/homework/find-maclaurin-series-6-solutions}
\item \input{../../modules/power-series/homework/find-taylor-series-1}
\input{../../modules/power-series/homework/find-taylor-series-1-solutions}
\item \input{../../modules/power-series/homework/find-taylor-series-2}
\item \textbf{(This problem is of higher difficulty, it will not appear on the quiz.) }
\input{../../modules/power-series/homework/example-non-zero-function-with-zero-maclaurin-series}
}

\homeworkOnATopic{}{on Lecture 20\\ \standardHomeworkSubtitle}{20}{
%DesiredHomeworkName: A_Bit_Of_Differential_Equations
\item
\input{../../modules/diff-eq-separable/homework/mixing-problem-1}
\input{../../modules/diff-eq-separable/homework/mixing-problem-1-solution}
\item \input{../../modules/diff-eq-separable/homework/separable-DFQs-1}
\input{../../modules/diff-eq-separable/homework/separable-DFQs-1-solution}
}

\homeworkOnATopic{}{on Lecture 21 \\\standardHomeworkSubtitle}{21}{
%DesiredHomeworkName: Complex_Numbers
\item \input{../../modules/complex-numbers/homework/plot-complex-number-find-principal-argument-1}
\input{../../modules/complex-numbers/homework/plot-complex-number-find-principal-argument-1-solutions}
\item \input{../../modules/complex-numbers/homework/complex-number-arithmetics-1}
\input{../../modules/complex-numbers/homework/complex-number-arithmetics-1-solutions}
\item \input{../../modules/complex-numbers/homework/find-nth-root-1}
\input{../../modules/complex-numbers/homework/find-nth-root-1-solutions}
\item \input{../../modules/complex-numbers/homework/polar-form-complex-numbers-1}
\item \input{../../modules/complex-numbers/homework/trig-identities-via-Euler-formula-1}
}

\homeworkOnATopic{}{Review problems for the final\\ This is a subset of the Master Problem Sheet}{22}{
%DesiredHomeworkName: Review_Problems_Final
\item Problems that have appeared past final(s):
\begin{enumerate}
\item Problem \ref{problemint(3x^2+2x-1)/((x-1)(x^2+1))dx}.
\item Problem \ref{problemint(sqrt(9-x^2)/(x^2)dx)}.
\item Problem \ref{problemConvergencesum_2^infty1/(xlnx)dx} (the problem was formulated slightly differently - as an improper integral).
\item Problem \ref{problemsumn=0^infty(2^n+5^n)/10^n}.
\item Problem \ref{problemsumn=2^inftyln(1-1/n^2)}.
\item Problem \ref{problemConvergencesumn=1^infty(-1)^nlnn}.
\item Problem \ref{problemConvergencesumn=2^infty(-1)^n/lnn}.
\item Problem \ref{problemTaylorlnxarounda=2}.
\item Problem \ref{problemIntervalConvergence_sum(x-2)^n/(3sqrt(n+1))}.
\item Problem \ref{problemlengthx=sqrt(t)-2t,y=8/3t^(3/4)}.
\item Problem \ref{problem-Area-swept-byr=sin2theta_outsider=1/2}.
\item Problem \ref{problemy'=y^2(1+x),y(0)=3}.
\end{enumerate}
\item  \input{../../modules/partial-fractions/homework/integration-rational-functions-complete-1}
\input{../../modules/partial-fractions/homework/integration-rational-functions-complete-1-solutions}
\item \input{../../modules/trig-substitution/homework/trig-substitution-tan-sec-1}
\input{../../modules/trig-substitution/homework/trig-substitution-tan-sec-1-solutions}
\item \input{../../modules/trig-substitution/homework/trig-substitution-sin-cos-1}
\input{../../modules/trig-substitution/homework/trig-substitution-sin-cos-1-solutions}
\item \input{../../modules/integration-by-parts/homework/integration-by-parts2}
\input{../../modules/integration-by-parts/homework/integration-by-parts2-solutions}
\item \input{../../modules/series/homework/series-integral-or-comparison-test-1}
\input{../../modules/series/homework/series-integral-or-comparison-test-1-solutions}
\item \input{../../modules/lhospital/homework/lhospital-rule-coming-from-Maclaurin-series-1}
\item \input{../../modules/series/homework/geometric-series-sum-1}
\input{../../modules/series/homework/geometric-series-sum-1-solutions}
\item \input{../../modules/series/homework/telescoping-series-2}
\input{../../modules/series/homework/telescoping-series-2-solutions}
\item \input{../../modules/series/homework/series-basic-tests-1}
\input{../../modules/series/homework/series-basic-tests-1-solutions}
\item \input{../../modules/power-series/homework/find-maclaurin-series-4}
\item \input{../../modules/power-series/homework/find-taylor-series-1}
\input{../../modules/power-series/homework/find-taylor-series-1-solutions}
\item
\input{../../modules/power-series/homework/interval-of-convergence-1}
\input{../../modules/power-series/homework/interval-of-convergence-1-solutions}
\item
\input{../../modules/parametric-curves/homework/curve-length-1}
\input{../../modules/parametric-curves/homework/curve-length-1-solutions}
\item \input{../../modules/sequences/homework/convergent-or-divergent-sequence-1}
\input{../../modules/sequences/homework/convergent-or-divergent-sequence-1-solutions}
\item
\input{../../modules/diff-eq-separable/homework/separable-DFQs-1}
\input{../../modules/diff-eq-separable/homework/separable-DFQs-1-solution}
\item  \textbf{This problem type will appear on the final as a bonus. We have not studied the material for this problem type.}
\input{../../modules/polar-curves/homework/area-locked-by-curve-1}
\input{../../modules/polar-curves/homework/area-locked-by-curve-1-solutions}
}
\end{document}


%!TEX root = TDT4265-Summary.tex
\section{Object recognition}
Object recognition is the task of finding a specific object within an image.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Patterns and pattern classes}
Patterns are arrangements of descriptors (or ``features''). Pattern recognition is assigning observed patterns to a pattern class. Usually patterns are represented as vectors (quantitative), strings, or trees (structural). When using pattern vectors, the choice of descriptors is super important.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection[Decision-theoretic methods]{Recognition based on decision-theoretic methods}
Based on decision functions. For pattern classes $\omega_1, \dots, \omega_W$, we need functions $d_1(\x), \dots, d_W(\x)$, so that if $\x$ belongs in class $\omega_i$, then $d_i(\x)$ has the largest value. The decision boundary between two classes are values of $\x$ where two decision functions have the same value.

\subsubsection{Matching}

\paragraph{Minimum distance matching} This method matches candidate vectors $\x$ to prototype vectors $\m$ that represent each class. A candidate belongs to the class with the nearest prototype (``nearness'' measured with some vector norm).

\paragraph{Correlation matching}
Using a template, you can shift it around on an image to find out where it fits best (in the sense of maximum correlation). This can easily be normalized for intensity changes, but not so easily for size and rotation.

\subsubsection{Optimum statistical classifiers}
We can also formulate a classification that is optimal in the sense of minimizing classification errors.

\subsubsection{Neural networks}
Neural networks can be used to classify images and image components. More on this somewhere else.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Feature-based object recognition}
This method depends on a lower-level method to extract features and interest points from images. These can then be matched between images to determine the location of an object. Usually your input is an image of the object alone, and an image of the object in a scene. The output is the location and orientation of the object within the scene. SIFT in Section \ref{ssec:sift} is one way to extract feature descriptors.

\subsubsection{RANSAC}
RANSAC (random sample consensus) is a method of outlier detection that can be used when matching feature vectors between images, to remove false matches. It goes like this:
\begin{enumerate}
    \item Repeat $N$ times:
    \begin{enumerate}
        \item Choose a subset $s \in S$ of points and fit your model to them.
        \item See how many points in $S$ match the model.
    \end{enumerate}
    \item Choose the best fitting model as your result.
\end{enumerate}
Here, $S$ are all your data points. $s$ is a subset large enough to define your model (2 for a line, 8 for a fundamental matrix, etc.). $N$ is a predetermined number of iterations defined to guarantee a certain probability of finding a good model.

RANSAC can do robust estimation (accurate estimation despite many outliers). However, it cannot guarantee with finite $N$ that it finds a good model, it can only guarantee it to a specified probability. It needs very many iterations for sets with many outliers, but variations exist to solve this. The number of iterations necessary to guarantee a good model with probability $p$, given outlier ratio $\epsilon$ is
\begin{equation}
    N = \frac{\log(1-p)}{\log(1-(1-\epsilon)^s)}.
\end{equation}


%!TEX root =  ../main.tex

\subsection{$xy\theta$}

\objective{Produce and derive trigonometric function graphs}

On a piece of paper or on the screen of an electronic device, we typically graph only two
variables.  3D graphs are usually ``faked'', as in orthographic projections or the like.  The
Unit Circle is actually three things graphed at once, and so somewhat obscures each:
the height (sine), the width (cosine), and the angle turned ($\theta$).  We will tease apart
various attributes of the Unit Circle and their relationships to $\theta$, in order to understand
each more clearly.

\subsubsection{$y\theta$}
\marginfig[-0in]{\chapdir/pics/TIsinx}{$y=\sin(x)$ on the TI-8*}
If we graph the height we have ascended to as the dependent variable, and the angle we
have turned as the independent variable, this corresponds to $y=\sin(x)$.  This is a good
beginning, because we are graphing the $y$ of the Unit Circle as a our $y$, but we have
changed the $x$ to $\theta$.  Enter this equation in your TI-8* and hit ZOOM-TRIG, begin
sure to be in radians mode.

The graph has not been shifted up or down at all, so its midline or \textbf{axis} is the line
$y=0$.  The graph oscillates as much as one up or one down from that axis, so 1
is the \textbf{amplitude}.  We know that the pattern of the Unit Circle (relative to
the angle turned) takes $360^\circ$ or $\tau$ radians to repeat, so that should
be the \textbf{period}.  What has the calculator done to make us get back to the
same point on the way in four tick marks?  Press WINDOW, and you will see that
the Xscl is $1.57\dots$, a.k.a. $\frac{\tau}{4}$.

Notice how the graph spends a great deal of time near the origin looking like $y=x$.
In other words, its derivative at 0 is 1.  Practice moving your writing hand in a smooth
wave, tracing the unit circle at a consistent pace, but focusing your attention on your
height above and below the $x$-axis.  This should feel that same as tracing $y=\sin(x)$.
Because this graph is so ubiquitous in nature, anything like it is described with the
adjective \textbf{sinusoidal}, and anything which moves as it does is said to be in
\textbf{simple harmonic motion}.

\subsubsection{$x\theta$}
A cosine graph is very, very similar.  Tracing the Unit Circle while focusing on your
$x$ position is nearly identical, except the cycle begins on 1.  Change you TI-8* to
$y=\cos(x)$ but change nothing else.  Now you are graphing $x$ from the Unit Circle
on $y$, and $\theta$ from the Unit Circle on $x$.

\begin{example}{Watermill}
\exProblem
A mill is powered by a water-wheel in a river, which is 12 feet in diameter.  You observe
that it takes 20 seconds to complete a rotation and only the bottom 1ft is in the water.
There is a flag or marker at the top of the wheel right now.
Create an equation to model the water-wheels behavior, graph it, and determine the
time the flag will go into the water, and how long it spends underwater each rotation.

\exSolution

We begin by reasoning from the Unit Circle to the water-wheel.  Unit Circle graphs have an
amplitude of 1 because the are waves on a circle of radius 1.  The water-wheel has
a radius of 6 ft, so that will be our amplitude.  Graphically, that would make our wave
six times taller than normal, so we need a vertical dilation of 6.  So far we have
$$
y=6\sin(x)
$$
\marginfig[-0in]{\chapdir/pics/6sinx}{$y=6\sin(x)$}
Which produces a graph as in Fig.~\ref{fig:6sinx}.  The water-wheel must have its axis
translated, if only the bottom 1ft is in the water.  With an amplitude of 6ft, our current
version is 5ft too low, so we can revise our equation to $y=6\sin(x)+5$.  We also note
that as a sine wave, our graph begins in the middle and is rising, whereas we need to
model an object beginning at the top.  Therefore, we switch our equation to a cosine
function.

The normal period of a sinusoidal wave is $\tau$, but we need the period to be 20.
Horizontal dilation is accomplished by dividing --- not multiplying, as in vertical
dilation --- so we must ask what to divide $\tau$ by in order to get 20.  The answer is
$\frac{\tau}{20}$.  Our final equation is (including the form we must use in the TI-8*):
$$
y=6\cos\frac{\tau}{20}(x)+5 = 6\cos\frac{\pi}{10}(x)+5
$$

According to the zero function of the grapher, the height is zero at $x=8.135705$
and again at $x=11.864295$, meaning the flag will go under just after 8 seconds
from now, and be underwater for a little less than 4 seconds.

\marginfig[1in]{\chapdir/pics/waterwheelgraph}{The entire mill setup visualized}
\end{example}


\chapter{Background Research on Rare-Event Simulation}
\label{ch:Background Research on Rare Event Simulation}
In this chapter background research on rare-event simulation is reviewed, including the models and the simulation algorithms. First, a descriptive presentation of the different models is conducted, where both Markovian and non-Markovian examples are given...

\section{Models, Markovian and Non-Markovian}
\label{sec:Models, Markovian and Non-Markovian}
In the current work different types of models are considered, where one of the main classifications is the requirement of memory or not. As introduced, a model without memory requirement is considered Markovian, and by opposition one that requires memory is non-Markovian. A Markovian model is a stochastic model that changes based on a random factor, and the future state depends only on the current one, not on previous states or events leading to it. A non-Markovian model does not fulfill this property, therefore only knowing the current state is not enough to completely describe the current situation. In a non-Markovian model the followed path of states and the events that lead to them are relevant as well.

\subsection{Markov Chain}
\label{sub:Markov Chain}
A Markov chain model is a static Markovian model, composed of states and transitions, where each state has incoming and outgoing transitions. Each of the outgoing transitions has a probability of being followed, and by definition, this probability only depends on the current state, not on previous visited states. Therefore, if a simulation is run over a Markov chain and at two different points in time the same state is reached, there is no difference between the execution status at those points, and all the following possible paths have the same probability in both scenarios. A simple Markov chain with three states and their transitions is presented in Figure~\ref{fig:Simple Markov Chain Model}. The values shown over the transitions correspond to their rates, and the probability is calculated with this value over the sum of all outgoing transitions of the state.

\begin{figure}[t]
\center
\includegraphics[width=.25\textwidth]{Model_Markov_Chain_Simple.pdf}
\caption{Simple Markov Chain Model}
\label{fig:Simple Markov Chain Model}
\end{figure}

The distribution of the time remaining in a state is memoryless, which is modeled with an exponential distribution: $f(x) = \lambda e^{-\lambda x}$, $F(x) = 1 - e^{-\lambda x} \ (x \geq 0)$ \cite{haas:spn}. The average firing time for a transition with rate $\lambda$ is $\lambda^{-1}$. Moreover, in a state with $t$ outgoing transitions the average time spent is:
$$ Average\ Time = \displaystyle\frac{\displaystyle 1}{\displaystyle\sum\limits_{i=0}^t (rate_i)} $$

In the example presented in Figure~\ref{fig:Simple Markov Chain Model} the transition matrix is:

\[ Q = \left( \begin{array}{ccc}
-7 & 4 & 3 \\
3 & -4 & 1 \\
2 & 0 & -2 \end{array} \right)\]

\section{Monte Carlo Simulation Algorithm}
A Monte Carlo simulation algorithm follows a standard Monte Carlo method \cite{montecalro}. Whenever a decision needs to be made, a random result is generated based on the probability of each of the possible choices. Considering a Markov chain as the underlying model for a simulation executing a Monte Carlo algorithm, given the current state there are some outgoing transitions, each of them with a probability of being executed next...

\input{sourcecode/Algorithm_Monte_Carlo}


\section{Fitness Function}\label{sec:fitness}
To determine the fitness of individuals, we use the distance travelled between cities in order of the priorities calculated by the individual parse tree. To be more specific, for each city the priority is determined using the parse tree of the individual in question; then, after the priority for all cities have been calculated, the cities are ordered by their priorities to provide a route - or solution - for the TSP. Of course, using this calculation for the fitness of an individual means an individual with a lower fitness value is deemed better than one with a higher fitness value. Algorithm \ref{alg:fitness} depicts the fitness function in its entirety.

\begin{algorithm}[H]\label{alg:fitness}
\SetAlgoLined
 \ForEach{city in cities}{
   city.priority = individual.decisionTree.calcPriority(city)\;
 }
 \BlankLine
 cities.orderBy(city.priority)\;
 \BlankLine
 return calcDistance(cities)\;
 \caption{Fitness Function}
\end{algorithm}


\documentclass[a4paper, 11pt]{article}
\usepackage{fullpage, amssymb, amsmath, graphicx, bm}

\newcommand{\mytitle}{}

\begin{document}
\noindent
\large\textbf{\mytitle} \\ \\ Tyler Gordon \\
\normalsize \today
\ \ \hrulefill
\section{Input coordinates in second dimension are same as data coordinates}
In the 1D case, the predictive distribution of a GP at coordinates $\bm{y^*} = (t^*_1, t^*_2... t^*_p)^T$ has a mean given by
\begin{equation}
	\mu_p^* = \mu_\theta(t_p^*) + K(t_p^*, \bm{t})\bm{z}
\end{equation}
where $\bm{z} = K(\bm{t}, \bm{t})^{-1}[\bm{y} - \bm{\mu_\theta}(\bm{t})]$. In the 2D case for a GP with covariance in the second dimension
defined the covariance matrix $Q(\bm{u},\bm{u})$, the predictive distribution is given by
\begin{equation}
	\bm{\mu_p}^* = \bm{\mu_\theta}(t_p^*) + K(t_p^*, \bm{t})X
\end{equation}
where $X_p = Q(\bm{u}, \bm{u})\bm{z}_{pM:(p+1)M}$ is a vector of length M and
$\bm{z} = K_{2D}^{-1}[\bm{y} - \bm{\mu_\theta}(\bm{t})]$ where $K_{2D}$ is the full
2D covariance matrix and $\bm{y} = [y(t_1, u_1), y(t_1, u_2), ...y(t_1, u_M), y(t_2, u_1), ...y(t_N, u_M)]^T$ is the dataset on which
the GP is conditioned. The algorithm for computing the predictive distribution is given by equations B26-B30 in FM17 with the
substitution of $X$ for $\bm{z}$. The result is a matrix $\mu^* \in \mathbb{Z}^{N x M}$ where $\mu_{n, m}$ is the predicted mean
at coordinates $(t_n, u_q)$.
\section{Input coordinates in second dimension are different from data coordinates}
When the input coordinates for the second dimension do not coincide with the data coordinates, the matrix X becomes
\begin{equation}
	X_p = Q(\bm{u}^*,\bm{u})\bm{z}_{pM:(p+1)M}
\end{equation}
From which we see that $\bm{X}_p$ is just the mean of the predictive distribution for a 1D process with kernel Q at input coordinates $\bm{u}^*$.
If the covariance in the second dimension is also defined by a celerite kernel, the cost of computing each $\bm{X}_p$ is
$\mathcal{O}(mM + rR)$ where $M$ is the number of data coordinates in the second dimension, $R$ is the number of
input coordinates, and $m$ and $r$ are some constants. Therefore the total cost of computing $X$ is $\mathcal{O}(mMP + rRP)$,
and the total cost of the 2D prediction algorithm is $\mathcal{O}(mMP + rRP + pP + nN) \sim \mathcal{O}((mM+rR+p)P + nN)$
\end{document}