% Like most advanced LaTeX files, this one begins with a lot of
% boilerplate. You don't need to understand (or even read) most of it.
% All you need to do is fill in your name, UMN ID, email address,
% and the number of the pset. (Search for "METADATA" to find the place
% for this.) Then, you can go straight to the "EXERCISE 1"
% section and start writing your solutions.
% The "VARIOUS USEFUL COMMANDS" section is probably worth taking a
% look at at some point.

%----------------------------------------------------------------------------------------
%	PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass[paper=a4, fontsize=12pt]{scrartcl} % A4 paper and 12pt font size
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage[english]{babel} % English language/hyphenation
\usepackage{amsmath,amsfonts,amsthm,amssymb} % Math packages
\usepackage{mathrsfs}    % More math packages
\usepackage{sectsty}  % Allows customizing section commands
\allsectionsfont{\centering \normalfont\scshape} % Make all section titles centered, the default font and small caps %remove this to left align section tites
\usepackage{hyperref} % Turns cross-references into hyperlinks,
                      % and defines \url and \href commands.
\usepackage{graphicx} % For embedding graphics files.
\usepackage{framed}   % For the "leftbar" environment used below.
\usepackage{ifthen}   % Used for the \powset command below.
\usepackage{lastpage} % for counting the number of pages
\usepackage[headsepline,footsepline,manualmark]{scrlayer-scrpage}
\usepackage[height=10in,a4paper,hmargin={1in,0.8in}]{geometry}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}     % This is a powerful tool to draw vector
                      % graphics inside LaTeX. In particular, you can
                      % use it to draw graphs.
\usepackage{verbatim} % For the "verbatim" environment, in which
                      % special symbols can be used freely without
                      % confusing the compiler. (And it's typeset in
                      % a constant-width font.)
                      % Useful, e.g., for quoting code (or ASCII art).

%\numberwithin{table}{section} % Number tables within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)

\setlength\parindent{20pt} % Makes indentation for paragraphs longer.
                           % This makes paragraphs stand out more.

%----------------------------------------------------------------------------------------
%	VARIOUS USEFUL COMMANDS
%----------------------------------------------------------------------------------------
% The commands below might be convenient. For example, you probably
% prefer to write $\powset[2]{V}$ for the set of $2$-element subsets
% of $V$, rather than writing $\mathcal{P}_2(V)$.
% Notice that you can easily define your own commands like this.
% Caveat: Some of these commands need to be properly "guarded" when
% they occur in subscripts or superscripts. So you should not write
% $K_\CC$, but rather $K_{\CC}$.
\newcommand{\CC}{\mathbb{C}} % complex numbers
\newcommand{\RR}{\mathbb{R}} % real numbers
\newcommand{\QQ}{\mathbb{Q}} % rational numbers
\newcommand{\NN}{\mathbb{N}} % nonnegative integers
\newcommand{\DD}{{\mathbb{D}}} % dual numbers
\newcommand{\PP}{\mathbb{P}} % positive integers
\newcommand{\KK}{\mathbb{K}} % notation for a ring
\newcommand{\LL}{\mathbb{L}} % notation for a ring
\newcommand{\MM}{\mathbb{M}} % notation for a ring
\newcommand{\FF}{\mathbb{F}} % notation for a field
\newcommand{\Z}[1]{\mathbb{Z}/#1\mathbb{Z}} % integers modulo k
                                            % (syntax: "\Z{k}")
\newcommand{\ZZ}{\mathbb{Z}} % integers
\newcommand{\id}{\operatorname{id}} % identity map
\newcommand{\op}{\operatorname{op}} % opposite ring
\newcommand{\End}{\operatorname{End}} % endomorphism ring
\newcommand{\lcm}{\operatorname{lcm}}
% Lowest common multiple. For historical reasons, LaTeX has a \gcd
% command built in, but not an \lcm command. The preceding line
% rectifies that.
\newcommand{\Int}{\operatorname{Int}} % integer-valued polynomials
\newcommand{\set}[1]{\left\{ #1 \right\}}
% $\set{...}$ compiles to {...} (set-brackets).
\newcommand{\abs}[1]{\left| #1 \right|}
% $\abs{...}$ compiles to |...| (absolute value, or size of a set).
\newcommand{\tup}[1]{\left( #1 \right)}
% $\tup{...}$ compiles to (...) (parentheses, or tuple-brackets).
\newcommand{\ive}[1]{\left[ #1 \right]}
% $\ive{...}$ compiles to [...] (Iverson bracket, aka truth value; also, set of first n integers; also, polynomial).
\newcommand{\ivee}[1]{\left[ \left[ #1 \right] \right]}
% $\ivee{...}$ compiles to [[...]] (formal power series).
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
% $\floor{...}$ compiles to |_..._| (floor function).
\newcommand{\underbrack}[2]{\underbrace{#1}_{\substack{#2}}}
% $\underbrack{...1}{...2}$ yields
% $\underbrace{...1}_{\substack{...2}}$. This is useful for doing
% local rewriting transformations on mathematical expressions with
% justifications. For example, try this out:
% $ \underbrack{(a+b)^2}{= a^2 + 2ab + b^2 \\ \text{(by the binomial formula)}} $
\newcommand{\powset}[2][]{\ifthenelse{\equal{#2}{}}{\mathcal{P}\left(#1\right)}{\mathcal{P}_{#1}\left(#2\right)}}
% $\powset[k]{S}$ stands for the set of all $k$-element subsets of
% $S$. The argument $k$ is optional, and if not provided, the result
% is the whole powerset of $S$.
\newcommand{\calF}{\mathcal{F}}
\newcommand{\horrule}[1]{\rule{\linewidth}{#1}} % Create horizontal rule command with 1 argument of height
\newcommand{\nnn}{\nonumber\\} % Don't number this line in an "align" environment, and move on to the next line.

%----------------------------------------------------------------------------------------
%	MAKING SUMMATION SIGNS ALWAYS PUT THEIR BOUNDS ABOVE AND BELOW
%	THE SIGN
%----------------------------------------------------------------------------------------
% The following are hacks to ensure that sums (such as
% $\sum_{k=1}^n k$) always put their bounds (i.e., the $k=1$ and the
% $n$) underneath and above the sign, as opposed to on its right.
% Same for products (\prod), set unions (\bigcup) and set
% intersections (\bigcap). Remove the 8 lines below if you do not want
% this behavior.
\let\sumnonlimits\sum
\let\prodnonlimits\prod
\let\cupnonlimits\bigcup
\let\capnonlimits\bigcap
\renewcommand{\sum}{\sumnonlimits\limits}
\renewcommand{\prod}{\prodnonlimits\limits}
\renewcommand{\bigcup}{\cupnonlimits\limits}
\renewcommand{\bigcap}{\capnonlimits\limits}

%----------------------------------------------------------------------------------------
%	ENVIRONMENTS
%----------------------------------------------------------------------------------------
% The incantations below define how theorem environments
% (\begin{theorem} ... \end{theorem}) and their likes will look like.
\newtheoremstyle{plainsl}% <name>
  {8pt plus 2pt minus 4pt}% <Space above>
  {8pt plus 2pt minus 4pt}% <Space below>
  {\slshape}% <Body font>
  {0pt}% <Indent amount>
  {\bfseries}% <Theorem head font>
  {.}% <Punctuation after theorem head>
  {5pt plus 1pt minus 1pt}% <Space after theorem headi>
  {}% <Theorem head spec (can be left empty, meaning `normal')>

% Environments which make the text inside them slanted:
\theoremstyle{plainsl}
  \newtheorem{theorem}{Theorem}[section]
  \newtheorem{proposition}[theorem]{Proposition}
  \newtheorem{lemma}[theorem]{Lemma}
  \newtheorem{corollary}[theorem]{Corollary}
  \newtheorem{conjecture}[theorem]{Conjecture}
% Environments that don't:
\theoremstyle{definition}
  \newtheorem{definition}[theorem]{Definition}
  \newtheorem{example}[theorem]{Example}
  \newtheorem{exercise}[theorem]{Exercise}
  \newtheorem{examples}[theorem]{Examples}
  \newtheorem{algorithm}[theorem]{Algorithm}
  \newtheorem{question}[theorem]{Question}
 \theoremstyle{remark}
  \newtheorem{remark}[theorem]{Remark}
\newenvironment{statement}{\begin{quote}}{\end{quote}}
\newenvironment{fineprint}{\begin{small}}{\end{small}}

%----------------------------------------------------------------------------------------
%	METADATA
%----------------------------------------------------------------------------------------
\newcommand{\myname}{Darij Grinberg} % ENTER YOUR NAME HERE
\newcommand{\myid}{00000000} % ENTER YOUR UMN ID HERE
\newcommand{\mymail}{dgrinber@umn.edu} % ENTER YOUR EMAIL HERE
\newcommand{\psetnumber}{3} % ENTER THE NUMBER OF THIS PSET HERE

%----------------------------------------------------------------------------------------
%	HEADER AND FOOTER
%----------------------------------------------------------------------------------------
\ihead{Solutions to midterm \#\psetnumber} % Page header left
\ohead{page \thepage\ of \pageref{LastPage}} % Page header right
\ifoot{\myname, \myid} % left footer
\ofoot{\mymail} % right footer

%----------------------------------------------------------------------------------------
%	TITLE SECTION
%----------------------------------------------------------------------------------------
\title{
\normalfont \normalsize
\textsc{University of Minnesota, School of Mathematics} \\ [25pt] % Your university, school and/or department name(s)
\horrule{0.5pt} \\[0.4cm] % Thin top horizontal rule
\huge Math 4281: Introduction to Modern Algebra, \\
Spring 2019:
Midterm \psetnumber\\% The assignment title
\horrule{2pt} \\[0.5cm] % Thick bottom horizontal rule
}
\author{\myname}

\begin{document}

\maketitle % Print the title

\begin{center} % Delete this if you want to save space!
{\large due date: \textbf{Monday, 6 May 2019 at 20:00} on Canvas or by email. \\

\textbf{No collaboration allowed} -- this is a midterm.

Please solve \textbf{at most 3 of the 6 exercises}!}
\end{center}

%----------------------------------------------------------------------------------------
%	EXERCISE 1
%----------------------------------------------------------------------------------------
\horrule{0.3pt} \\[0.4cm]

\section{Exercise 1: Nonunital rings and local unities}

\subsection{Problem}

A \textit{nonunital ring} is defined in the same way as we defined a ring,
except that we don't require it to be endowed with an element $1$ (and,
correspondingly, we omit the ``Neutrality of one'' axiom).
This does not mean that a nonunital ring must not contain an element $1$
that would satisfy the ``Neutrality of one'' axiom; it simply means that
such an element is not required (and not considered part of the ring
structure).
So, formally speaking, a nonunital ring is a
$4$-tuple $\tup{\KK, +, \cdot, 0}$
(while a ring in the usual sense is a $5$-tuple
$\tup{\KK, +, \cdot, 0, 1}$)
that satisfies all the ring axioms except for ``Neutrality of one''.

Thus, every ring becomes a nonunital ring if we forget its unity (i.e., if
$\tup{\KK, +, \cdot, 0, 1}$ is a ring, then $\tup{\KK, +, \cdot, 0}$
is a nonunital ring).
But there are other examples as well:
For instance, if $n \in \ZZ$ is arbitrary, then
$n \ZZ := \set{ nz \mid z \in \ZZ }
= \set{ \text{all multiples of } n }$ is a nonunital ring
(when endowed with the usual $+$, $\cdot$ and $0$).

An element $z$ of a nonunital ring $\KK$ is said to be a \textit{unity}
of $\KK$ if every $a \in \KK$ satisfies $az = za = a$.
In other words, an element $z$ of a nonunital ring $\KK$ is said
to be a \textit{unity} of $\KK$ if equipping $\KK$ with the unity
$z$ results in a ring (in the usual sense of this word).

Prove the following:

\begin{enumerate}

\item[\textbf{(a)}] If $n \in \ZZ$, then the nonunital ring $n \ZZ$
has a unity if and only if $n \in \set{1, 0, -1}$.

\item[\textbf{(b)}] Any nonunital ring has \textbf{at most one} unity.

\end{enumerate}

Now, let $\KK$ be a nonunital ring.
As usual, we write $+$ and $\cdot$ for its two operations,
and $0$ for its zero.

Let $z \in \KK$. Define a subset $U_z$ of $\KK$ by
\[
U_z = \set{ r \in \KK \mid rz = zr = r }.
\]

\begin{enumerate}

\item[\textbf{(c)}] Prove that $0 \in U_z$, and that every
$a, b \in U_z$ satisfy $a + b \in U_z$ and $ab \in U_z$.

\end{enumerate}

Thus, we can turn $U_z$ into a nonunital ring by endowing $U_z$
with the binary operations $+$ and $\cdot$ (inherited from $\KK$) and
the element $0$. Consider this nonunital ring $U_z$.

\begin{enumerate}

\item[\textbf{(d)}]
Assume that $z^2 = z$.
Prove that $z$ is a unity of the nonunital ring $U_z$.

\end{enumerate}

[\textbf{Hint:} In \textbf{(b)}, what would the product of two unities be?]

\subsection{Solution}

[...]

%----------------------------------------------------------------------------------------
%	EXERCISE 2
%----------------------------------------------------------------------------------------
\horrule{0.3pt} \\[0.4cm]

\section{Exercise 2: Rings from nonunital rings}

\subsection{Problem}

Let $\KK$ be a nonunital ring.
(See Exercise 1 for the definition of this notion.)
Let $\LL$ be the Cartesian product $\ZZ \times \KK$ (so far, just a set).
Define a binary operation $+$ on $\LL$ by setting
\[
\tup{n, a} + \tup{m, b} = \tup{n+m, a+b}
\qquad
\text{for all } \tup{n, a}, \tup{m, b} \in \LL .
\]
(This is an entrywise addition.)
Define a binary operation $\cdot$ on $\LL$ by
\[
\tup{n, a} \tup{m, b} = \tup{nm, nb + ma + ab}
\qquad
\text{for all } \tup{n, a}, \tup{m, b} \in \LL .
\]
(Here, $nb$ and $ma$ are defined in the usual way:
If $n \in \ZZ$ and $a \in \KK$, then $na \in \KK$ is defined by
\[
na=
\begin{cases}
\underbrace{a+a+\cdots+a}_{n \text{ times}},           & \text{if } n \geq 0;\\
- \tup{\underbrace{a+a+\cdots+a}_{-n \text{ times}}} , & \text{if } n < 0
\end{cases}
.
\]
This does not require $\KK$ to have a unity.)

Prove that $\LL$, endowed with these two operations $+$ and $\cdot$ and
the zero $\tup{0, 0}$ and the unity $\tup{1, 0}$, is a ring
(in the usual sense of this word).

[\textbf{Hint:} You can use rules like $n \tup{a + b} = na + nb$ and
$\tup{n + m} a = na + ma$ and $\tup{nm} a = n \tup{ma}$
(for $n, m \in \ZZ$ and $a, b \in \KK$) without proof; they can be
proven just as for usual rings.
You can also use the fact that finite sums of elements of $\KK$ are
well-defined and behave as we would expect them to
(we already tacitly used that in writing
``$\underbrace{a+a+\cdots+a}_{n \text{ times}}$'' without parentheses).

You don't need to check the ``additive'' axioms (associativity of
addition, commutativity of addition, neutrality of zero, and
existence of additive inverses); as far as addition and zero are
concerned, $\LL$ is just a Cartesian product.]

\subsection{Remark}

This exercise gives a way to ``embed'' any nonunital ring $\KK$
into a ring $\LL$.
This helps proving properties of nonunital rings, assuming that
you can prove them for rings.

There is also a much simpler notion of a Cartesian product of two nonunital
rings (in which both addition and multiplication are defined entrywise). This
lets us define a nonunital ring $\ZZ \times \KK$. But this is
\textbf{not} the ring $\LL$; it does not generally have a unity.

\subsection{Solution}

[...]

%----------------------------------------------------------------------------------------
%	EXERCISE 3
%----------------------------------------------------------------------------------------
\horrule{0.3pt} \\[0.4cm]

\section{Exercise 3: More sums from number theory}

\subsection{Problem}

\begin{enumerate}

\item[\textbf{(a)}]
Let $n$ be a positive integer.
Prove that
\[
\sum_{j=1}^{n} \gcd \tup{j, n}
= \sum_{d \mid n} d \phi\tup{ \dfrac{n}{d} }.
\]
More generally, if $\tup{a_1, a_2, a_3, \ldots}$ is a sequence
of reals, then prove that
\[
\sum_{j=1}^{n} a_{\gcd \tup{j, n}}
= \sum_{d \mid n} a_d \phi\tup{ \dfrac{n}{d} }.
\]

\item[\textbf{(b)}]
Let $n \in \NN$. Prove that
\begin{align*}
& \tup{ \text{the number of $\tup{x, y} \in \ZZ^2$ satisfying
              $x^2 + y^2 \leq n$} } \\
& = 1 + 4\sum_{k \in \NN} \tup{-1}^k \floor{ \dfrac{n}{2k+1} } \\
& = 1 + 4 \tup{   \floor{\dfrac{n}{1}} - \floor{\dfrac{n}{3}}
                + \floor{\dfrac{n}{5}} - \floor{\dfrac{n}{7}}
                + \floor{\dfrac{n}{9}} - \floor{\dfrac{n}{11}}
                \pm \cdots } .
\end{align*}
(The infinite sums in this equality have only finitely many nonzero addends,
and thus are well-defined.)

\end{enumerate}

[\textbf{Hint:} Parts \textbf{(a)} and \textbf{(b)} have nothing to do with
each other.

This is a good place for a reminder that results proven in the notes, as well
as problems from previous homework sets and midterms, can be freely used. Both
parts have rather short solutions if you remember the right results to use!]

\subsection{Remark}

Part \textbf{(b)} of this exercise is a ``discrete'' version of the
famous Madhava--Gregory--Leibniz series
\[
\dfrac{\pi}{4}
= \dfrac{1}{1} - \dfrac{1}{3} + \dfrac{1}{5} - \dfrac{1}{7}
  + \dfrac{1}{9} - \dfrac{1}{11} \pm \cdots
\]
(where $\pi$, at last, does denote the area of the unit circle).
Indeed, if we divide the number of $\tup{x, y} \in \ZZ^2$ satisfying
$x^2 + y^2 \leq n$ by $n$, then we obtain an approximation to
the area of the unit circle that gets better as $n$
grows\footnote{Just observe that the pairs
$\tup{x, y} \in \ZZ^2$ satisfying $x^2 + y^2 \leq n$, regarded
as points in the Euclidean plane, are precisely the lattice points
inside the circle with center $0$ and radius $\sqrt{n}$.
Thus, by counting these pairs, we are approximating the area of this
circle. See \cite[Theorem 12.1]{Clark18} for a rigorous proof.}.
On the other hand, it appears reasonable that dividing
\[
1 + 4 \tup{   \floor{\dfrac{n}{1}} - \floor{\dfrac{n}{3}}
                + \floor{\dfrac{n}{5}} - \floor{\dfrac{n}{7}}
                + \floor{\dfrac{n}{9}} - \floor{\dfrac{n}{11}}
                \pm \cdots }
\]
by $n$, we obtain an approximation to
$4 \tup{\dfrac{1}{1} - \dfrac{1}{3} + \dfrac{1}{5} - \dfrac{1}{7}
        + \dfrac{1}{9} - \dfrac{1}{11} \pm \cdots}$.
I am not sure whether this can be rigorously proven,
however.\footnote{Of course, for any given $k \in \NN$,
the number
$\dfrac{1}{n}\tup{\floor{\dfrac{n}{2k+1}} - \dfrac{n}{2k+1}}$
does converge to $0$ when $n \to \infty$.
But here we are taking an alternating sum of infinitely many
such numbers; we can ignore all but the first $n$, but even
the first $n$ may no longer converge to $0$ when summed
together.}

\subsection{Solution}

[...]

%----------------------------------------------------------------------------------------
%	EXERCISE 4
%----------------------------------------------------------------------------------------
\horrule{0.3pt} \\[0.4cm]

\section{Exercise 4: Squares in finite fields II}

\subsection{Problem}

Let $\FF$ be a finite field such that
$2 \cdot 1_{\FF} \neq 0_{\FF}$.
In Exercise 5 of
\href{http://www.cip.ifi.lmu.de/~grinberg/t/19s/hw6s.pdf}{homework set \#6},
we have seen that
$\abs{\FF}$ is odd, and that the number of squares in $\FF$ is
$\dfrac{1}{2} \tup{ \abs{\FF} + 1 }$.

In the following, the word ``square'' shall always mean
``square in $\FF$''.

A \textit{nonsquare} shall mean an element of $\FF$ that is not
a square.

Prove the following:

\begin{enumerate}

\item[\textbf{(a)}]
The product of two squares is always a square.

\item[\textbf{(b)}]
The product of a nonzero square with a nonsquare is always
a nonsquare.

\item[\textbf{(c)}]
The product of two nonsquares is always a square.

\end{enumerate}

[\textbf{Hint:} It is easiest to solve the three parts in
this exact order.
For \textbf{(c)}, recall that if a subset
$Y$ of a finite set $X$ satisfies $\abs{Y} \geq \abs{X}$,
then $Y = X$.]

\subsection{Solution}

[...]

%----------------------------------------------------------------------------------------
%	EXERCISE 5
%----------------------------------------------------------------------------------------
\horrule{0.3pt} \\[0.4cm]

\section{Exercise 5: Formal differential calculus}

\subsection{Problem}

Let $\KK$ be a commutative ring.
For each FPS\footnote{Just as in class, the abbreviation ``FPS''
stands for ``formal power series''.
All FPSs and polynomials in this exercise are in $1$ indeterminate
over $\KK$; the indeterminate is called $x$.}
\[
f = \sum_{k \in \NN} a_k x^k = a_0 x^0 + a_1 x^1 + a_2 x^2 + \cdots \in \KK\ivee{x}
\qquad
\text{(where $a_i \in \KK$),}
\]
we define the \textit{derivative} $f'$ of $f$ to be the FPS
\[
\sum_{k > 0} k a_k x^{k-1}
= 1 a_1 x^0 + 2 a_2 x^1 + 3 a_3 x^2 + \cdots \in \KK\ivee{x} .
\]
(This definition imitates the standard procedure for differentiating
power series in analysis, but it does not require any analysis or
topology itself. In particular, $\KK$ may be any commutative ring
-- e.g., a finite field.)

Let $D : \KK\ivee{x} \to \KK\ivee{x}$ be the map sending
each FPS $f$ to its derivative $f'$.
We refer to $D$ as \textit{(formal) differentiation}.
As usual, for any $n \in \NN$, we let $D^n$ denote
$\underbrace{D \circ D \circ \cdots \circ D}_{n \text{ times}}$
(which means $\id$ if $n = 0$).

Prove the following:

\begin{enumerate}

\item[\textbf{(a)}]
If $f \in \KK\ive{x}$, then $f' \in \KK\ive{x}$ and
$\deg \tup{f'} \leq \deg f - 1$.
(In other words, the derivative of a polynomial is again
a polynomial of degree at least $1$ less.)

\item[\textbf{(b)}]
The map $D : \KK\ivee{x} \to \KK\ivee{x}$ is $\KK$-linear
(with respect to the $\KK$-module structure on $\KK\ivee{x}$
defined in class -- i.e., both addition and scaling of FPSs
are defined entrywise).

\item[\textbf{(c)}]
We have $\tup{fg}' = f' g + f g'$ for any two FPSs
$f$ and $g$.
(This is called the \textit{Leibniz rule}.)

\item[\textbf{(d)}]
We have $D^n \tup{x^k} = n! \dbinom{k}{n} x^{k-n}$
for all $n \in \NN$ and $k \in \NN$.
Here, the expression ``$\dbinom{k}{n} x^{k-n}$'' is
to be understood as $0$ when $k < n$.

\item[\textbf{(e)}]
If $\QQ$ is a subring of $\KK$, then
every polynomial $f \in \KK\ive{x}$ satisfies%
\footnote{Just as in class, I am using the notation
``$f \ive{u}$'' for the evaluation of $f$ at $u$.
The more common notation for this is $f \tup{u}$,
but is too easily mistaken for a product. \\
Note also that we need to require $f$ to be a
polynomial here, since $f \ive{x+a}$ would not
be defined if $f$ was merely an FPS.}
\[
f \ive{x+a} = \sum_{n \in \NN} \dfrac{1}{n!} \tup{D^n \tup{f}} \ive{a} \cdot x^n
\qquad \text{for all $a \in \KK$} .
\]
(The infinite sum on the right hand side has only
finitely many nonzero addends.)

\item[\textbf{(f)}]
If $p$ is a prime such that $p \cdot 1_\KK = 0$
(for example, this happens if $\KK = \ZZ / p$),
then $D^p \tup{f} = 0$ for each $f \in \KK\ivee{x}$.

\end{enumerate}

Now, assume that $\QQ$ is a subring of $\KK$.
For each FPS
\[
f = \sum_{k \in \NN} a_k x^k = a_0 x^0 + a_1 x^1 + a_2 x^2 + \cdots \in \KK\ivee{x}
\qquad
\text{(where $a_i \in \KK$),}
\]
we define the \textit{integral} $\int f$ of $f$ to be the FPS
\[
\sum_{k \geq 0} \dfrac{1}{k+1} a_k x^{k+1}
= \dfrac{1}{1} a_0 x^1 + \dfrac{1}{2} a_1 x^2 + \dfrac{1}{3} a_2 x^3 + \cdots \in \KK\ivee{x} .
\]
(This definition imitates the standard procedure for integrating
power series in analysis, but again works for any commutative
ring $\KK$ that contains $\QQ$ as subring.)

Let $J : \KK\ivee{x} \to \KK\ivee{x}$ be the map sending
each FPS $f$ to its integral $\int f$.
Prove the following:

\begin{enumerate}

\item[\textbf{(g)}]
The map $J : \KK\ivee{x} \to \KK\ivee{x}$ is $\KK$-linear.

\item[\textbf{(h)}]
We have $D \circ J = \id$.

\item[\textbf{(i)}]
We have $J \circ D \neq \id$.

\end{enumerate}

[\textbf{Hint:} Don't give too much detail; workable outlines
are sufficient.
Feel free to interchange summation signs without justification.
For part \textbf{(c)}, it is easiest to first prove it
in the particular case when $f = x^a$ and $g = x^b$ for some
$f$ and $g$, and then obtain the general case by interchanging
summations.]

\subsection{Remark}

This exercise is just the beginning of ``algebraic calculus''.
A lot more can be done: Differentiation can be extended to
rational functions; partial derivatives can be defined for
multivariate polynomials and FPSs; differential equations can
be solved formally in FPSs (rather than functions); even a
purely algebraic analogue of the classical
$f'\tup{x} = \lim\limits_{\varepsilon\to 0} \dfrac{f\tup{x+\varepsilon} - f\tup{x}}{\varepsilon}$
definition exists\footnote{See Theorem 5 in
\url{https://math.stackexchange.com/a/2974977/} .}.
These algebraic derivatives play crucial roles in the
study of fields (including finite fields!), in algebraic
geometry (where they help define what a
``singularity'' of an algebraic variety is) and in
enumerative combinatorics (where they aid in computing
generating functions).

Part \textbf{(e)} is perhaps the easiest instance of
the well-known Taylor formula (no error terms, no
smoothness requirements, no convergence issues).

The ``integral'' $\int f$ we defined above is, of course,
only one possible choice of an FPS $g$ satisfying $g' = f$.
Just as in calculus, you can add any constant to it, and
you get another.
Part \textbf{(h)} is an algebraic version of one half of
the Fundamental Theorem of Calculus.
You can easily prove the other half: For each FPS $f$,
the FPS $\tup{J \circ D} \tup{f}$ differs from $f$ only
in its constant term.

If $\KK$ contains $\QQ$ as a subring, then both $J$ and $D$ are
elements of the $\KK$-algebra $\End \tup{\KK\ivee{x}}$
(by parts \textbf{(b)} and \textbf{(g)} of this exercise).
Part \textbf{(h)} of this exercise shows that $J$ is a right
inverse of $D$; but part \textbf{(i)} shows that $J$ is not a
left inverse (and thus not an inverse) of $D$.
This yields an example of a left inverse that is not a right
inverse.

\subsection{Solution}

[...]

%----------------------------------------------------------------------------------------
%	EXERCISE 6
%----------------------------------------------------------------------------------------
\horrule{0.3pt} \\[0.4cm]

\section{Exercise 6: Formal difference calculus and integer-valued polynomials}

\subsection{Problem}

Let $\KK$ be a commutative ring.

For any polynomial $f \in \KK\ive{x}$,
we define the \textit{first finite difference} $f^\Delta$ of $f$
to be the polynomial
\[
f \ive{x+1} - f \ive{x} \in \KK\ive{x} .
\]
(This is a ``discrete analogue'' of the derivative,
in case the analysis-free derivative from Exercise 5
was not discrete enough for you.
It cannot be extended to FPSs, however, since you cannot
substitute $x+1$ for $x$ in an FPS.)

Let $\Delta : \KK\ive{x} \to \KK\ive{x}$ be the map sending
each polynomial $f$ to $f^\Delta$.
As usual, for any $n \in \NN$, we let $\Delta^n$ denote
$\underbrace{\Delta \circ \Delta \circ \cdots \circ \Delta}_{n \text{ times}}$
(which means $\id$ if $n = 0$).

Prove the following:

\begin{enumerate}

\item[\textbf{(a)}]
The map $\Delta : \KK\ive{x} \to \KK\ive{x}$ is $\KK$-linear
(with respect to the $\KK$-module structure on $\KK\ive{x}$
defined in class -- i.e., both addition and scaling of
polynomials are defined entrywise).

\item[\textbf{(b)}]
We have $\tup{fg}^\Delta = f^\Delta g + f\ive{x+1} g^\Delta$
for any two polynomials $f$ and $g$.

\end{enumerate}

Now, assume that $\QQ$ is a subring of $\KK$.

For any $n \in \NN$, we define a polynomial%
\footnote{Note that we are within our rights to divide
by $n!$ here, since $\QQ$ is a subring of $\KK$.}
\[
\dbinom{x}{n} := \dfrac{x\tup{x-1}\tup{x-2}\cdots\tup{x-n+1}}{n!}
\in \KK\ive{x} .
\]
We also set $\dbinom{x}{n} := 0$ for every negative $n$.

Prove the following:

\begin{enumerate}

\item[\textbf{(c)}]
We have $\Delta^n \tup{\dbinom{x}{k}} = \dbinom{x}{k-n}$
for all $n \in \NN$ and $k \in \ZZ$.

\item[\textbf{(d)}]
If $m \in \NN$, and if $f \in \KK\ive{x}$ is a polynomial
of degree $\leq m$,
then there exist elements $a_0, a_1, \ldots, a_m \in \KK$
such that $f = \sum_{i=0}^m a_i \dbinom{x}{i}$.

\item[\textbf{(e)}]
Every polynomial $f \in \KK\ive{x}$ satisfies
\[
f \ive{x+a} = \sum_{n \in \NN} \tup{\Delta^n \tup{f}} \ive{a} \cdot \dbinom{x}{n}
\qquad \text{for all $a \in \KK$} .
\]
(The infinite sum on the right hand side has only
finitely many nonzero addends.)

\item[\textbf{(f)}]
Let $m \in \NN$, and let $f \in \KK\ive{x}$ be a polynomial
of degree $\leq m$.
Assume that $f\ive{k} \in \ZZ$ for each $k \in \set{0, 1, \ldots, m}$.
Then, there exist integers $a_0, a_1, \ldots, a_m$
such that $f = \sum_{i=0}^m a_i \dbinom{x}{i}$.

\end{enumerate}

[\textbf{Hint:} Part \textbf{(d)} is easiest to prove by
induction on $m$.
You can then prove part \textbf{(e)} for $f = \dbinom{x}{i}$
first (where $i \in \NN$), and then extend it to arbitrary $f$
by means of part \textbf{(d)}.
Part \textbf{(f)}, in turn, can be derived from part
\textbf{(e)} through a strategic choice of $a$.]

\subsection{Remark}

Just as $\Delta$ is an analogue of the differentiation
operator $D$ from Exercise 5,
we can define an analogue of the integration operator
$J$ from Exercise 5.
This will be a $\KK$-linear map $\Sigma : \KK\ive{x} \to \KK\ive{x}$
that sends each polynomial
$\sum_{i=0}^m a_i \dbinom{x}{i}$ to
$\sum_{i=0}^m a_i \dbinom{x}{i+1}$
(this definition makes sense, because part \textbf{(d)}
of this exercise
shows that each polynomial can be written in the form
$\sum_{i=0}^m a_i \dbinom{x}{i}$, uniquely except for
``leading zeroes'').
Again, we have $\Delta \circ \Sigma = \id$ but
$\Sigma \circ \Delta \neq \id$.

Moreover, if $f \in \KK\ive{x}$ is a polynomial, then
$\tup{\Sigma\tup{f}} \ive{0} = 0$
and
$\tup{\Sigma\tup{f}} \ive{n}
 = \tup{\Sigma\tup{f}} \ive{n-1} + f \ive{n-1}$
for each $n \in \ZZ$ (indeed, the former equality
follows easily from the definition of $\Sigma$,
while the latter follows from $\Delta \circ \Sigma = \id$).
Hence, by induction, we can see that
\[
\tup{\Sigma\tup{f}} \ive{n}
= f\ive{0} + f\ive{1} + \cdots + f\ive{n-1}
\qquad \text{for each polynomial $f \in \KK\ive{x}$
             and each $n \in \NN$}.
\]
In other words, the value of $\Sigma\tup{f}$ at an
$n \in \NN$ is the sum of the first $n$ values of
$f$ on nonnegative integers! (Whence the notation $\Sigma$.)
For example, if we set $f = x^2$, then it is easy to see
that $\Sigma\tup{f} = 2 \dbinom{x}{3} + \dbinom{x}{2}$
(to see this, just expand $f$ in the form
$\sum_{i=0}^m a_i \dbinom{x}{i}$ -- namely,
$f = x^2 = 2 \dbinom{x}{2} + \dbinom{x}{1}$ --, and
then apply the definition of $\Sigma$); thus we obtain
\[
2 \dbinom{n}{3} + \dbinom{n}{2}
= 0^2 + 1^2 + \cdots + \tup{n-1}^2 .
\]
Similarly you can find a formula for
$0^k + 1^k + \cdots + \tup{n-1}^k$ whenever $k \in \NN$.

Part \textbf{(e)} of this exercise is a result of Newton.

\subsection{Solution}

[...]

\begin{thebibliography}{99999999}                                                                                %

% Feel free to add your sources -- or copy some from the source code
% of the class notes ( http://www.cip.ifi.lmu.de/~grinberg/t/19s/notes.tex ).

% \bibitem[Clark07]{Clark07}
% Pete Clark, \textit{Gauss's circle problem},
% \url{http://math.uga.edu/~pete/4400gausscircle.pdf} .

\bibitem[Clark18]{Clark18}
Pete L. Clark, \textit{Number Theory: A Contemporary Introduction},
8 January 2018. \\
\url{http://math.uga.edu/~pete/4400FULL.pdf}

\end{thebibliography}

\end{document}


\XtoCBlock{Sign}
\label{block:Sign}
\begin{figure}[H]\includegraphics{Sign}\end{figure}

\begin{XtoCtabular}{Inports}
In & Input u\tabularnewline
\hline
\end{XtoCtabular}

\begin{XtoCtabular}{Outports}
Out & Value corresponding to sign of u\tabularnewline
\hline
\end{XtoCtabular}

\subsubsection*{Description:}
Signum function.

% include optional documentation file
\InputIfFileExists{\XcHomePath/Library/Math/Doc/Sign_Info.tex}{\vspace{1ex}}{}

\subsubsection*{Implementations:}
\begin{tabular}{l l}
\textbf{FiP8} & 8 Bit Fixed Point Implementation\tabularnewline
\textbf{FiP16} & 16 Bit Fixed Point Implementation\tabularnewline
\textbf{FiP32} & 32 Bit Fixed Point Implementation\tabularnewline
\end{tabular}

\XtoCImplementation{FiP8}
\index{Block ID!4896}
\nopagebreak[0]
% Implementation details
\begin{tabular}{l l}
\textbf{Name} & FiP8 \tabularnewline
\textbf{ID} & 4896 \tabularnewline
\textbf{Revision} & 0.1 \tabularnewline
\textbf{C filename} & Sign\_FiP8.c \tabularnewline
\textbf{H filename} & Sign\_FiP8.h \tabularnewline
\end{tabular}
\vspace{1ex}

8 Bit Fixed Point Implementation

% Implementation data structure
\XtoCDataStruct{Data Structure:}
\begin{lstlisting}
typedef struct {
     uint16        ID;
     int8          *In;
     int8          Out;
} SIGN_FIP8;
\end{lstlisting}

\ifdefined \AddTestReports
\InputIfFileExists{\XcHomePath/Library/Math/Doc/Test_Sign_FiP8.tex}{}{}
\fi
\XtoCImplementation{FiP16}
\index{Block ID!4897}
\nopagebreak[0]
% Implementation details
\begin{tabular}{l l}
\textbf{Name} & FiP16 \tabularnewline
\textbf{ID} & 4897 \tabularnewline
\textbf{Revision} & 0.1 \tabularnewline
\textbf{C filename} & Sign\_FiP16.c \tabularnewline
\textbf{H filename} & Sign\_FiP16.h \tabularnewline
\end{tabular}
\vspace{1ex}

16 Bit Fixed Point Implementation

% Implementation data structure
\XtoCDataStruct{Data Structure:}
\begin{lstlisting}
typedef struct {
     uint16        ID;
     int16         *In;
     int16         Out;
} SIGN_FIP16;
\end{lstlisting}

\ifdefined \AddTestReports
\InputIfFileExists{\XcHomePath/Library/Math/Doc/Test_Sign_FiP16.tex}{}{}
\fi
\XtoCImplementation{FiP32}
\index{Block ID!4898}
\nopagebreak[0]
% Implementation details
\begin{tabular}{l l}
\textbf{Name} & FiP32 \tabularnewline
\textbf{ID} & 4898 \tabularnewline
\textbf{Revision} & 0.1 \tabularnewline
\textbf{C filename} & Sign\_FiP32.c \tabularnewline
\textbf{H filename} & Sign\_FiP32.h \tabularnewline
\end{tabular}
\vspace{1ex}

32 Bit Fixed Point Implementation

% Implementation data structure
\XtoCDataStruct{Data Structure:}
\begin{lstlisting}
typedef struct {
     uint16        ID;
     int32         *In;
     int32         Out;
} SIGN_FIP32;
\end{lstlisting}

\ifdefined \AddTestReports
\InputIfFileExists{\XcHomePath/Library/Math/Doc/Test_Sign_FiP32.tex}{}{}
\fi


\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{geometry}
\usepackage{enumerate}
\usepackage{natbib}
\usepackage{float}%稳定图片位置
\usepackage{graphicx}%画图
\usepackage[english]{babel}
\usepackage{a4wide}
\usepackage{indentfirst}%缩进
\usepackage{enumerate}%加序号
\usepackage{multirow}%合并行
\title{\large UM-SJTU JOINT INSTITUTE\\DISCRETE MATHEMATICS\\(VE203)\\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\
ASSIGNMENT 8\\\ \\\ \\\ \\\ \\\ \\\ }
\author{Name: Pan Chongdan\\ID: 516370910121}
\date{Date: \today}

\begin{document}
\maketitle
\newpage
\section{Q1}
\begin{enumerate}[(i)]
\item \textbf{Input}: $a_1,\cdots,a_n,n$ unsorted elements
\par \textbf{Output}: All the $a_i,1\leq i\leq n$ in an increasing order.

\par \textbf{for} $p=1$ to $n-1$
\par $x=a_{p+1};$
\par \setlength\parindent{2em}\textbf{If} $a_p>a_{p+1}$ \textbf{then}
\par \setlength\parindent{4em}$i=1;j=p;$
\par \textbf{while} $i<j$ \textbf{do}
\par \setlength\parindent{6em}$m\leftarrow\lceil(i+j/2）\rceil;$
\par \textbf{if} $x>a_m$ \textbf{then} $i\leftarrow(m+1);$
\par \textbf{else} $j\leftarrow m;$
\par \setlength\parindent{4em}\textbf{end while}
\par \textbf{for} $k=p$ to $i$
\par \setlength\parindent{6em}$a_{k+1}=a_k;$
\par \setlength\parindent{4em}\textbf{end for}
\par $a_i=x;$
\par \setlength\parindent{2em}\textbf{end if}
\par \setlength\parindent{0em}\textbf{end for}
\par \textbf{return} $(a_1\cdots a_{n+1});$
\item
For the Insertion Sort Algorithm, $n=\sum_1^7=28$
\par For the Binary Insertion Sort Algorithm, $n=1+1+1+2+2+2+3=12$
\item $f(n)=\sum_1^{n-1}=\frac{n^2-n}{2}$, which is order $n^2$
\item $f(n)$ is $O(\log_2n)$, which is faster than Insertion Sort.
\end{enumerate}
\section{Q2}
\begin{enumerate}[(i)]
\item Assume $n=b^k,k=\log_bn$ then
$$f(n)=b^d\cdot f(b^{k-1})+cb^{kd}$$
$$f(n)=b^d\cdot[b^d\cdot f(b^{k-2})+cb^{kd-d}]+cb^{kd}=b^{2d}f(b^{k-2})+2cb^{kd}$$
$$f(n)=b^{2d}f(b^{k-2})+2cb^{kd}=b^{3d}f(b^{k-3})+3cb^{kd}$$
$$\cdots$$
$$f(n)=b^{kd}f(1)+kcn^d=f(1)n^d+cn^d\log_bn$$
\item Assume $n=b^k,$ where $k=A+B,A\in\mathbb{Z}$ and $0<B<1$, then similarly to (i)
$$f(n)=f(\frac{n}{b^A})b^{Ad}+Acn^d$$
$$\lim_{n\to\infty}|\frac{f(n)}{n^d\log_bn}|=c$$
$$\therefore f\quad\mathrm{is}\quad O(n^d\log_b(n))$$
\item Assume $n=b^k,k=\log_bn$ then
$$f(n)=a\cdot f(b^{k-1})+cb^{kd}$$
$$f(n)=a\cdot[a\cdot f(b^{k-2})+cb^{kd-d}]+cb^{kd}=a^2f(b^{k-2})+(1+\frac{a}{b^d})cb^{kd}$$
$$\cdots$$
$$f(n)=a^kf(1)+[1+\frac{a}{b^d}\cdots(\frac{a}{b^d})^{k-1}]cb^{kd}=a^kf(1)+\frac{a^k-b^{kd}}{ab^{kd-d}-b^{kd}}\cdot cn^d$$
$$f(n)=a^kf(1)+c\cdot\frac{b^d(n^d-a^k)}{b^d-a}=a^k\cdot(f(1)+\frac{cb^d}{a-b^d})+c\cdot\frac{b^dn^d}{b^d-a}$$
$$f(n)=c_1n^d+c_2a^k$$
$$a^k=a^{\log_nb}=n^{\log_ba}$$
$$\therefore f(n)=c_1n^d+c_2n^{\log_ba}$$
\item $$\lim_{n\to\infty}|\frac{f(n)}{n^d}|=|c_1+c_2n^{\log_ba-d}|$$
$$\because a<b^d\Rightarrow\log_ba-d<0\Rightarrow|c_1+c_2n^{\log_ba-d}|<|c_1+c_2|$$
$$\therefore f\quad\mathrm{ is }\quad O(n^d)$$
\item Similarly to last question,
$$\lim_{n\to\infty}|\frac{f(n)}{n^{log_ba}}|=|c_1n^{d-\log_ba}+c_2|$$
$$\because a>b^d\Rightarrow\log_ba-d>0\Rightarrow|c_1n^{d-\log_ba}+c_2|<|c_1+c_2|$$
$$\therefore f\quad\mathrm{ is }\quad O(n^{\log_ba})$$
\end{enumerate}
\section{Q3}
Since there is only on real root then
$$a_n=2\alpha a_{n-1}-\alpha^2a_{n-2}$$
$$2\alpha a_{n-1}-\alpha^2a_{n-2}=2\alpha(q_1\alpha^{n-1}+q_2n\alpha^{n-1})-\alpha^2(q_1\alpha^{n-2}+q_2n\alpha^{n-2})=q_1\alpha^n+q_2n\alpha^n=a_n$$
\section{Q4}
$$\lambda^3-2\lambda^2-\lambda+2=0$$
$$\lambda_1=2,\lambda_2=1,\lambda_1=-1$$
$$\therefore a_n=q_12^n+q_2+q_3(-1)^n$$
$$3=q_1+q_2+q_3$$
$$6=2q_1+q_2-q_3$$
$$0=4q_1+q_2+q_3$$
$$q_1=-1,q_2=6,q_3=-2$$
$$a_n=-2^n+6-2(-1)^n$$
\section{Q5}
$$\lambda^2-5\lambda+6=0$$
$$\lambda_1=2,\lambda_2=3$$
$$p_n=bn2^n+cn^2+dn+e$$
$$p_n=5p_{n-1}-6p_{n-2}$$
$$b=-2,c=1,d=\frac{15}{2},e=\frac{67}{4}$$
$$a_n=q_12^n+q_23^n-2n2^n+n^2+\frac{15}{2}n+\frac{67}{4}$$
$$q_1=-33,q_2=\frac{65}{4}$$
$$a_n=-33\cdot2^n+\frac{65}{4}\cdot3^n-2n2^n+n^2+\frac{15}{2}n+\frac{67}{4}$$
\section{Q6}
$$\lambda^3-7\lambda^2+16\lambda-12=0$$
$$\lambda_1=3,\lambda_2=\lambda_3=2$$
$$p_n=kn4^n+b4^n$$
$$kn4^n+b4^n=7k(n-1)4^{n-1}-16k(n-2)4^{n-2}+12k(n-3)4^{n-3}+n4^n+3b4^n$$
$$k=16,b=-80$$
$$a_n=q_13^n+q_22^n+q_3n2^n+16n4^n-80\cdot4^n$$
$$a_n=49\cdot3^n+28\cdot2^n+27.5n2^n+16n4^n+\frac{5}{2}4^n$$
\section{Q7}
$$a_{n+1}=a_n+(n+1)^4$$
$$a_n=an^5+bn^4+cn^3+dn^2+en+f$$
$$a(n+1)^5+(b-1)(n+1)^4+c(n+1)^3+d(n+1)^2+e(n+1)+f=an^5+bn^4+cn^3+dn^2+en+f$$
$$a=\frac{1}{5},b=\frac{1}{2},c=\frac{1}{3},d=0,e=-\frac{1}{30},f=0$$
$$a_n=\frac{n^5}{5}+\frac{n^4}{2}+\frac{n^3}{3}-\frac{n}{30}$$
\section{Q8}
$$a_n-b_n=2a_{n-1}\Rightarrow b_n=a_n-2a_{n-1}\Rightarrow a_{n}=5a_{n-1}-4a_{n-2}$$
$$\lambda^2-5\lambda+4=0$$
$$\lambda_1=4,\lambda_2=1$$
$$a_n=q_14^n+q_2\Rightarrow a_n=2\cdot4^{n}-1$$
$$\therefore b_n=4^n+1$$
\section{Q9}
$$\lambda^2-2\lambda+2=0$$
$$\lambda_1=1+i,\lambda_2=1-i$$
$$p_n=k3^n\Rightarrow k=\frac{2}{3}k-\frac{2}{9}k+1\Rightarrow k=\frac{9}{5}\Rightarrow p_n=\frac{9}{5}\cdot3^n$$
$$a_n=(\sqrt{2})^n(q_1\cos\frac{n\pi}{4}+q_2\sin\frac{n\pi}{4})+\frac{9}{5}\cdot 3^n\Rightarrow q_1=-\frac{4}{5},q_2=-\frac{13}{5}$$
$$a_n=(\sqrt{2})^n(-\frac{4}{5}\cos\frac{n\pi}{4}-\frac{13}{5}\sin\frac{n\pi}{4})+\frac{9}{5}\cdot 3^n$$
\end{document}


% AUTORIGHTS
% Copyright (C) 2007 Princeton University
%
% This file is part of Ferret Toolkit.
%
% Ferret Toolkit is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2, or (at your option)
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software Foundation,
% Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\section{Distance Functions}
New distance functions can be added by toolkit user. Also the
customized distance function (eg: L2 distance using only certain
dimensions from the cass\_vec) can be generated on the fly to satisfy
customized queries.

\subsection{CASS Distance Functions}
\begin{verbatim}
enum cass_vecset_type_t {any_vecset, single_cass_vec, set_of_cass_vecs,
  ...};
enum cass_cass_vec_type_t {any_cass_vec, float_array, L1_sketch,
  multires_sketch, ...};
enum cass_vecset_dist_measure_t {any_vecset_dist, emd,
  one_to_one_best_match, ...};
enum cass_cass_vec_distance_measure_t {any_cass_vec_dist, L1, L2, ...};

float (*cass_cass_vec_dist_func)(cass_cass_vec_t *f1, cass_cass_vec_t *f2);
float (*cass_vecset_dist_func)(cass_vecset_t *f1, cass_vecset_t *f2);

\end{verbatim}


\documentclass[11pt,a4paper]{article}
\usepackage{jheppub}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{float}
\usepackage{amssymb}
\usepackage{youngtab}

\newcommand{\fund}{$\Yboxdim{6pt}\yng(1)$}
\newcommand{\barfund}{$\bar{\Yboxdim{6pt}\yng(1)}$}

\title{MTC from Argyres-Douglas theory}
\author[a]{Hao-Rong Feng,}
\author[a]{Satoshi Nawata,}
\author[a]{Hao Derrick Zhang}
\author[b]{and Rui-Dong Zhu}
\affiliation[a]{Department of Physics and Center for Field Theory and Particle Physics, Fudan University, 220, Handan Road, 200433 Shanghai, China}
\affiliation[b]{Institute for Advanced Study and School of Physical Science and Technology, Soochow University, 215006 Suzhou, China}
\emailAdd{snawata@gmail.com,haozhangphys@gmail.com}
\abstract{}
\keywords{}

\begin{document}
\maketitle

\section{Argyres-Douglas theory}
For a generalized Argyres-Douglas theory $\mathcal T$, we can construct $3d$ TQFT by choosing the four-dimensional spacetime to be $M_4 = S^1 \times M_3$. $\mathcal T$ possesses a $\mathbb{Z}_F$ global symmetry.
\begin{table}[H]
\centering
\begin{tabular}{c|cccc}
    $\mathcal T$ & $(A_1, A_{2N})$ & $(A_1, A_{2N-1})$ & $(A_1, D_{2N})$ & $(A_1, D_{2N+1})$ \\
    \hline
    $F$ & $2N + 3$ & $N + 1$ & $N$ & $2N + 1$\\
    fixed points of $\mathcal M_{\mathcal T}$ & $N+1$ & $\frac12N(N+1)$ & $N^2$ & $2N+1$
\end{tabular}
\end{table}
We can turn on a non-trivial holonomy $\gamma \in \mathbb Z_F$ along the $S^1$.
Further, the theory is topologically twisted along $M_3$ by identifying the Riemannian holonomy group Spin(3) with $SU(2)_R \subset SU(2)_R \times U(1)_r$ of the R-symmetry of the $4d$ $\mathcal N = 2$ Argyres-Douglas theory.
When the holonomy is co-prime to $F$, $\gamma \in \mathbb Z_F^{\times}$, the TQFT is expected to be semisimple and is associated to a modular tensor category (MTC), $\mathcal C_{\mathcal T}^\gamma$.

While most Argyres-Douglas theories are believed to be non-Lagrangian, one might reach them by RG flows starting from $4d$ $\mathcal N = 1$ Lagrangian theories.

\subsection{$SU(N)$ with $2N$ flavors to $(A_1, A_{2N-1})$ theory}
$\mathcal T$ is $\mathcal N = 2 ~SU(N)$ gauge theory with $2N$ fundamental hypermultiplets. This theory has $SU(2N) \times U(1)$ flavor symmetry. The central charges are
\begin{equation}
    a = \frac{7N^2 - 5}{24}, \qquad c = \frac{2N^2 - 1}{6}, \qquad k_{SU(N)} = 2N.
\end{equation}
Upon coupling the $SU(N)$ adjoint chiral multiplet $M$, and Higgsing via nilpotent vev, the remaining components of $M$ are $M_j$, where $j = 1, \cdots, 2N - 1$ with charge $(J_+, J_-) = (0, 2+2j)$. $J_+$ is just the $R$-charge, $R = J_+$ and the flavor charge is given by $\mathcal F = \frac12 (J_+ - J_-)$.

$\mathrm{Tr}\phi^i$ ($i = 2, 3, \cdots, N$) and the $M_j$ with $j = 1, 2, \cdots, N$ will decouple. We are left with $M_j$ with $j=N+1, \cdots, 2N-1$. The matter content is given by
\begin{table}[H]
\centering
\begin{tabular}{c|cccc}
    ~        & $q$        & $\tilde q$      & $\phi$     & $M_j$ \\
    \hline
    $SU(N)$  & \fund      & \barfund  & adj        & 1   \\
    $U(1)_B$ & 1          & -1        & 0          & 0   \\
    %$(J_+, J_-)$ & $(1, -2N+1)$  & $(1,-2N+1)$ & $(0,2)$ & $(0,2j+2)$\\
    $U(1)_R$ & 1 & 1 & 0 & 0\\
    $U(1)_{\mathcal F}$ & $N$ & $N$ & $-1$ & $-(j+1)$
\end{tabular}
\end{table}
The superpotential is given by
\begin{equation}
    W = \sum_{j = 1}^{2N - 1} M_j(\phi^{2N - 1 - j}q \tilde q).
\end{equation}

\subsection{$Sp(N)$ with $2N+2$ flavors to $(A_1, A_{2N})$ theory}
$\mathcal T$ is $\mathcal N =2~Sp(N)$ gauge theory with $2N+2$ fundamental hypermultiplets. This theory has the $SO(4N+4)$ flavor symmetry. The central charges are
\begin{equation}
    a = \frac{1}{24}N(14 N + 9),\qquad c = \frac{1}{6}N(4 N + 3), \qquad k_{SO(4N+4)} = 4N.
\end{equation}
We now couple a chiral multiplet $M$ transforming in the adjoint representation of $SO(4N+4)$ and give the principal nilpotent vev to $M$. This will break the $SO(4N + 4)$ flavor symmetry completely, and the remaining components of $M$ would be $M_j$ with $j = 1, 3, \cdots, 4 N + 1$; $2 N + 1$ having charges $(J_+, J_-) = (0, 2j + 2)$. Note there are two $M$'s with $j = 2 N + 1$. The decoupled operators are all the Coulomb branch operators $\mathrm{Tr}\phi^{2i}$ with $i = 1, 2, \cdots, N$ and $M_j$ with $j = 1, 3, \cdots, 2 N + 1$ (there are two $M_j$'s with $j = 2 N + 1$) so we are left with $N$ singlet $M_j$ with $j = 2 N + 3, 2 N + 5, \cdots, 4 N + 1$. The matter content is
\begin{table}[H]
\centering
\begin{tabular}{c|ccccc}
    ~        & $q$        & $q'$      & $\phi$     & $M_j$  & $M'_{2N+1}$\\
    \hline
    $Sp(N)$  & \fund      & \fund     & adj        & 1      & 1\\
    %$(J_+, J_-)$ & $(1, 0)$  & $(1,-4 N - 2)$ & $(0,2)$ & $(0,2j+2)$ & $(0, 4 N + 4)$ \\
    $U(1)_R$ & 1 & 1 & 0 & 0 & 0\\
    $U(1)_{\mathcal F}$ & $\frac12$ & $\frac12(4N+3)$ & $-1$ & $-(j+1)$ & $-(2N + 2)$\\
    %$(R_0, \mathcal F)$ & $(\frac12, \frac12)$ & $(\frac12(-4N-1), \frac12(4N + 3))$ & $(1,-1)$ & $(j + 1, - j - 1)$ & $(2 N + 2, - 2 N - 2)$
\end{tabular}
\end{table}
The superpotential is given by
\begin{equation}
    W = \phi q q + \sum_{i=1}^{2N+1}M_{2i-1}(\phi^{4N+3-2i} q' q') + M'_{2N+1}qq'~.
\end{equation}

\subsection{$(A_1,D_{2N})$ theory}
Matter content of $(A_1, D_{2N})$ theory is given by
\begin{table}[H]
\centering
\begin{tabular}{c|cccccc}
    ~ & $q_1$ & $\tilde q_1$ & $q_2$ & $\tilde q_2$ & $\phi$ & $M_j$\\
    \hline
    $SU(N)$ & \fund & \barfund & \fund & \barfund & adj & 1\\
    $U(1)_1$ & 1 & $-1$ & 1 & $-1$ & 0 & 0 \\
    $U(1)_2$ & $2N-1$ & $-(2N-1)$ & $-1$ & 1 & 0 & 0\\
    $U(1)_R$ & $1$ & $1$ & $1$ & $1$ & $0$ & $0$\\
    $U(1)_{\mathcal F}$ & $\frac12$ & $\frac12$ & $\frac{2N-1}{2}$ & $\frac{2N-1}{2}$ & $-1$ & $-(j+1)$
\end{tabular}
\end{table}
where $N \le j \le 2N-2$.

\subsection{$(A_1,D_{2N+1})$ theory}
Matter content of $(A_1, D_{2N+1})$ theory is given by
\begin{table}[H]
\centering
\begin{tabular}{c|cccc}
    ~ & $q_1$ & $q_2$ & $\phi$ & $M_j$\\
    \hline
    $Sp(N)$ & \fund & \fund & adj & 1\\
    $SO(3)$ & 3 & 1 & 1 & 1\\
    $U(1)_R$ & $1$ & $1$ & $0$ & $0$\\
    $U(1)_{\mathcal F}$ & $\frac12$ & $\frac{4N+1}{2}$ & $-1$ & $-(j+1)$
\end{tabular}
\end{table}
where $j = 2k+1$ and $N\le k \le 2N-1$.

\subsection{Examples}
In the following examples, we multiply the previous $U(1)_{\mathcal F}$ charge by a factor $2/F$.
\subsubsection{$(A_1, A_2)$ theory}
Superpotential is given by
\begin{equation}
    W = q \phi q + u q' \phi q'~.
\end{equation}
The matter content is given by
\begin{table}[H]
\centering
\begin{tabular}{c|cccc}
    ~        & $q$        & $q'$      & $\phi$     & $M_5$ \\
    \hline
    $SU(2)$  & \fund      & \fund     & adj        & 1   \\
    $U(1)_R$ & 1          & 1         & 0          & 0   \\
    $U(1)_\mathcal F$     & $\frac15$ & $\frac75$  & $-\frac25$ & $-\frac{12}{5}$
\end{tabular}
\end{table}
\noindent Number of fixed points is $2$. Decoupled operator: $\mathrm{Tr}\phi^2$.

\subsubsection{$(A_1, A_3)$ theory}
Superpotential is given by
\begin{equation}
    W = u q \tilde q~.
\end{equation}
The matter content is given by
\begin{table}[H]
\centering
\begin{tabular}{c|cccc}
    ~        & $q$        & $\tilde q$& $\phi$   & $M_3$ \\
    \hline
    $SU(2)$  & \fund      & \fund     & adj      & 1   \\
    $U(1)_B$ & 1          & -1        & 0        & 0   \\
    $U(1)_R$ & 1          & 1         & 0        & 0   \\
    $U(1)_\mathcal F$     & $\frac43$ & $\frac43$  & $-\frac23$ & $-\frac{8}{3}$
\end{tabular}
\end{table}
\noindent Number of fixed points is $3$. Decoupled operator: $\mathrm{Tr}\phi^2$.

\subsubsection{$(A_1, A_4)$ theory}
The matter content is given by
\begin{table}[H]
\centering
\begin{tabular}{c|ccccc}
    ~        & $q$        & $\tilde q$& $\phi$     & $M_7$ & $M_9$ \\
    \hline
    $Sp(2)$  & \fund      & \fund     & adj        & 1     & 1     \\
    $U(1)_R$ & 1          & 1         & 0          & 0     & 0     \\
    $U(1)_\mathcal F$     & $\frac17$ & $\frac{11}{7}$  & $-\frac27$ & $-\frac{16}{7}$ & $-\frac{20}{7}$
\end{tabular}
\end{table}
\noindent Number of fixed points is $3$. Decoupled operator: $\mathrm{Tr}\phi^2, \mathrm{Tr}\phi^4$.

\subsubsection{$(A_1, A_5)$ theory}
The matter content is given by
\begin{table}[H]
\centering
\begin{tabular}{c|ccccc}
    ~ & $q$ & $\tilde q$ & $\phi$ & $M_4$ & $M_5$\\
    \hline
    $SU(3)$ & \fund & \barfund & adj & 1 & 1\\
    $U(1)_B$ & 1 & $-1$ & 0 & 0 & 0\\
    $U(1)_R$ & 1 & 1 & 0 & 0 & 0\\
    $U(1)_{\mathcal F}$ & $\frac32$ & $\frac32$ & $-\frac12$ & $-\frac52$ & $-3$
\end{tabular}
\end{table}
\noindent Number of fixed points is 6. Decoupled operator: $\mathrm{Tr}\phi^2, \mathrm{Tr}\phi^3$.

\subsubsection{$(A_1, D_3)$ theory}
The matter content is given by
\begin{table}[H]
\centering
\begin{tabular}{c|cccc}
    ~        & $q_1$      & $q_2$     & $\phi$     & $M_3$ \\
    \hline
    $SU(2)$  & \fund      & \fund     & adj        & 1     \\
    $SO(3)$  & 3          & 1         & 1          & 1     \\
    $U(1)_R$ & 1          & 1         & 0          & 0     \\
    $U(1)_\mathcal F$     & $\frac13$ & $\frac{5}{3}$  & $-\frac23$ & $-\frac83$
\end{tabular}
\end{table}
\noindent Number of fixed points is $3$. Decoupled operator:

\subsubsection{$(A_1, D_4)$ theory}
The matter content is given by
\begin{table}[H]
\centering
\begin{tabular}{c|cccccc}
    ~ & $q_1$ & $\tilde q_1$ & $q_2$ & $\tilde q_2$ & $\phi$ & $M_2$ \\
    \hline
    $SU(2)$ & \fund & \fund & \fund & \fund & adj & 1\\
    $U(1)_1$ & 1 & $-1$ & 1 & $-1$ & 0 & 0\\
    $U(1)_2$ & 3 & $-3$ & $-1$ & 1 & 0 & 0\\
    $U(1)_R$ & 1 & 1 & 1 & 1 & 0 & 0\\
    $U(1)_{\mathcal F}$ & $\frac12$ & $\frac12$ & $\frac32$ & $\frac32$ & $-1$ & $-3$
\end{tabular}
\end{table}
\noindent Number of fixed points is 4. Decoupled operator: $\mathrm{Tr} \phi^2$.

\section{$\mathcal{N} = 1$ gauge theories on $\mathbb{R}^2 \times T^2$}
The effective twisted superpotential, $\mathcal{W}(u,\nu;\tau)$ and the effective dilaton $\Omega(u,\nu;\tau)$ are locally holomorphic in all variables.
The Bethe equations are
\begin{equation}
    \exp\left(2\pi i \partial_{u_a} \mathcal{W}(u,\nu;\tau)\right) = 1, \quad a = 1, \cdots, \mathrm{rk}(\mathfrak{g})
\end{equation}
We can build some operators as
\begin{itemize}
    \item $\Pi_a = \exp(2\pi i \partial_{u_a} \mathcal W)$, the \emph{gauge flux operator};
    \item $\Pi_\alpha = \exp(2\pi i \partial_{\nu_\alpha} \mathcal W)$, the \emph{flavor flux operator};
    \item $\mathcal{H}~ = \exp(2\pi i \Omega)\det(\partial_{u_a}\partial_{u_b}\mathcal W)$, the
    \emph{handle-gluing operator};
    \item $\mathcal{F}~ = \exp(2\pi i \partial_\tau \mathcal W)$, the \emph{fibering operator}.
\end{itemize}
The parameter $\nu$ and $\tau$ are related to the fugacities $y$ and $q$ by
\begin{equation}
    y = e^{2\pi i \nu}, \qquad q = e^{2\pi i \tau}.
\end{equation}

%-------------------- commented --------------------%
\iffalse
\subsection{The twisted superpotential}
The twisted superpotential only receives contributions from charged
chiral multiplets. For semisimple Lie algebras, the W-bosons and their superpartners do not contribute.

\subsubsection{Chiral multiplet contribution}
Consider chiral multiplet of charge 1 under some $U(1)$ in the Cartan of the gauge group, with $u$ the $U(1)$ complexified flat connection.
Define the \emph{elliptic dilogarithm},
\begin{equation}
    \psi(u;\tau) \equiv -\frac{1}{2\pi i}\int_0^u du' \log\theta(u';\tau),
\end{equation}
where the theta-function is defined as
\begin{equation}
    \theta(u;\tau) = e^{-\pi i u} q^{\frac{1} {12}}\prod_{k=0}^\infty (1 - x q^k) (1 - x^{-1} q^{k+1})
\end{equation}
Then the contribution to twisted superpotential is
\begin{equation}
    \mathcal W_\Phi(u; \tau) = -\frac{u^3}{6 \tau} + \psi(u; \tau).
\end{equation}

\subsubsection{W-boson contribution}
\begin{equation}
    \mathcal{W}_{\mathrm{vec}} = -\rho_W(u), \qquad \rho_W \equiv \frac12 \sum_{\alpha>0}\alpha.
\end{equation}

\subsubsection{General gauge theory}
Consider chiral multiplets $\Phi_i$ in representations $R_i$ of semisimple Lie algebra $\mathfrak{g}$. We also turn on generic background parameters $\nu_\alpha$ for any flavor symmetry, then
\begin{equation}
    \mathcal{W}(u,\nu;\tau) = \sum_i \sum_{\rho \in R_i} \mathcal{W}_\Phi (\rho_i(u) + \nu_i; \tau)
\end{equation}
\fi
%----------------------------------------
\subsection{Flux operators}
For a single chiral multiplet, we have the contribution
\begin{equation}
    \Pi^\Phi(u; \tau) \equiv e^{2\pi i(-\frac{u^2}{2\tau}+\frac u 2 - \frac{\tau}{12})} \frac{1}{\theta_0(u; \tau)},
\end{equation}
with $\theta_0$ the reduced theta function
\begin{equation}
    \theta_0(u;\tau) = \prod_{k=0}^\infty(1-x q^k)(1-x^{-1}q^{k+1})
\end{equation}
Then we obtain
\begin{align}
    \Pi_a(u,\nu; \tau) &= e^{2\pi i \partial_{u_a}\mathcal W}
    = \prod_i\prod_{\rho_i \in R_i} \Pi^\Phi(\rho_i(u)+\nu_i)^{\rho_i^a}, \\
    \Pi_\alpha(u,\nu; \tau) &= e^{2\pi i \partial_{\nu_\alpha}\mathcal W}
    = \prod_i\prod_{\rho_i \in R_i} \Pi^\Phi(\rho_i(u)+\nu_i)^{\omega_i^\alpha}
\end{align}
for the gauge and flavor flux operators, respectively.

\subsection{Fibering operators}
\subsubsection{Chiral multiplet contribution to $\mathcal{F}$}
Define
\begin{equation}
    \Gamma_0(u;\tau) \equiv \prod_{n=0}^\infty
    \left(\frac{1-x^{-1}q^{n+1}}{1-xq^{n+1}}\right)^{n+1}
\end{equation}
Then
\begin{equation}
    \mathcal F^\Phi(u;\tau) = \exp\left(2\pi i \left(\frac{u^3}{6 \tau^2} - \frac{u}{12}\right)\right) \Gamma_0(u; \tau).
\end{equation}

\subsubsection{General gauge theory}
The fibering operators are given by
\begin{equation}
    \mathcal F({\bf u};\tau) = \prod_I \mathcal{F}_I^\Phi(Q_I({\bf u}); \tau),
\end{equation}
where $I = (\rho_i)$ run over all the chiral multiplets (that is, over all weights $\rho_i$ for each $i$) and $Q_I$ is the $U(1)$ charge of $\Phi_I$, that is $Q_{\rho_i}^a = \rho_i^a$ and $Q^\alpha_{\rho_i} = \omega_i^\alpha$ in terms of the weights of the gauge and flavor representations.

\subsection{Effective dilaton and handle-gluing operator}
Consider matter fields in chiral multiplets $\Phi_i$ of $R$-charges $r_i \in \mathbb{Z}$, we have
\begin{equation}
    \Omega = \Omega_{\mathrm{mat}} + \Omega_{\mathrm{vec}},
\end{equation}
such that
\begin{equation}
\begin{aligned}
    \exp\left(2\pi i \Omega_{\mathrm{mat}}(u,\nu; \tau)\right) &= \prod_i \prod_{\rho_i \in R_i} \Pi^\Phi(\rho_i(u)+\nu_i;\tau)^{r_i - 1}\\
    \exp\left(2\pi i \Omega_{\mathrm{vec}}(u,\nu; \tau)\right) &= \eta(\tau)^{-2 \mathrm{rk}(\mathfrak{g})}\prod_{\alpha \in \mathfrak{g}} \Pi^\Phi(\alpha(u); \tau),
\end{aligned}
\end{equation}
where the Dedekind eta function is defined as
\begin{equation}
    \eta(\tau) \equiv q^{\frac{1}{24}} \prod_{k=1}^\infty(1 - q^k), \qquad q = e^{2\pi i \tau}.
\end{equation}
Then the Hessian determinant of the twisted superpotential,
\begin{equation}
    H(u, \nu; \tau) \equiv \det \frac{\partial^2 \mathcal{W}(u, \nu; \tau)}{\partial u_a \partial u_b} = \det \left(\frac{1}{2\pi i} \frac{\partial \log \Pi_a}{\partial u_b}\right).
\end{equation}
And the handle-gluing operator is given by
\begin{equation}
    \mathcal{H}(u,\nu; \tau) = e^{2 \pi i \Omega(u,\nu; \tau)} H(u, \nu; \tau).
\end{equation}

\section{Holonomy saddles}

\section{$\mathcal B_{n+1}$ algebra}

\section{$\mathcal W_n$ algebra}
This algebra can be obtained by a nonregular quantum Hamiltonian reduction of \\$\widehat{\mathfrak{sl}}(n+1)_{-\frac{(n-1)^2}{n}}$

\nocite{Dedushenko:2018bpp}
\nocite{Closset:2017bse}
\nocite{Maruyoshi:2016aim}
\nocite{Agarwal:2016pjo}
\nocite{Hwang:2018riu}
\nocite{Nekrasov:2014xaa}
\nocite{Fredrickson:2017yka}
\nocite{Auger:2019gts}
\nocite{Cho:2020ljj}
\bibliography{MTC.bib}
\bibliographystyle{JHEP}
\end{document}


\documentclass{article}

\usepackage[left=1.25in,top=1.25in,right=1.25in,bottom=1.25in,head=1.25in]{geometry}
\usepackage{amsfonts,amsmath,amssymb,amsthm}
\usepackage{verbatim,float,url,enumerate}
\usepackage{graphicx,subfigure,psfrag}
\usepackage{natbib}
\usepackage{environ}
\usepackage{hyperref}
\usepackage{pifont}
\usepackage{xcolor}

\newtheorem{algorithm}{Algorithm}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{corollary}{Corollary}

\theoremstyle{remark}
\newtheorem{remark}{Remark}
\theoremstyle{definition}
\newtheorem{definition}{Definition}

\newcommand{\argmin}{\mathop{\mathrm{argmin}}}
\newcommand{\argmax}{\mathop{\mathrm{argmax}}}
\newcommand{\minimize}{\mathop{\mathrm{minimize}}}
\newcommand{\maximize}{\mathop{\mathrm{maximize}}}
\newcommand{\st}{\mathop{\mathrm{subject\,\,to}}}
\newcommand{\dist}{\mathop{\mathrm{dist}}}

\newcommand{\reals}{\mathbb R}
\newcommand{\prox}{\operatorname{prox}}
\newcommand{\dom}{\operatorname{dom}}
\def\R{\mathbb{R}}
\def\E{\mathbb{E}}
\def\P{\mathbb{P}}
\def\Cov{\mathrm{Cov}}
\def\Var{\mathrm{Var}}
\def\half{\frac{1}{2}}
\def\sign{\mathrm{sign}}
\def\supp{\mathrm{supp}}
\def\th{\mathrm{th}}
\def\tr{\mathrm{tr}}
\def\dim{\mathrm{dim}}
\def\hbeta{\hat{\beta}}

\begin{document}

\title{Underactuated Robotics 16-748: Project Proposal \\ iLQR for Probabalistic Vehicle Control and Maneuvering}
\author{
  Josh Bennett\\
  \texttt{jjbennet@andrew.cmu.edu}
  \and
  Ting Che Lin\\
  \texttt{tingchel@andrew.cmu.edu}
}
\maketitle

\section{Motivation}

Autonomous vehicles need to respond to detected obstacles quickly and handle sensor uncertainty in a safe, reliable way. Planning a path around obstacles is best accomplished by considering both a) the vehicle dynamics, and b) the probability of collision within a close-range window of time. Trajectory optimization effectively incorporates the dynamics model to constrain the set of potential control strategies, but must be augmented with additional constraints to incorporate collision information. The Iterative Linear Quadratic Regulator (ILQR) provides a way to optimize over the set of feasible trajectories due to vehicle dynamics.

\section{Proposal}

Chen et al. \cite{chen_zhan_tomizuka_2017} discuss the use of Constrained iLQR (CILQR) for motion planning in autonomous vehicles. We propose an extension of their work, where uncertainty in collision information is incorporated. Uncertainty in both current position and future trajectory of surrounding obstacles will enable the CILQR algorithm to generate trajectories that are robustified to poor sensor measurements, while enabling lower safety trajectories to stil be executed in the absence of safer paths. The resulting vehicular control system will be 1) robust to sensor noise and error, and 2) fast at finding feasible trajectories.

\section{Research Plan}

We will implement the CILQR algorithm with probabilistic collision constraints as a C++ library. Linking to this library using Python bindings, we will show effective trajectory planning in a set of simulated vehicle scenarios. The project will be considered a success if a) feasible trajectories are consistently generated, b) unavoidable collisions are handled without erratic behaviour, and c) the planner is able to operate at a cycle rate of 20 Hz on modern multi-core processor.

We will first establish a set of baseline navigation scenarios which will act as a gating set of tests for the planner. After establishing this baseline standard, we will implement CILQR and evaluate tests which cause a failure.

\bibliographystyle{plain}
\bibliography{bibliography.bib}
\small

\end{document}


%
%

\section*{{\smart} overview and organization of this User Manual}

The {\smart} ({\smartmeaning}) tool is a software package to study complex
discrete-state systems. With {\smart}, it is possible to study the
logical behavior of the system, by generating the state space
underlying a complex model and asking temporal logic queries about
its dynamic behavior, as done in traditional model-checking.
Once one is satisfied that the logical behavior of the
system is both correct and correctly captured by the model,
performance, reliability, availability, and performability
measures about the system can be computed with a large variety of
state-of-the-art techniques.
{\smart} implements exact numerical solution algorithms,
approximate numerical solution algorithms,
and discrete-event simulation techniques.
These can be used in cooperation for the study of a complex
system, since multiple interacting models are supported in a
variety of ways, from a simple hierarchical solution of submodels
to a built-in fixpoint iteration mechanism which may be used to
perform sophisticated studies.
Numerical solution
algorithms are provided not only for the widely-used class of
models having an underlying continuous-time \index{Markov chain}Markov chain,
but also for the case where the underlying
process is a discrete-time Markov chain, or, under certain
conditions, even a Markov regenerative process arising from the
use of both discrete and continuous
\index{phase-type distribution}phase-type distributions in the same model.

\IGNORE{
A unifying language used to define the structure and the measures of models,
regardless of the formalism used to express them (queueing
networks, Markov chains, etc.) and of the type of study required
(performance, reliability, etc.);

Another way to deal with large and complex problems is the
use multiple processors.
This can be done in two ways
If several independent model solutions are needed, for example
to study a system under a range of different parameters,
they can be assigned to the available processors and run in parallel.
If, however, a single model is too large to be analyzed on a single processor
due to time or memory constraints, a more complex approach, using
a distributed algorithm, can be employed.
Both types of parallelism are available in {\smart}.
}

\begin{description}

\item{\bf Chapter \ref{SEC:Language}}
introduces the {\smart} input language used to define models and their
interactions.
Two types of low-level stochastic process formalisms
are presented, discrete-time and continuous-time
\index{Markov chain}Markov chains. High-level models expressed in
a formalism-specific way are instead presented in the following
individual chapters.

\begin{release}
Currently, the only high-level formalism supported by {\smart}
is an extended class of stochastic Petri nets.
More formalisms are planned for future versions.
\end{release}

\item{\bf Chapter \ref{SEC:SPN}}
describes how to define stochastic Petri nets models.
This is a very powerful and general formalism that can be used to model
discrete-state systems in virtually any domain.

\item{\bf Chapter \ref{SEC:SSGen}}
describes algorithms and options available to generate the state space
of a discrete-state model, regardless of the high-level formalism in which
it is expressed.
This fundamental step must occur before any model checking or
numerical solution activity.

\item{\bf Chapter \ref{SEC:ModelChecking}}
describes algorithms and options available to perform symbolic
model checking on a high-level model.

\item{\bf Chapter \ref{SEC:Numerical}}
describes algorithms and options available to solve the underlying
stochastic model numerically, using either traditional (explicit) or
symbolic (implicit) representations.

\begin{developer}
\item{\bf Chapter \ref{SEC:Approximations}}
describes algorithms and options available to compute approximate
numerical solutions.
\end{developer}

\begin{developer}
\item{\bf Chapter \ref{SEC:Simulation}}
describes algorithms and options available to study models
using discrete-event simulation.
\end{developer}

\item{\bf Chapter \ref{SEC:Examples}}
gives examples of {\smart} usage and reports runtimes and memory requirements
on them.

\item{\bf Appendix \ref{SEC:LanguageReference}}
lists the predefined types, functions, and options available in \smart.

\item{\bf Appendix \ref{SEC:BNF}}
formally defines the syntax of the {\smart} language using BNF notation.

\item{\bf Appendix \ref{SEC:PhaseType}}
gives key definitions and properties of
discrete and continuous phase-type distributions.

\item{\bf Release Notes}
at the end of this manual list information that a user of the current
release should know.
Other release-dependent information appears throughout this manual
\RELEASE{in blue text}.

\begin{developer}
\item{\bf Internal Notes}
are designated throughout the manual for \smart{} developers or for
work in progress.
This material is in red text and is omitted from the ``public'' user manual.
\end{developer}

\end{description}

\vfill

\section*{\centering Acknowledgments}

The development of the techniques implemented in {\smart} has been partially
supported by the
National Aeronautics and Space Administration under grants
NAG-1-2168 and NAG-1-02095;
by the National Science Foundation under grants
CSR-0546041, % Andy's CAREER
CCR-0219745,
and
ACI-0203971;
by a joint STTR project with Genoa Software Systems,
Inc., for the Army Research Office;
and by the matching grant FED-95-011 from the Virginia Center for
Innovative Technology.
We are grateful to these organizations for making our research possible.

Any opinions, findings, and conclusions or recommendations expressed in this
material are those of the author(s) and do not necessarily reflect the views
of the National Science Foundation.


\documentclass[a4paper,twoside, 10pt]{article}
\usepackage[%CJKbookmarks=true,
	unicode=true,
	hyperindex=true,
	pdfstartview=FitH,
	bookmarksnumbered=true,	%注释掉此行则书签前没有数字编号
	bookmarksopen=true,  	%注释掉此行则默认不展开书签
	colorlinks=true, 	%注释掉此项则交叉引用为彩色边框(将colorlinks和pdfborder同时注释掉)
	pdfborder=001,   	%注释掉此项则交叉引用为彩色边框
	citecolor=red
]{hyperref}

\usepackage{graphicx}		%图像宏包
\usepackage{amsmath}		%ams数学宏包
\usepackage{algorithm}		% algorithm package
\usepackage{algpseudocode}	% algorithmicx package is included therein
\usepackage{simplewick}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsthm}
\DeclareMathOperator{\Tr}{Tr}

\newtheorem{theorem}{Theorem}
\theoremstyle{wick}
\newtheorem*{wick}{Wick's Theorem}

\newtheorem{lemma}[theorem]{Lemma}

\usepackage{extarrows}		%长等号、等号上下
\usepackage{textcomp}		%摄氏度
\usepackage{multirow,makecell}
\usepackage{mhchem}
\usepackage{pifont}
\usepackage{subfig}		%subfloat

\newcommand{\mr}{\mathrm}
\newcommand{\tr}{\textrm}
\newcommand{\tN}{\tr{N}}
\newcommand{\md}{\mathrm{d}}
\newcommand{\mi}{\mathrm{i}}
\newcommand{\me}{\mathrm{e}}
\newcommand{\mg}{\mathrm{g}}
\newcommand{\br}{\bm{r}}
\newcommand{\bR}{\bm{R}}
\newcommand{\bt}{\bm{\tau}}
\newcommand{\bk}{\bm{k}}
\newcommand{\bK}{\bm{K}}
\newcommand{\ba}{\bm{a}}
\newcommand{\bb}{\bm{b}}
\newcommand{\bG}{\bm{G}}
\newcommand{\bq}{\bm{q}}
\newcommand{\bB}{\bm{B}}
\newcommand{\bx}{\bm{x}}
\newcommand{\vD}{\varDelta}
\newcommand{\Ao}{\mathring{\mr{A}}}
\newcommand{\tc}{\textcelsius}
\newcommand{\oo}{$\ddot{\mathrm{o}}$}
\newcommand{\hh}{\hat{E}}
\newcommand{\mcH}{\mathcal{H}}
\newcommand{\mcS}{\mathcal{S}}
\newcommand{\mcM}{\mathcal{M}}
\newcommand{\psik}{\psi_{\bm{k}}(\bm{r})}
\newcommand{\vpr}{V^{\mr{psd}}(\bm{r})}
\newcommand{\vpq}{V^{\mr{psd}}(q)}
\newcommand{\rlh}{\rightleftharpoons}
\newcommand{\II}{\tr{\textit{II}}}
\newcommand{\IV}{\tr{\textit{IV}}}
\newcommand{\oscf}{$\varOmega$-SCF}
\newcommand{\sscf}{$\sigma$-SCF}
\newcommand{\Oo}{\varOmega(\omega)}
\newcommand{\mcF}{\mathcal{F}}

\newcommand{\sff}{\sffamily}

\newcommand{\cd}{c^{\dagger}}
\newcommand{\ad}{a^{\dagger}}
\newcommand{\exphf}[1]{\langle{}#1\rangle_0}
\newcommand{\mn}{ij\lambda\sigma}
\newcommand{\mnp}{i'j'\lambda'\sigma'}
\newcommand{\ti}{\langleij|\lambda\sigma\rangle}
\newcommand{\tiv}{\langleij|\sigma\lambda\rangle}
\newcommand{\tip}{\langlei'j'|\lambda'\sigma'\rangle}
\newcommand{\tipv}{\langlei'j'|\sigma'\lambda'\rangle}
\newcommand{\ex}[1]{\langle{}#1\rangle}
\newcommand{\ket}[1]{|#1\rangle}
\newcommand{\bra}[1]{\langle{}#1|}
\newcommand{\var}{\sigma_H^2}
\newcommand{\Ns}{N_{s}}
\newcommand{\Nt}{N_{t}}
\newcommand{\sums}[1]{\sum_{#1}^{s}}
\newcommand{\sumt}[1]{\sum_{#1}^{t}}
\newcommand{\mat}[1]{\mathbf{#1}}
\newcommand{\mmp}{ii'}
\newcommand{\nnp}{jj'}
\newcommand{\llp}{\lambda\lambda'}
\newcommand{\ssp}{\sigma\sigma'}
\newcommand{\pfrac}[2]{\frac{\partial{}#1}{\partial{}#2}}

\usepackage{amssymb}
\usepackage{color}
\usepackage{xcolor}		%颜色
\usepackage{bm}			%数学矢量宏包
\usepackage{mathrsfs}
\pagestyle{plain}
\usepackage[raggedright]{titlesec}
\usepackage[procnames]{listings}

\usepackage{pict2e}
\usepackage{keyval}
%\usepackage{fp}
\usepackage{diagbox}		%这几个宏包用于画表头的斜线
\usepackage{booktabs}		%三种粗细不同的线：\toprule、\midrule 和 \bottomrule 对应顶部、中部、底部
\usepackage[font=small,labelfont=bf,width=1.0\textwidth]{caption}
\captionsetup{tablename=Tab. }
\captionsetup{figurename=Fig.}

\usepackage[font=small,labelfont=bf,width=1.0\textwidth]{caption}
\usepackage{multirow}
\usepackage{cases}

\usepackage{appendix}		%附录

\bibliographystyle{unsrt}
\newcommand{\upcite}[1]{\textsuperscript{\cite{#1}}}	%upcite命令

\usepackage{geometry}
\geometry{left=2.7cm,right=2.6cm,top=2.5cm,bottom=2.5cm}	%页边距

%%\linespread{1.2}				%行距

\title{Basic Exercises for Scientific Programming}
\author{Hongzhou Ye}
\date{January 1, 2018}							%开启我则不显示日期

\newcommand{\ttf}{\ttfamily}
\newcommand{\ttt}{\texttt}

\begin{document}
	\maketitle{}

	\begin{abstract}
		Scientific programming involves many topics of applied math, varying from basic linear algebra to optimization algorithms. This file is a collection of several basic exercises that help you practice some of the essential skills.
	\end{abstract}

	\section{Linear least square fitting}

	In the most general sense, the task of least square fitting is to find an approximate mapping $\tilde{f}$ to a given mapping
	\begin{equation}
	\begin{split}
		f:&\, \mathbb{X} \rightarrow \mathbb{Y}	\\
		  &\, \bm{x} \rightarrow \bm{y} = f(\bm{x})
	\end{split}
	\end{equation}
	by minimizing the least square loss
	\begin{equation}
		\mathcal{L}
			= \sum_{i} \big\|\tilde{f}(\bm{x}^{(i)}) - \bm{y}^{(i)}\big\|_2^2
	\end{equation}
	based on a set of known data $\{(\bm{x}^{(i)}, \bm{y}^{(i)})\}$, where
	\begin{equation}
		\|\bm{a}\|_2
			= \sqrt{\bm{a} \cdot \bm{a}}
			= \bigg(\sum_{\mu} a_{\mu}^2\bigg)^{1/2}
	\end{equation}
	is the $2$-norm of vector $\bm{a}$.

	As a special case, linear least square fitting assumes a linear functional form for the approximate mapping $\tilde{f}$, i.e.
	\begin{equation}	\label{eq:lls_ansatz}
		\tilde{f}(\bm{x})
			= \mat{A}^{\tr{T}}\bm{x} + \bm{b},
	\end{equation}
	where $\mat{A}$ and $\bm{b}$ are determined from experimental data. In this exercise, we are going to explore the properties of linear least square fitting.

	\begin{enumerate}
		\item First let us consider an even simpler case, $\bm{b} = \bm{0}$. Show that $\mat{A}$ is determined by the following equation
		\begin{equation}	\label{eq:lls_equation}
			\mat{X} \mat{X}^{\tr{T}} \mat{A}
				= \mat{X} \mat{Y}^{\tr{T}}
		\end{equation}
		where
		\begin{equation}	\label{eq:data_set_def}
			\mat{X}
				= [\bm{x}^{(1)}, \bm{x}^{(2)}, \cdots{}, \bm{x}^{(N)}],\quad{}
			\mat{Y}
				= [\bm{y}^{(1)}, \bm{y}^{(2)}, \cdots{}, \bm{y}^{(N)}].
		\end{equation}

		\textit{Hint}: $\mathcal{L}$ is a function of $\mat{A}$
		\begin{equation}	\label{eq:lsloss}
		\begin{split}
			\mathcal{L}
				&= \sum_i \| \mat{A}^{\tr{T}} \bm{x}^{(i)} - \bm{y}^{(i)} \|^2_2
				= \sum_i (\mat{A}^{\tr{T}} \bm{x}^{(i)} - \bm{y}^{(i)})^{\tr{T}}
				(\mat{A}^{\tr{T}} \bm{x}^{(i)} - \bm{y}^{(i)})	\\
				\iffalse
				&= \mat{A}^{\tr{T}} \bigg[\sum_{i} \bm{x}^{(i)} \bm{x}^{(i)\tr{T}}\bigg] \mat{A}
				- \mat{A}^{\tr{T}} \bigg[\sum_{i} \bm{x}^{(i)} \bm{y}^{(i)\tr{T}}\bigg]
				- \bigg[\sum_{i} \bm{y}^{(i)} \bm{x}^{(i)\tr{T}} \bigg] \mat{A}
				+ \sum_i \bm{y}^{(i)\tr{T}} \bm{y}^{(i)}
				\fi
		\end{split}
		\end{equation}
		You might need the following trick
		\begin{equation}
		\begin{split}
			\sum_i \bm{x}^{(i)\tr{T}} \mat{A} \mat{A}^{\tr{T}} \bm{x}^{(i)}
				&= \sum_i \sum_{\mu\nu\lambda} x^{(i)}_{\mu} A_{\mu\nu}
				A^{\tr{T}}_{\nu\lambda} x^{(i)}_{\lambda}
				= \sum_{\mu\nu\lambda} A^{\tr{T}}_{\nu\lambda} \bigg[\sum_i x^{(i)}_{\lambda}
				x^{(i)}_{\mu}\bigg] A_{\mu\nu}	\\
				&= \sum_{\mu\nu\lambda} A^{\tr{T}}_{\nu\lambda} (XX^{\tr{T}})_{\lambda \mu} A_{\mu\nu}
				= \mat{A}^{\tr{T}} \mat{X} \mat{X}^{\tr{T}} \mat{A}
		\end{split}
		\end{equation}
		Same trick can be played to all other terms in the expansion. Then you can take derivative with $\mat{A}^{\tr{T}}$ and obtain the desired equation (you can treat $\mat{A}$ and $\mat{A}^{\tr{T}}$ two independent variables).

		\item We now have the equation and let us see how it works! In \ttt{data/least\_square} you can find the data file \ttt{X1.txt} and \ttt{Y1.txt}, which contains $20$ data points. Fit a linear equation with zero $\bm{b}$ and plot the fitted curve along with the original data. Your result should be something like the following
		\begin{figure}[H]
			\centering
			\includegraphics[width=0.6\linewidth]{plot/least_square/XY1.png}
		\end{figure}

		\item The example above is one-dimensional and trivial. A non-trivial multi-dimensional data set can be found in \ttt{X2.txt} and \ttt{Y2.txt}, where $\bm{x}^{(i)} \in \mathbb{R}^{5}$ and $\bm{y}^{(i)} \in \mathbb{R}^3$ and there are $20$ of them. Find an $\mat{A} \in \mathbb{R}^{5 \times{} 3}$ that minimizes the square loss. If you do the math correctly, the least square loss as defined in eqn (\ref{eq:lsloss}) should be $3.431402129330746$.
	\end{enumerate}

	\section{Non-linear fitting in terms of LLS}

	The reason why linear least square (LLS) is important is that one can go beyond linear fitting by introducing basis functions.

	To be specific, let us first specify the dimension for each quantity:
	\begin{equation}
		\bm{x} \in \mathbb{R}^n,\quad{}
		\bm{y} \in \mathbb{R}^m,\quad{}
		\tr{data set: }\{(\bm{x}^{(i)}, \bm{y}^{(i)})\}_{i = 1}^N.
	\end{equation}
	Now we introduce a basis function:
	\begin{equation}
	\begin{split}
		\phi:&\, \mathbb{R}^n \to \mathbb{R}^l		\\
			 &\, \bm{x} \to \bm{\phi} = \phi(\bm{x})
	\end{split}
	\end{equation}
	For example, $\phi(x) = [x_1^2, x_2^2, x_1x_2]^{\tr{T}}$ is a basis function transforming a $\mathbb{R}^2$ vector $\bm{x} = [x_1, x_2]^{\tr{T}}$ to a $\mathbb{R}^3$ vector $\bm{\phi}$. With this in hands, our ansatz in eqn (\ref{eq:lls_ansatz}) needs to be modified
	\begin{equation}	\label{eq:lls_ansatz_with_basis}
		\tilde{f}(\bm{x})
			= \mat{A}^{\tr{T}} \phi(\bm{x}) + \bm{b}
	\end{equation}
	and $\mat{A} \in \mathbb{R}^{l \times{} m}$.

	Though eqn (\ref{eq:lls_ansatz_with_basis}) is still linear in $\bm{\phi}$, it does not need to be linear in $\bm{x}$ because the basis function could be non-linear. In this way, one can achieve non-linearity within the framework of LLS.

	\begin{enumerate}
		\item In a way similar to the derivation of eqn (\ref{eq:lls_equation}), show that $\mat{A}$ in eqn (\ref{eq:lls_ansatz_with_basis}) is determined by solving
		\begin{equation}
			\mat{\Phi} \mat{\Phi}^{\tr{T}} \mat{A}
				= \mat{\Phi} \mat{Y}^{\tr{T}}
		\end{equation}
		where $\mat{Y}$ is defined in eqn (\ref{eq:data_set_def}), and
		\begin{equation}
			\mat{\Phi}
				= [\bm{\phi}^{(1)}, \bm{\phi}^{(2)}, \cdots{}, \bm{\phi}^{(N)}].
		\end{equation}

		\item \textit{Polynomial basis}. LLS with basis function
		\begin{equation}
			\phi(x)
				= [1, x, x^2, \cdots{}, x^{l-1}]
		\end{equation}
		is equivalent to fitting a polynomial of order $l-1$. Perform LLS fit with $l = 2, 4, 6$ and $8$ for data sets \ttt{X1.txt} and \ttt{Y1.txt} in \ttt{data/non\_linear\_least\_square}. Then
		\begin{enumerate}
			\item report the loss for each $l$
			\item report the RMS of $\mat{A}$ for each $l$
			\begin{equation}
				\tr{RMS}\,\mat{A}
					= \frac{1}{nm} \sum_{\mu}^n \sum_{\nu}^m A_{\mu\nu}^2
					= \ttt{mean(sum(sum(A.*A)))}\qquad{}\tr{(In MATLAB)}
			\end{equation}
			\item plot all fitted curves along with the data points
		\end{enumerate}
		What trend(s) do you observe?

		\textit{Hint}: wrapping the fitting and plotting processes each in a function would make your life much easier. Specifically, they could be like
		\begin{verbatim}
		    A = lls_poly(X, Y, l)
		        % X/Y: data sets; l: polynomial order
		        % A: LLS coefficient matrix.
		\end{verbatim}
		and
		\begin{verbatim}
		    y = lls_poly_plot(x, A, l)
		        % x: grid points for plotting (e.g. x = [-1.5:0.1:2.5])
		        % A: optimized LLS coefficient matrix
		        % l: polynomial order
		        % y: function values on grid x, so that you can plot with plot(x, y)
		\end{verbatim}

		\item \textit{Polynomial basis (cnt'd)}. The data set above is generated as follows
		\begin{equation}
			y
				= 1 - 2x + x^3 + g
		\end{equation}
		for $x$ randomly drawn from $-1.5$ to $2$, where $g \sim \mathcal{N}(0, 1)$ is a Gaussian random variable that mimics a random noise (from, e.g.\ measure error). Now plot your fitted curves and the original data points along with the ``real" solution (set $g = 0$).
		\begin{enumerate}
			\item Does it approach the ``real" solution for larger $l$?
			\item Does a small loss always mean a \emph{good} fitting?
		\end{enumerate}

		\item \textit{Polynomial basis (cnt'd)}. In the example above, we see how increasing the \emph{model complexity} (in this case, $l$) can result in \emph{overfitting}. However, by using more data points, we can have a more complex model without overfitting. Data sets \ttt{X2.txt} and \ttt{Y2.txt} are generated in the same way, but of a much larger size! Now re-do all fittings with the new data and plot the fitted curves along with the ``real" solution. What new trend(s) do you observe?

		\item \textit{Sinusoidal basis}. Copy everything from \ttt{lls\_poly} to a new function named \ttt{lls\_sin} that uses the following basis
		\begin{equation}
			[1, \sin x, \cos x, \cdots{}, \sin (l-1)x, \cos (l-1)x]^{\tr{T}}
		\end{equation}
		for an order-$l$ fitting. Then re-do the fitting for $l = 2, 4, 6$ and $8$. Report variation of the loss as the model complexity increases. Plot all fitted curves along with the ``real" solution. Do you notice any artificial feature for large $l$?
	\end{enumerate}

\end{document}


%!TEX root = ../main.tex
\documentclass[float=false, crop=false]{standalone}
\usepackage[subpreambles=true]{standalone}
\begin{document}
\section{Equation test}\label{sec:eqntest}
\begin{equation}
D\nabla^2T=\frac{\partial T}{\partial t}
\end{equation}
\end{document}


\par
\chapter{{\tt A2}: Real or complex 2-D array}
\par
The {\tt A2} object is one way to store and operate on and
with a dense matrix.
The matrix can contain either double precision real or complex
entries.
It is used as a lower level object for the {\tt DenseMtx} object,
and during the $QR$ factorization to hold a staircase matrix.
\par