\documentclass[10pt,reqno]{amsart}

\usepackage{accents}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fullpage}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{siunitx}
\usepackage{verbatim}

\mathtoolsset{showonlyrefs,showmanualtags}
\allowdisplaybreaks[1] % Allow grouped equations to be split across pages

\newcommand{\tensor}[1]{\accentset{\leftrightarrow}{#1}}
\newcommand{\Mach}[1][]{\ensuremath{\mbox{Ma}_{#1}}}
\newcommand{\Reynolds}[1][]{\ensuremath{\mbox{Re}_{#1}}}
\newcommand{\Prandtl}[1][]{\ensuremath{\mbox{Pr}_{#1}}}

\lstset{ %
basicstyle=\scriptsize,         % the size of the fonts that are used for the code
numbers=left,                   % where to put the line-numbers
numberstyle=\tiny,              % the size of the fonts that are used for the line-numbers
stepnumber=5,                   % the step between two line-numbers. If it's 1, each line
                                % will be numbered
numbersep=5pt,                  % how far the line-numbers are from the code
frame=single,                   % adds a frame around the code
showstringspaces=false          % underline spaces within strings
}

\begin{document}

\title{
    A transient manufactured solution for the nondimensional, compressible
    Navier--Stokes equations with a power law viscosity
}
\author{Rhys Ulerich}

\begin{abstract}
A time-varying manufactured solution is presented for the nondimensional,
compressible Navier--Stokes equations under the assumption of a constant
Prandtl number, Newtonian perfect gas obeying a power law viscosity.  The
chosen nondimensionalization employs a reference density, length, velocity, and
temperature.  The solution form includes waveforms with adjustable phase
offsets and mixed partial derivatives to bolster code coverage.  Temperature,
rather than pressure, is selected to have a simple analytic form to aid
verifying codes having temperature-based boundary conditions.  Suggested
verification tests for isothermal channel and flat plate codes are provided.  A
C++ implementation of the manufactured solution and the forcing it requires is
provided.  Tests are included to ensure the implementation matches the solution
form to within acceptable floating point loss.
\end{abstract}

\maketitle

\section{Mathematical model}
\label{sec:model}

Under common assumptions the nondimensional Navier--Stokes equations
may take the form
\begin{subequations}
\label{eq:model}
\begin{align}
  \frac{\partial}{\partial{}t}\rho
&=
  - \nabla\cdot\rho{}\vec{u}
  + Q_{\rho}
  \\
  \frac{\partial{}}{\partial{}t}\rho{}\vec{u}
&=
  - \nabla\cdot(\vec{u}\otimes{}\rho{}\vec{u})
  - \frac{1}{\Mach^{2}} \nabla{} p
  + \frac{1}{\Reynolds} \nabla\cdot{} \tensor{\tau}
  + \vec{Q}_{\rho{}u}
  \\
  \frac{\partial}{\partial{}t} \rho{}e
&=
  - \nabla\cdot{}\rho{}e\vec{u}
  - \nabla\cdot{} p \vec{u}
  - \nabla\cdot{} \vec{q}
  + \frac{\Mach^2}{\Reynolds} \nabla\cdot{}\tensor{\tau} \vec{u}
  + Q_{\rho{}e}
\end{align}
aided by the auxiliary relations
\begin{align}
  p &=   \left(\gamma-1\right)\left(\rho{}e
          - \Mach^{2} \rho\frac{\vec{u}\cdot{}\vec{u}}{2} \right)
  &
  T &= \gamma\frac{p}{\rho}
  \\
  \mu &= T^{\beta}
  &
  \lambda &= \left(\alpha-\frac{2}{3}\right) \mu
  \\
  \tensor{\tau}
       &=   \mu \left( \nabla{}\vec{u} + {\nabla{}\vec{u}}^{\mathsf{T}} \right)
          + \lambda \left( \nabla\cdot{}\vec{u} \right) I
  &
  \vec{q} &= - \frac{1}{\Reynolds\Prandtl\left(\gamma-1\right)} \mu \nabla{} T
\end{align}
where the nondimensional quantities
\begin{align}
  \Reynolds &= \frac{\rho_{0}u_{0}l_{0}}{\mu_{0}}
  &
  \Mach &= \frac{u_{0}}{a_{0}}
  &
  \Prandtl &= \frac{\mu_{0}C_{p}}{\kappa_{0}}
  &
  \gamma &= \frac{C_{p}}{C_{v}}
\end{align}
are the constant Reynolds number, Mach number, and Prandtl number, and ratio
of specific heats, respectively.
\end{subequations}
The fluid's nondimensional dynamic viscosity follows a power law in temperature
with exponent $\beta$.  The fluid's bulk viscosity is a constant multiple
$\alpha$ of the dynamic viscosity.  Setting $\alpha = 0$ is equivalent to
Stokes' hypothesis that the bulk viscosity is zero.  Here $e$ denotes the
specific total energy and that later we will refer to the components of
$\vec{u}$ as the scalars $u$, $v$, and $w$.  The arbitrary forcing terms
$Q_{\rho}$, $\vec{Q}_{\rho{}u}$, and $Q_{\rho{}e}$ will be used to obtain the
desired manufactured solution.

\section{Manufactured solution}
\label{sec:solution}

For all $\phi\in\left\{\rho, u, v, w, T\right\}$ we select analytical solutions
of the form
\begin{alignat}{20}
\label{eq:solution}
  \phi\!\left(x, y, z, t\right)
  &= &&a_{\phi{}0}  &&          &&             &&               &&  &&            &&       &&          &&             &&                &&  &&            &&        &&\cos\Bigl(&&f_{\phi{}0 } &&t &&+ &&g_{\phi{}0 }&&\Bigr)       \\
  &+ &&a_{\phi{}x } &&\cos\Bigl(&&b_{\phi{}x } &&2\pi x L_x^{-1}&&+ &&c_{\phi{}x }&&\Bigr) &&          &&             &&                &&  &&            &&        &&\cos\Bigl(&&f_{\phi{}x } &&t &&+ &&g_{\phi{}x }&&\Bigr) \notag\\
  &+ &&a_{\phi{}xy} &&\cos\Bigl(&&b_{\phi{}xy} &&2\pi x L_x^{-1}&&+ &&c_{\phi{}xy}&&\Bigr) &&\cos\Bigl(&&d_{\phi{}xy} &&2\pi y L_y^{-1} &&+ &&e_{\phi{}xy}&&\Bigr)  &&\cos\Bigl(&&f_{\phi{}xy} &&t &&+ &&g_{\phi{}xy}&&\Bigr) \notag\\
  &+ &&a_{\phi{}xz} &&\cos\Bigl(&&b_{\phi{}xz} &&2\pi x L_x^{-1}&&+ &&c_{\phi{}xz}&&\Bigr) &&\cos\Bigl(&&d_{\phi{}xz} &&2\pi z L_z^{-1} &&+ &&e_{\phi{}xz}&&\Bigr)  &&\cos\Bigl(&&f_{\phi{}xz} &&t &&+ &&g_{\phi{}xz}&&\Bigr) \notag\\
  &+ &&a_{\phi{}y } &&\cos\Bigl(&&b_{\phi{}y } &&2\pi y L_y^{-1}&&+ &&c_{\phi{}y }&&\Bigr) &&          &&             &&                &&  &&            &&        &&\cos\Bigl(&&f_{\phi{}y } &&t &&+ &&g_{\phi{}y }&&\Bigr) \notag\\
  &+ &&a_{\phi{}yz} &&\cos\Bigl(&&b_{\phi{}yz} &&2\pi y L_y^{-1}&&+ &&c_{\phi{}yz}&&\Bigr) &&\cos\Bigl(&&d_{\phi{}yz} &&2\pi z L_z^{-1} &&+ &&e_{\phi{}yz}&&\Bigr)  &&\cos\Bigl(&&f_{\phi{}yz} &&t &&+ &&g_{\phi{}yz}&&\Bigr) \notag\\
  &+ &&a_{\phi{}z } &&\cos\Bigl(&&b_{\phi{}z } &&2\pi z L_z^{-1}&&+ &&c_{\phi{}z }&&\Bigr) &&          &&             &&                &&  &&            &&        &&\cos\Bigl(&&f_{\phi{}z } &&t &&+ &&g_{\phi{}z }&&\Bigr) \notag
\end{alignat}
where $a$, $b$, $c$, $d$, $e$, $f$, and $g$ are constant coefficient
collections indexed by $\phi$ and one or more directions.  To aid in providing
reusable, physically realizable coefficients for Cartesian domains of arbitrary
size, domain extents $L_x$, $L_y$, $L_z$ have been introduced.  Partial
derivatives $\phi_{t }$, $\phi_{x }$, $\phi_{y }$, $\phi_{z }$, $\phi_{xx}$,
$\phi_{xy}$, $\phi_{xz}$, $\phi_{yy}$, $\phi_{yz}$, and $\phi_{zz}$ may be
computed directly from the chosen solutions.

Though they increase the solution's complexity significantly, mixed partial
spatial derivatives are included to improve code coverage.  Each term has an
adjustable amplitude, frequency, and phase for all spatial dimensions.  Cosines
were chosen so all terms can be ``turned off'' by employing zero coefficients.
It is suggested that users gradually ``turn on'' the more complicated features
of the solution (i.e. use non-zero coefficients) after ensuring simpler usage
has been successful.

The Python-based computer algebra system SymPy (\url{http://sympy.org})
can both compute the derivatives and output C code for computing these
values at some $x$, $y$, $z$, and $t$:
\lstinputlisting[language=Python]{soln.py}

\section{Forcing terms}
\label{sec:forcing}

The solutions given in \textsection~\ref{sec:solution} may be plugged into the
model from \textsection~\ref{sec:model} and solved for the forcing terms
$Q_{\rho}$, $\vec{Q}_{\rho{}u}$, and $Q_{\rho{}e}$.  However, solving for these
complete terms entirely within the context of a computer algebra system causes
an unwieldy explosion of terms.  As the fully expanded forcing terms are too
large to be usable in any meaningful way, they are not shown.

Instead, starting from the solution and its the analytic derivatives, we use
basic calculus followed by algebraic operations performed in floating point to
obtain the necessary forcing \emph{at runtime}.  The errors arising in this
process behave like standard floating point truncation issues.  Many of the
computations are independent of the constitutive relations used and could be
employed for other manufactured solutions.

Computing the forcing terms looks as follows:
\lstinputlisting[language=python]{forcing.py}

\section{Suggested coefficients for isothermal channels and flat plates}
\label{sec:suggest}

Employing the manufactured solution requires fixing the more than two hundred
coefficients appearing in equations \eqref{eq:model} and \eqref{eq:solution}.
Selecting usable values is not difficult but it can be time consuming.  We
therefore present reasonable coefficient choices for testing channel and flat
plate codes.

In both geometries the streamwise, wall-normal, and spanwise directions are
labeled $x$, $y$, and $z$ respectively.  Both $x$ and $z$ are periodic while
$y\in\left\{0,L_y\right\}$ is not.  Transient tests should likely take place
within the duration $0\leq{}t\leq{}1/10$ nondimensional time units as the time
phase offsets (e.g. $g_{Tyz}$) have been chosen for appreciable transients to
occur throughout this time window.

For isothermal channel flow code verification we recommend testing using
\begin{equation*}
  b_{\rho{}y} =
  b_{u{}y}    =
  b_{v{}y}    =
  b_{w{}y}    =
  b_{T{}y}    = \frac{1}{2}
\end{equation*}
and the coefficients given in Table~\ref{tbl:auxcoeff}.  With these choices
the manufactured solution satisfies isothermal, no-slip conditions at $y = 0,
L_y$.  For isothermal flat plate code verification we recommend testing using
\begin{equation*}
  b_{\rho{}y} =
  b_{u{}y}    =
  b_{v{}y}    =
  b_{w{}y}    =
  b_{T{}y}    = \frac{1}{4}
\end{equation*}
and the coefficients given in Table~\ref{tbl:auxcoeff}.  With these choices
the manufactured solution satisfies an isothermal, no-slip condition at $y =
0$.

\section{Reference Implementation}

A templated, precision-agnostic C++ implementation for evaluating the
manufactured solution and its associated forcing is included.  Also included is
a high precision test case which ensures the implementation computes exactly
what is described in this documentation.  The test can do so because it
executes the same Python source files used to generate this document.

One can ensure the implementation files match this documentation by comparing
against the following MD5 checksums:

\verbatiminput{CHECKSUMS}

More details on the implementation and tests can be found in the solution's
README:

\verbatiminput{README}

\begin{table}[p]
\allowdisplaybreaks
\begin{multicols}{3}
\begin{small}
\begin{align*}
\alpha    &= 0          \\
\beta     &= 2/3        \\
\gamma    &= \num{1.4}  \\
\Mach     &= \num{1.15} \\
\Prandtl  &= \num{0.7}  \\
\Reynolds &= 100 \\
L_x       &= 4 \pi \\
L_y       &= 2 \\
L_z       &= 4 \pi / 3 \\
\intertext{}
a_{\rho{}0}  &= 1 \\
a_{\rho{}xy} &= 1 / 11 \\
b_{\rho{}xy} &= 3 \\
d_{\rho{}xy} &= 3 \\
f_{\rho{}xy} &= 3 \\
g_{\rho{}xy} &= \pi / 4 \\
a_{\rho{}y} &= 1 / 7 \\
b_{\rho{}y} &= \text{\emph{see \textsection{}~\ref{sec:suggest}}} \\
f_{\rho{}y} &= 1 \\
g_{\rho{}y} &= \pi / 4 - 1 / 20 \\
a_{\rho{}yz} &= 1 / 31 \\
b_{\rho{}yz} &= 2 \\
d_{\rho{}yz} &= 2 \\
f_{\rho{}yz} &= 2 \\
g_{\rho{}yz} &= \pi / 4 + 1 / 20 \\
\intertext{}
a_{uxy} &= 37 / 251 \\
b_{uxy} &= 3 \\
c_{uxy} &= - \pi / 2 \\
d_{uxy} &= 3 \\
e_{uxy} &= - \pi / 2 \\
f_{uxy} &= 3 \\
g_{uxy} &= \pi / 4 \\
a_{uy} &= 1 \\
b_{uy} &= \text{\emph{see \textsection{}~\ref{sec:suggest}}} \\
c_{uy} &= -\pi / 2 \\
f_{uy} &= 1 \\
g_{uy} &= \pi / 4 - 1 / 20 \\
a_{uyz} &= 41 / 257 \\
b_{uyz} &= 2 \\
c_{uyz} &= - \pi / 2 \\
d_{uyz} &= 2 \\
e_{uyz} &= - \pi / 2 \\
f_{uyz} &= 2 \\
g_{uyz} &= \pi / 4 + 1 / 20 \\
\intertext{}
a_{vxy} &= 3 / 337 \\
b_{vxy} &= 3 \\
c_{vxy} & = - \pi / 2 \\
d_{vxy} & = 3         \\
e_{vxy} & = - \pi / 2 \\
f_{vxy} &= 3 \\
g_{vxy} &= \pi / 4 \\
a_{vy} &= 2 / 127 \\
b_{vy} &= \text{\emph{see \textsection{}~\ref{sec:suggest}}} \\
c_{vy} &= - \pi / 2 \\
f_{vy} &= 1 \\
g_{vy} &= \pi / 4 - 1 / 20 \\
a_{vyz} &= 5 / 347 \\
b_{vyz} &= 2 \\
c_{vyz} &= -\pi / 2 \\
d_{vyz} &= 2 \\
e_{vyz} &= -\pi / 2 \\
f_{vyz} &= 2 \\
g_{vyz} &= \pi / 4 + 1 / 20 \\
\intertext{}
a_{wxy} &= 11 / 409 \\
b_{wxy} &= 3 \\
c_{wxy} &= -\pi / 2 \\
d_{wxy} &= 3 \\
e_{wxy} &= -\pi / 2 \\
f_{wxy} &= 3 \\
g_{wxy} &= \pi / 4 \\
a_{wy} &= 7 / 373 \\
b_{wy} &= \text{\emph{see \textsection{}~\ref{sec:suggest}}} \\
c_{wy} &= - \pi / 2 \\
f_{wy} &= 1 \\
g_{wy} &= \pi / 4 - 1 / 20 \\
a_{wyz} &= 13 / 389 \\
b_{wyz} &= 2 \\
c_{wyz} &= - \pi / 2 \\
d_{wyz} &= 2 \\
e_{wyz} &= - \pi / 2 \\
f_{wyz} &= 2 \\
g_{wyz} &= \pi / 4 + 1 / 20 \\
\intertext{}
a_{T0} &= 1 \\
a_{Txy} &= 1 / 17 \\
b_{Txy} &= 3 \\
c_{Txy} &= - \pi / 2 \\
d_{Txy} &= 3 \\
e_{Txy} &= - \pi / 2 \\
f_{Txy} &= 3 \\
g_{Txy} &= \pi / 4 \\
a_{Ty} &= 1 / 13 \\
b_{Ty} &= \text{\emph{see \textsection{}~\ref{sec:suggest}}} \\
c_{Ty} &= - \pi / 2 \\
f_{Ty} &= 1 \\
g_{Ty} &= \pi / 4 - 1 / 20 \\
a_{Tyz} &= 1 / 37 \\
b_{Tyz} &= 2 \\
c_{Tyz} &= - \pi / 2 \\
d_{Tyz} &= 2 \\
e_{Tyz} &= - \pi / 2 \\
f_{Tyz} &= 2 \\
g_{Tyz} &= \pi / 4 + 1 / 20 \\
\end{align*}
\end{small}
\end{multicols}
\caption{Coefficient recommendations from section~\ref{sec:suggest}.
         Unlisted coefficients should be set to zero.
         \label{tbl:auxcoeff}}
\end{table}

\end{document}


\graphicspath{{Pics/combi/config/}}

\newpage\section{Exploring Configurations}

Problems where there is some kind of a configuration is given, the question
usually asks to proof or find some specific properties of the configuration.

\subsection{Problems}

\prob{https://artofproblemsolving.com/community/c6h1634977p10278658}{ARO 2018
    P11.5}{E}{
    On the table, there're $ 1000 $ cards arranged on a circle. On each
    card, a positive integer was written so that all $ 1000 $ numbers are
    distinct.

    First, Vasya selects one of the card, remove it from the circle, and
    do the following operation: If on the last card taken out was written positive
    integer $ k $, count the $ k^{th} $ clockwise card not removed, from that
    position, then remove it and repeat the operation. This continues until only
    one card left on the table.

    Is it possible that, initially, there's a card $A$ such that, no matter
    what other card Vasya selects as first card, the one that left is always
    card $A$?
}\label{problem:constructive_algo_7}

\solu{
    Consider the numbering, \[1, 1001!+1, 1002!+1, \dots 1998!+1,
    1999!+2\]It's easy to check that it works.
}

\rem{
    We want to find a configuration, where one card, let's call it $ a $,
    gets skipped over all the time. Now, controlling the skipping for every move
    is kinda hard. Instead of doing that, we want to control only one move that
    skips $ a $, and all other moves will go to the next card in the clockwise
    rotation. And the card before $ a $ will skip over $ a $, and land of the next
    card. That being said, the construction is rather trivial.
}

\prob{https://artofproblemsolving.com/community/c6h1446905p8271388}
{APMO 2017 P1}{M}{
    We call a $5$-tuple of integers arrangeable if its elements can be
    labeled $a,b,c,d,e$ in some order so that $a-b+c-d+e=29$. Determine all $ 2017$
    -tuples of integers $n_1, n_2, n_3\dots n_{2017}$ such that if we place
    them in a circle in clockwise order, then any $5$-tuple of numbers in
    consecutive positions on the circle is arrangeable.
}\label{problem:minus_constant_1}\label{problem:invariant_rules_of_thumb_5}

\solu{
    The annoying part is the $a-b+c-d+e = 29$ condition, as $29$ is too random.
    Can we do something to make this sum equal to a nicer interger, possibly
    $0$?
}

\prob{https://artofproblemsolving.com/community/c6h41116p258304}
{ISL 2004 C1}{E}{
    There are $10001$ students at an university. Some students join
    together to form several clubs (a student may belong to different clubs).
    Some clubs join together to form several societies (a club may belong to
    different societies). There are a total of $k$ societies. Find all
    possible values of $k$ so that the following conditions are satisfied:
    \begin{enumerate}
        \item  Each pair of students are in exactly one club.
        \item  For each student and each society, the student is in exactly
            one club of the society.
        \item  Each club has an odd number of students. In addition, a club
            with ${2m+1}$ students ($m$ is a positive integer) is in exactly $m$
            societies.
    \end{enumerate}
}\label{problem:double_counting_7}

\solu{Just Double-Counting.}

\prob{https://artofproblemsolving.com/community/c6h17336p118710}{ISL 2002
C1}{E}{Let $ n $ be a positive integer. Each point $ (x,y) $ in the plane,
where $ x $ and $ y $ are non-negative integers with $ x+y<n $ , is coloured
red or blue, subject to the following condition: if a point $ (x,y) $ is red,
then so are all points $ (x',y') $ with $ x'\leq x $ and $ y'\leq y $. Let $ A
$ be the number of ways to choose $ n $ blue points with distinct $ x $
-coordinates, and let $ B $ be the number of ways to choose $ n $ blue points
with distinct $ y $ -coordinates. Prove that $ A=B
$.}\label{problem:induction_type1_5}\label{problem:recursive_solution_2}\label{problem:bijection_1}

\prob{https://artofproblemsolving.com/community/c5h476723p2669115}{USAMO 2012
P2}{M}{A circle is divided into $ 432 $ congruent arcs by $ 432 $ points. The
points are colored in four colors such that some $ 108 $ points are colored
Red, some $ 108 $ points are colored Green, some $ 108 $ points are colored
Blue, and the remaining $ 108 $ points are colored Yellow. Prove that one can
choose three points of each color in such a way that the four triangles formed
by the chosen points of the same color are
congruent.}\label{problem:double_counting_6}

\solu{Double counting saves the day :) The trick is to rotate ;)}

\prob{http://emc.mnm.hr/wp-content/uploads/2018/12/EMC_2018_Seniors_ENG_Solutions-2.pdf}{European
Mathematics Cup 2018 P1}{E}{Call a partition of $ n $ a set $ a_1, \dots a_k $
with $ a_1 \le a_2\dots \le a_k $ and $ a_1 + a_2 \dots + a_k =  $. A
partition of a positive integer is `even' if all of its elements are even
numbers. Similarly, a partition is `odd' if all of its elements are odd.
Determine all positive integers $ n $ such that the number of even partitions
of $ n $ is equal to the number of odd partitions of $ n $.}

\solu{Bijection.}

\prob{https://artofproblemsolving.com/community/c6h1268873p6622370}{ISL 2015 C1}{E}{In Lineland there are $n\geq1$ towns, arranged along a road running from left to right. Each town has a left bulldozer (put to the left of the town and facing left) and a right bulldozer (put to the right of the town and facing right). The sizes of the $2n$ bulldozers are distinct. Every time when a left and right bulldozer confront each other, the larger bulldozer pushes the smaller one off the road. On the other hand, bulldozers are quite unprotected at their rears; so, if a bulldozer reaches the rear-end of another one, the first one pushes the second one off the road, regardless of their sizes.

    Let $A$ and $B$ be two towns, with $B$ to the right of $A$. We say that town $A$ can sweep town $B$ away if the right bulldozer of $A$ can move over to $B$ pushing off all bulldozers it meets. Similarly town $B$ can sweep town $A$ away if the left bulldozer of $B$ can move over to $A$ pushing off all bulldozers of all towns on its way.

Prove that there is exactly one town that cannot be swept away by any other one.}

\solu{Focus on the heaviest bulldozer.}

\prob{https://artofproblemsolving.com/community/c6h195492p1073989}{APMO 2008
P2}{EM}{Students in a class form groups each of which contains exactly three
members such that any two distinct groups have at most one member in common.
Prove that, when the class size is $ 46 $ , there is a set of $ 10 $ students
in which no group is properly
contained.}\label{problem:bijection_8}\label{problem:extremal_case_whole_5}

\solu{Taking the maximum set that follows the ``in which no group is properly
contained'' rule. Now the elements that are \emph{not} in this set, we can
connect this element to only one of the pairs from the set. Now defining a
bijection, and counting the elements, we are done.}

\prob{https://artofproblemsolving.com/community/c6h364231p2000940}{IMO SL
1985}{M}{A set of $ 1985 $ points is distributed around the circumference of a
circle and each of the points is marked with $ 1 $ or $ -1 $. A point is
called ``good'' if the partial sums that can be formed by starting at that
point and proceeding around the circle for any distance in either direction
are all strictly positive. Show that if the number of points marked with $ -1
$ is less than $ 662 $ , there must be at least one good
point.}\label{problem:induction_type1_12}

\solu{First thing to notice, the number $ 3*661 + 2 = 1985 $. And these
numbers are completely random. So what if we try to replace $ 1985 $ by $ n $
? Will the condition still hold?}

\prob{https://artofproblemsolving.com/community/c6h418978p2365036}{IMO 2011
P4}{E}{Let $ n > 0 $ be an integer. We are given a balance and $ n $ weights
of weight $ 2^0, 2^1, \cdots, 2^{n-1} $. We are to place each of the $ n $
weights on the balance, one after another, in such a way that the right pan is
never heavier than the left pan. At each step we choose one of the weights
that has not yet been placed on the balance, and place it on either the left
pan or the right pan, until all of the weights have been placed. Determine the
number of ways in which this can be done.}\label{problem:recursive_solution_5}

\solu{Writing the whole process as a sum, we see that only $ 2^0 $ is the odd
term here, if we remove that we can divide by $ 2 $ to get a recursive
formula.}

\solu{Calculating wrt to the last placed weight.}

\solu{Getting recursive formula considering the position of $ 2^{n-1} $.}

\prob{https://artofproblemsolving.com/community/c5h202936p1116367}{USAMO 2008
P3}{H}{Let $ n $ be a positive integer. Denote by $ S_n $ the set of points $
(x, y) $ with integer coordinates such that \[ \left\lvert x\right\rvert +
\left\lvert y + \frac{1}{2} \right\rvert < n. \] A path is a sequence of
distinct points $ (x_1 , y_1), (x_2, y_2), \ldots, (x_\ell, y_\ell) $ in $ S_n
$ such that, for $ i = 2, \ldots, \ell $ , the distance between $ (x_i , y_i)
$ and $ (x_{i-1} , y_{i-1} ) $ is $ 1 $ (in other words, the points $ (x_i,
y_i) $ and $ (x_{i-1} , y_{i-1} ) $ are neighbors in the lattice of points
with integer coordinates). Prove that the points in $ S_n $ cannot be
partitioned into fewer than $ n $ paths (a partition of $ S_n $ into $ m $
paths is a set $ \mathcal{P} $ of $ m $ nonempty paths such that each point in
$ S_n $ appears in exactly one of the $ m $ paths in $ \mathcal{P} $
).}\label{problem:alternating_chains_2}\label{problem:coloring_2}

\solu{Graph + Partition, coloring is just natural. Again, the edges join two
neighbor lattice points, so checkerboard coloring. But checkerboard doesn't do
much good. So the next thing we try is to apply some derivations of it,
pseudo!!! Well, overkill.}

\solu{For all n, induction is very natural. The optimal partition (the most
beautiful one) and the longest path in it, say $ P $ , gives us a way to
perform induction. As always, we suppose a partition with $ n-1 $ paths. As
there are a lot of partitions, we need to choose a certain partition, say $
\mathbb{M} $. Again as our goal is to include $ P $ in $ \mathbb{M} $. So
suppose that the set with all the points in $ P $ is $ A $. And further more,
suppose that in $ \mathbb{M} $ there is a path $ Q $ with $ \vert Q\cap A\vert
$ being maximal among all other partitions of the points. Some some easy case
work shows that we must have $ P\in \mathbb{M} $.}

\prob{https://artofproblemsolving.com/community/c5h532235p3041823}{USAMO 2013
P2}{H}{For a positive integer $ n\geq 3 $ plot $ n $ equally spaced points
around a circle. Label one of them $ A $ , and place a marker at $ A $. One
may move the marker forward in a clockwise direction to either the next point
or the point after that. Hence there are a total of $ 2n $ distinct moves
available; two from each point. Let $ a_n $ count the number of ways to
advance around the circle exactly twice, beginning and ending at $ A $ ,
without repeating a move. Prove that $ a_{n-1}+a_n=2^n $ for all $ n\geq 4
$.}\label{problem:recursive_solution_4}\label{problem:bijection_7}

\solu{Problems where there are multiple possible value of a function
regardless of the current position, one of dealing with these is to assigning
labels of these possible values to each points of the function, and this will
give a combinatorial model and a way to deal it with bijection.}

\solu{First investigate the problem condition, $ a_n + a_{n-1} = 2^n $ , now,
$ 2^n $ means the number of differently coloring every point black or white,
and the left side is the number of such paths for $ n $ and $ n-1 $. Which
means we should try to color the points and see what happens.}

\proof{EChen's solution: In this problem, the main obstacle seems to be the
circle condition. And on top of that, on can land on the starting point. So
things are pretty messed up here. What we want to do is to make things a
little bit more easy to deal with. So our best option is to change the problem
so that we get the similar problem with a different explanation. So we change
the condition circle with matrix, $ 2 $ round with $ 2 $ rows. $ n $ points
with $ n $ entries in each rows. What we get now is the same problem, just a
bit easier to deal with. We call this \hl{Tweak The Problem} strategy.}

\prob{}{}{E}{ $ 10 $ persons went to a bookstore. It is known that: Every
person has bought 3 kinds on books and for every 2 persons, there is at least
one kind of books which they both have bought. Let $ m_i $ be the number of
the persons who bought the $ i^{th} $ kind of books and $ M= \max\lbrace
m_i\rbrace $ Find the smallest possible value of $ M
$.}\label{problem:double_counting_4}

\prob{https://artofproblemsolving.com/community/c6h86560p504805}{ARO 2006
    11.3}{M}{On a $49\times 69$ rectangle formed by a grid of lattice squares,
    all $50\cdot 70$ lattice points are colored blue. Two persons play the
    following game: In each step, a player colors two blue points red, and
    draws a segment between these two points. (Different segments can
    intersect in their interior.) Segments are drawn this way until all
    formerly blue points are colored red. At this moment, the first player
    directs all segments drawn - i. e., he takes every segment AB, and
    replaces it either by the vector $\overrightarrow{AB}$, or by the vector
    $\overrightarrow{BA}$. If the first player succeeds to direct all the
    segments drawn in such a way that the sum of the resulting vectors is
    $\overrightarrow{0}$, then he wins; else, the second player wins.

Which player has a winning strategy?}

\proof{The basic idea comes from wishing that the first player might be able
to copy the second player to ``nullify'' his moves. But since this isn't
always possible, because no nice symmetry exists on the board, the idea of
coloring the board with dominoes and copying moves wrt the dominoes comes.
\index[strat]{copycat!partition!aro 2006 11.3}}

\prob{https://artofproblemsolving.com/community/c6h17338p118714}{ISL 2002
C3}{EM}{Let $n$ be a positive integer. A sequence of $n$ positive integers
(not necessarily distinct) is called full if it satisfies the following
condition: for each positive integer $k\geq2$, if the number $k$ appears in
the sequence then so does the number $k-1$, and moreover the first occurrence
of $k-1$ comes before the last occurrence of $k$. For each $n$, how many full
sequences are
there?}\label{problem:bijection_13}\label{problem:graph_representation_9}

\proof{After guessing the ans, the first thing that I did was to draw a level
based graph. Suppose that a full sequence has $ k $ different entries. Then
the top level contains the positions of $ k $ in the sequence sorted from left
to right. The next level contains the positions of $ k-1 $ in the sequence
sorted so, and so on till the last level. What I noticed is that if we draw
arrows pointing from a larger integer to a smaller integer, the only arrows
(or more like relations between entries of the sequence) we need to worry
about are the arrows pointing left to right in each levels, and the arrows
from the last entry of level $ i $ to the first entry of level $ i+1 $. After
this, if we try with a smaller case, we see that this leads to a bijection
from the set of sequences of length $ n $ with $ n $ different integers to the
set of full-sequences of length $ n $.}

\solu{Another bijection approach is as followed, in a full-sequence, on first
run, go from right to left, placing integers starting with $ 1 $ onwards on
the $ 1 $'s in the sequence. on the second run continue counting and placing
integers on the $ 2 $'s and so on.}

\solu{Another idea is to prove $ a_n = n a_{n-1} $. To do this, remove the
rightmost $ 1 $ and do some casework.}

\prob{https://artofproblemsolving.com/community/c6h219938p1219679}{ISL 1994
C2}{M}{In a certain city, age is reckoned in terms of real numbers rather than
integers. Every two citizens $x$ and $x'$ either know each other or do not
know each other. Moreover, if they do not, then there exists a chain of
citizens $x = x_0, x_1, \ldots, x_n = x'$ for some integer $n \geq 2$ such
that $ x_{i-1}$ and $x_i$ know each other. In a census, all male citizens
declare their ages, and there is at least one male citizen. Each female
citizen provides only the information that her age is the average of the ages
of all the citizens she knows. Prove that this is enough to determine uniquely
the ages of all the female citizens.}

\solu{Describing the problem using matrix and vector spaces, the problem
reduces to well known theorems of linear algebra.}

\prob{https://artofproblemsolving.com/community/c6h93p261}{ISL 2003 C1}{E}{Let
$A$ be a $101$-element subset of the set $S=\{1,2,\ldots,1000000\}$. Prove
that there exist numbers $t_1$, $t_2, \ldots, t_{100}$ in $S$ such that the
sets \[ A_j=\{x+t_j\mid x\in A\},\qquad j=1,2,\ldots,100 \] are pairwise
disjoint.}

\solu{just count...}

\prob{https://artofproblemsolving.com/community/c6h1425422p8029376}{EGMO 2017
    P5}{E}{Let $n\geq2$ be an integer. An $n$-tuple $(a_1,a_2,\dots,a_n)$ of
    not necessarily different positive integers is expensive if there exists a
    positive integer $k$ such that

    \[(a_1+a_2)(a_2+a_3)\dots(a_{n-1}+a_n)(a_n+a_1)=2^{2k-1}\]

    a) Find all integers $n\geq2$ for which there exists an expensive
    $n$-tuple.

b) Prove that for every odd positive integer $m$ there exists an integer
$n\geq2$ such that $m$ belongs to an expensive $n$-tuple.}

\rem{gutaguti solution}

\solu{All odd $ n $ works, you can prove for even $ n $ by $ +1, -1 $
addition. For the second part, start with the odd number, move on both side,
you will eventually reach $ 1 $.}

\prob{https://artofproblemsolving.com/community/c6h84550p490581}{USAMO 2006
P2}{E}{For a given positive integer $k$ find, in terms of $k$, the minimum
value of $N$ for which there is a set of $2k + 1$ distinct positive integers
that has sum greater than $N$ but every subset of size $k$ has sum at most
$\tfrac{N}{2}.$}

\solu{Compactness is the optimal decision.}

\prob{https://artofproblemsolving.com/community/c6h1076949p4710743}{MOP
Problem}{E}{Prove that for any positive integer $c$, there exists an integer
$n$ such that $n$ has more 1's in its binary expansion than $n^2+c$ does.}

\solu{For $ x= 2^a-1 $, $ x $ and $ x^2 $ have the same number of $ 1's $. So
does $ x=2^a-2^b $. But what if increase the number of $ 1's $ in this $ x $
by substracting $ 1 $? Let $ x=2^a - 2^b -1 $. This might work if we can
choose nice $ a, b $'s}

\prob{https://artofproblemsolving.com/community/c6h1078552p4732509}{EGMO 2015
P2}{EM}{A domino is a $2 \times 1$ or $1 \times 2$ tile. Determine in how many
ways exactly $n^2$ dominoes can be placed without overlapping on a $2n \times
2n$ chessboard so that every $2 \times 2$ square contains at least two
uncovered unit squares which lie in the same row or column.}

\solu{Notice how each of the four kind of dominoes needs to be in a group. So
if we separated them into blocks, inverstigation shows that there can only be
$ 4 $ blocks and each strictly attached to the sides. The reason why this is
happening is pretty obvious. Now those blocks create two paths between the two
opposite vertices of the square. This gives our desired bijection.}

\prob{https://artofproblemsolving.com/community/c6h148826p841252}{USA TST 2006
P5}{TE}{Let $n$ be a given integer with $n$ greater than $7$ , and let
$\mathcal{P}$ be a convex polygon with $n$ sides. Any set of $n-3$ diagonals
of $\mathcal{P}$ that do not intersect in the interior of the polygon
determine a triangulation of $\mathcal{P}$ into $n-2$ triangles. A triangle in
the triangulation of $\mathcal{P}$ is an interior triangle if all of its sides
are diagonals of $\mathcal{P}$. Express, in terms of $n$, the number of
triangulations of $\mathcal{P}$ with exactly two interior triangles, in closed
form.}

\solu{Just mindless calculation...}

\prob{https://artofproblemsolving.com/community/c6h418687p2362298}{ISL 2010
    C3}{E}{2500 chess kings have to be placed on a $100 \times 100$ chessboard
    so that

    \begin{enumerate} \item  no king can capture any other one (i.e. no two
    kings are placed in two squares sharing a common vertex); \item  each row
    and each column contains exactly 25 kings.  \end{enumerate}

Find the number of such arrangements. (Two arrangements differing by rotation
or symmetry are supposed to be different.)}

\solu{In a $ 2\times 2 $ box, one can place only one king. So we divide the
board in that way, and explore...}

\prob{https://artofproblemsolving.com/community/c6h1558133_a_tasty_dish_of_graph_theory}{USA
    Winter TST 2018 P3}{M}{
    At a university dinner, there are $ 2017 $
    mathematicians who each order two distinct entrées, with no two mathematicians
    ordering the same pair of entrées. The cost of each entrée is equal to the
    number of mathematicians who ordered it, and the university pays for each
    mathematician's less expensive entrée (ties broken arbitrarily). Over all
    possible sets of orders, what is the maximum total amount the university could
    have paid?
}

\input{dump/USATST_W_2018_P3}

\rem{Easy to think in grids, but it was quite difficult to formulate the
solution rigorously, I still am not 100\% convinced myself. Next time when I
feel like it, I will reconstruct the solution. Roughly it is: take the final 0
value columns, prove that there is only one such, and prove the bounds on the
solution before using that instead. Then use general bounding to find the
maximum. It's not hard, it's just I don't have time now. GAH!! HSC!!}

\rem{Didn't read other solutions too, gonna give a todo}
%todo: read other solutions.

\subsubsection{Conway's Soldiers}

\prob{https://artofproblemsolving.com/community/c6h62194p372309}{ISL 1993
C5}{MH}{On an infinite chessboard, a solitaire game is played as follows: at
the start, we have $n^2$ pieces occupying a square of side $n.$ The only
allowed move is to jump over an occupied square to an unoccupied one, and the
piece which has been jumped over is removed. For which $n$ can the game end
with only one piece remaining on the board?}

\solu{We want to find an invariant. So we need to find a weight for each of
the cells such that any two consecutive cells' values equals to the values of
the two cells on the two sides. Some mind bashing gives the idea of mod $ 3 $.
And a construction for the other $ n $'s can be easily generated after some
casework.}

\prob{https://artofproblemsolving.com/community/c6h262542p1426437}{ARO 1999
P4}{M}{A frog is placed on each cell of a $n \times n$ square inside an
infinite chessboard (so initially there are a total of $n \times n$ frogs).
Each move consists of a frog $A$ jumping over a frog $B$ adjacent to it with
$A$ landing in the next cell and $B$ disappearing (adjacent means two cells
sharing a side). Prove that at least $ \left[\frac{n^2}{3}\right]$ moves are
needed to reach a configuration where no more moves are possible.}

\solu{In the final stage, no two neighboring cells are occupied. Could we
double count the number of frogs with this information? What about the number
of frogs in the original $ n\times n $ board? Another small information needed
for this is that we need $ 2 $ moves to ``empty'' a $ 2\times 2 $ board.}

\subsubsection{Triominos}

\prob{https://artofproblemsolving.com/community/c6h404324p2254569}{ARO 2011
P10.8}{M}{A $2010\times 2010$ board is divided into corner-shaped figures of
three cells. Prove that it is possible to mark one cell in each figure such
that each row and each column will have the same number of marked cells.}

\solu{First we will mark the corner pieces of the triominos. Then shift the
mark to either of the legs. Our objective is to show that we can always do
this. First if we only focus on the rows, we can easily show that this can be
done using some counting. To show that we can do the same for columns as well,
we create a graph from columns and rows to triominos which should be operated
on, and using Hall's Marriage we pove the result.}

\prob{}{St. Petersburg 2000}{E}{On an infinite checkerboard are placed $111$
non-overlapping corners, L-shaped figures made of $3$ unit squares. Suppose
that for any corner, the $2\times 2$ square containing it is entirely covered
by the corners. Prove that one can remove some number between $1$ and $110$ of
the corners so that the property will be preserved.}

\subsubsection{Dominos}

\prob{}{}{E}{An $m\times n$ rectangular grid is covered by dominoes. Prove
that the vertices of the grid can be coloured using three colours so that any
two vertices a distance $1$ apart are colored with different colours if and
only if their segment lies on the boundary of a domino.}

\solu{Create a graph with the midpoints of the dominos.}

\subsection{Clearly Bijection}

\prob{https://artofproblemsolving.com/community/c6h1446909p8271411}
{APMO 2017 P3}{H}{
    Let $ A(n) $ denote the number of sequences $ a_1\geq a_2\geq \dots\geq
    a_k $ of positive integers for which   $ \sum_{i=1}^k a_k =n $ and each $
    a_i+1 $ is a power of two.

    Let $ B(n) $ denote the number of sequences $
    b_1\geq b_2\geq\dots\geq b_k $ of positive integers for which $ \sum_{i=1}^k
    b_k =n $ and each inequality $ b_j\geq 2b_{j+1} $ holds $(j=1,2\dots m-1)$.

    Prove that $ \vert A(n)\vert =\vert B(n)\vert $ for every
    positive integer.
}\label{problem:add_stuffs_1}\label{problem:bijection_6}

\solu{
    A sequence of the first type can be rewritten as: \[
    n=x_1+3x_2+7x_3\dots +(2^i-1)x_i+\dots (2^k-1)x_k \] Where $ x_i $ are
    non-negative integers. This motivates us to find a way to represent $ b_i $ as
    sums of $ ( 2^i-1)x_i $. Then since $ b_j\geq 2b_{j+1} $, we write: $
    b_i=2b_{i-1}+x_i $ with $ x_i $ being non-negative integers.
}

\prob{https://artofproblemsolving.com/community/c6h215429p1191679}
{ISL 2008 C4}{M}{
    Let $ n $ and $ k $ be positive integers with $ k\geq n $ and $k-n$
    an even number. Let $ 2n $ lamps labeled $ 1,2\dots 2n $ be given, each
    of which can be either on or off. Initially, all the lamps are off. We
    consider sequences of steps: at each step one of the lamps is switched
    (from on to off or from off to on).

    Let $ N $ be the number of such sequences consisting of $ k $ steps and
    resulting in the state where lamps $ 1 $ through $ n $ are all on, and
    lamps $ n+1 $ through $ 2n $ are all off.

    Let $ M $ be number of such sequences consisting of $ k $ steps, resulting
    in the state where lamps $ 1 $ through $ n $ are all on, and lamps $ n+1 $
    through $ 2n $ are all off, but where none of the lamps $ n+1 $ through $
    2n $ is ever switched on.

    Determine $ \dfrac{N}{M} $.
}\label{problem:bijection_5}

\solu{
    These type of problems most of the time have bijection or algo
    solutions. Think of a way to perform bijection from the set $ S\{M\}
    \rightarrow S\{N\} $. Find an algorithm to get a sequence of the first type
    from a sequence of the second type.
}

\prob{https://artofproblemsolving.com/community/c6h57380p353058}
{USAMO 1996 P4}{E}{
    An $ n $ -term sequence $ (x_1, x_2, \ldots, x_n) $ in which each term
    is either 0 or 1 is called a binary sequence of length $ n $. Let $ a_n $ be
    the number of binary sequences of length $ n $ containing no three consecutive
    terms equal to 0, 1, 0 in that order. Let $ b_n $ be the number of binary
    sequences of length $ n $ that contain no four consecutive terms equal to 0,
    0, 1, 1 or 1, 1, 0, 0 in that order. Prove that $ b_{n+1} = 2a_n $ for all
    positive integers $ n $.
}\label{problem:bijection_4}

\solu{
    These type of problems cries for a nice bijection. That is a way to get
    from $ a\rightarrow b $ and vice versa. What if there is no $ 0,0,1,1 $ ? Or
    what if there is no $ 0,1,0 $ ? What is an one way bijection?
}


\section{Binary integers : ZArith}
The {\tt ZArith} library deals with binary integers (those used
by the {\tt Omega} decision tactic).
Here are defined various arithmetical notions and their properties,
similar to those of {\tt Arith}.


\section{Control Panel} \label{sec:cp}
Before we dive in an start modelling the planet, let us first set up a control
panel that will influence how the model will behave and effectively decides what
type of planet we model.

\subsection{The Beginning}
In the beginning there was nothing, and then there was "Hello World!" Or at
least that is how many projects start. Why? you might ask, which is a perfectly
valid question. In Computer Science, "Hello World!" is very simple code that we
use to test whether all the tools we need to get coding works. This checks
whether the computer compiles the code and is able to execute it and whether the
code editor (IDE, Integrated Development Environment) starts the right processes
to get the code compiled and executed. Oh right we were talking about CLAuDE,
ahem.

Every project must have its beginning. And with CLAuDE I made the decision to
start explaining the Control Panel first. This is to get you familiar with
notation and to lay down some basics. To do that we start with the fixed part of
the Control Panel, the physical constants. Many things vary from planet to
planet, how much radiation they receive from their star, how strong their
gravity is, how fast they spin around their axis and many many more. What does
not change are the physical constants, well because they are constant. The
Stefan-Boltzmann constant for instance does not change. Whether you are on
Earth, in space or on Jupiter, the value of the Stefan-Boltzmann constant will
remain the same.

The Stefan-Boltzmann constant is denoted by $\sigma$ and has a value of
$5.670373 \cdot 10^-8$ (\si{Wm^{-2}K^{-4}}) \cite{stefan-boltzmann}. The
$\sigma$ is a greek letter called sigma. Greek letters are often used in
mathematics, as well as in physics or any other discipline that relies on maths
(spoiler alert, quite a lot). Treat it like a normal letter in maths,
representing a number that you either do not know yet or is too long or
cumbersome to write down every time. The Stefan-Boltzmann constant is denoted in
scientific notation, a number followed by the order of magnitude. It is denoted
as a multiplication, because that is what you have to do to get the real number.
An example: $4.3 \cdot 10^2 = 430$ and $4.3 \cdot 10^{-2} = 0.043$. The letters
behind the numbers are units, how we give meaning to the numbers. If I say that
I am $1.67$ does not mean anything. Do I mean inches, centimeters, meters,
miles? That is why we need units as they give meaning to the number. They tell
us whether the number is talking about speed, distance, time, energy and many
other things. In this manual we will use SI units. Behind all the letters you
will find the following: [number]. This is a citation, a reference to an
external source where you can check whether I can still read. If I pull a value
out somewhere I will insert a citation to show that I am not making these
numbers up. This is what scientists use to back up their claims if they do not
want to redo the work that others have done. I mean what is the point of
re-inventing the wheel if there is a tyre company next door? That is why
scientists citate.

So with that out of the way, let us write down some constants. Why do I do this
here? Because a lot of constants are used everywhere and I am too lazy to
replicate them every time. If you see a letter or symbol that is not explicitly
explained, then it is most likely a constant that we discuss here in the control
panel.

\subsection{Physical Constants}
As mentioned before, physical constants do not change based on where you are in
the universe. Below you will find an overview of all the relevant constants
together with their units. As well as a short explanation where they are used or
what they represent. To see them in action, consult the other sections of this
manual, you will find them in equations all throughout this document.

\subsubsection{The Gas Constant} \label{sec:gas constant}
The Gas constant, $R = 8.3144621$ (\si{JK^{-1}mol^{-1}}) \cite{idealGas} is the
constant used to relate the temperature of the gas to the pressure and the
volume. One would expect this constant to be different per gas, but under high
enough temperatures and low enough pressure the gas constant is the same for all
gases.

\subsubsection{The Specific Heat Capacity}
The specific heat capacity $c$ depicts how much energy is required to heat the
object by one degree Kelvin per unit mass (\si{Jkg^{-1}K^{-1}})
\cite{specificHeat}. This varies per material and is usually indicated by a
subscript. The specific heat capacity for water for instance is $c_w = 4190$
\si{Jkg^{-1}K^{-1}}. Specific heat capacities also exist in the form of
\si{Jkg^{-1}K^{-1}}, \si{Jmol^{-1}K^{-1}} and \si{Jcm^{-3}K^{-1}} which you can
use in various circumstances, depending on what information you have.

\subsubsection{Mole}
Mole is the amount of particles ($6.02214076 \cdot 10^{23}$) in a substance,
where the average weight of one mole of particles in grams is about the same as
the weight of one particle in atomic mass units (\si{u})\cite{mole}. This is not
a physical constant perse, but more like a unit (\si{mol}). Though it is still
important enough to be added here for future reference. All other units are
way more intuitive and are assumed to be known.

\subsubsection{The Stefan-Boltzmann Constant}
The Stefan-Boltzmann constant, $\sigma = 5.670373 \cdot 10^-8$
\si{Wm^{-2}K^{-4})} \cite{stefan-boltzmann} is used in the Stefan-Boltzmann law
(more on that in \Cref{sec:first thermolaw}).

\subsection{Planet Specific Variables}
The following set of variables vary per planet, that's why we call them
variables since they vary. Makes sense right? We add them here as we will use
them throughout the manual. The advantage of that is quite significant. If you
want to test things for a different planet, you only need to change the values
in one place, instead of all places where you use it. If there is one thing
that we computer scientists hate is doing work, we like being lazy and defining
things in one place means that we can be lazy if we need to change it. So we put
in the extra work now, so we do not have to do the extra work in the future.
That's actually a quite accurate description of computer scientists, doing hard
work so that they can be lazy in the future.

\subsubsection{The Passage of Time}
On Earth we have various indications of how much time has passed. While most of
them remain the same throughout the universe, like seconds, minutes and hours,
others vary throughout the universe, like days, months and years. Here we
specify how long the variable quantities of time are for the planet we want to
consider as they are used in the code. When using these variables in equations,
the variables are (by the compiler/interpreter) substituted with their
respective values. So if somewhere in the manual you see an equation with
\texttt{day} in it, we actually need the value of \texttt{day} to take its
place, but write \texttt{day} so that if we need to change the value we only
need to change it in one place. We use the equality symbol ($=$) to check if two
variables/numbers are equal and the leftarrow $\leftarrow$ to assign a value
(right hand side of the arrow) to a variable (left hand side of the arrow). This
way there can never be any confusion about whether we mean being equal or
setting a value (making it equal) when using the equality symbol ($=$). The star
(*) symbol means multiplication, whereas the dot ($\cdot$) is used to indicate
the inner product (also known as dot product) between two vectors.

The different quantities of time that we need are shown in \Cref{cp:time}.
\Cref{cp:day} defines the length of one day in seconds (\si{s}).
\Cref{cp:year} assigns the length of one year in seconds (\si{s}).
\Cref{cp:delta t} is how much time is between each calculation run in seconds
(\si{s}).

\begin{equ}[!htb]
    \begin{subequations}
        \label{cp:time}
        \begin{equation}
            \label{cp:day}
            \texttt{day} \is 60 * 60 * 24
        \end{equation}
        \begin{equation}
            \label{cp:year}
            \texttt{year} \is 365 * \texttt{day}
        \end{equation}
        \begin{equation}
            \label{cp:delta t}
            \delta \texttt{t} \is 60 * 9
        \end{equation}
    \end{subequations}
    \caption{Variable assignments with regard to time}
\end{equ}

\subsubsection{The Planet Passport}
Each planet is different, so why should they all have the same gravity? Oh wait,
they don't. Just as they are not all the same size, tilted as much and their
atmospheres differ. So here we define all the relevant variables that are unique
to a planet, or well not necessarily unique but you get the idea. Remember how
we discussed specific heat capacities before and talk about them here again?
Yeah, the specific heat capacity for the Earth's atmosphere is set in stone,
however the specific heat capacity of another planet's atmosphere might be
completely different. Therefore I decided to add them here. So they are
constants, but differ per planet.

The values and variables that define a planet can be found in
\Cref{cp:planet}. \Cref{cp:gravity} deals with the magnitude of gravity on
the planet in \si{ms^{-2}}. \Cref{cp:axial tilt} describes the angle between
the orbital axis and the rotational axis \cite{axialTilt} in degrees.
\Cref{cp:top} indicates how high the top of the atmosphere is with respect to
the planet surface in meters (\si{m}). \Cref{cp:ins} stores the amount of
energy from the star that reaches the planet per unit area (\si{Jm^{-2}}).
\Cref{cp:absorp} is the absorbtivity of the atmosphere, the fraction of how
much of the total energy that enters the atmosphere is absorbed (unitless).
\Cref{cp:radius} tells us the radius of the planet in meters (\si{m}).
\texttt{R} is a captial as the non-captilised version (\texttt{r}) is used to
indicate the radius of any object, whereas the capital is used to indicate the
radius of celestial bodies, which planets are. \Cref{cp:pressureLevels} is an
array that stores the pressure of the different levels in pascals (\si{Pa}).
\Cref{cp:heatCapacityAtmos} states the specific heat capacity of the
atmosphere in \si{Jkg^{-1}K^{-1}}. \Cref{cp:heatCapacityPlanet} describes the
specific heat capacity of the planet in \si{Jkg^{-1}K^{-1}}.

\begin{equ}[!htb]
    \begin{subequations}
        \label{cp:planet}
        \begin{equation}
            \label{cp:gravity}
            \texttt{g} \is 9.81
        \end{equation}
        \begin{equation}
            \label{cp:axial tilt}
            \alpha \is -23.5
        \end{equation}
        \begin{equation}
            \label{cp:top}
            \texttt{top} \is 50 * 10^3
        \end{equation}
        \begin{equation}
            \label{cp:ins}
            \texttt{insulation} \is 1370
        \end{equation}
        \begin{equation}
            \label{cp:absorp}
            \epsilon \is 0.75
        \end{equation}
        \begin{equation}
            \label{cp:radius}
            \texttt{R} \is 6.4 * 10^6
        \end{equation}
        \begin{multline}
            \label{cp:pressureLevels}
            \texttt{pressure} \is [100000, 95000, 90000, 80000, 70000, 60000,
                                    50000, 40000, 35000, 30000, \\
                                    25000, 20000, 15000, 10000, 7500, 5000,
                                    2500, 1000, 500, 200, 100]
        \end{multline}
        \begin{equation}
            \label{cp:heatCapacityAtmos}
            C_a \is 287
        \end{equation}
        \begin{equation}
            \label{cp:heatCapacityPlanet}
            C_p \is 1 * 10^6
        \end{equation}
    \end{subequations}
    \caption{Variable assignments for planet specific constants}
\end{equ}

\subsubsection{Model Specific Parameters}
These parameters cannot be found in the wild, they only exist within our
model. They control things like the size of a cell on the latitude longitude
grid (more on that in later sections), how much time the model gets to spin up.
We need the model to spin up in order to avoid numerical instability. Numerical
instability occurs when you first run the model. This is due to the nature of
the equations. Nearly all equations are continuous, which means that they are
always at work. However when you start the model, the equations were not at work
yet. It is as if you suddenly give a random meteor an atmosphere, place it in
orbit around a star and don't touch it for a bit. You will see that the whole
system oscilates wildly as it adjusts to the sudden changes and eventually it
will stabilise. We define the amount of time it needs to stabilise as the spin
up time. All definitions can be found in \Cref{cp:model}.
\Cref{cp:resolution} defines the number of degrees on the latitude longitude
grid that each cell has, with this setting each cell is 3 degrees latitude high
and 3 degrees longitude wide. \Cref{cp:atmosLevels} is the amount of layers
in the atmosphere, determined by the pressure levels array.
\Cref{cp:spinupCalctime} describes the time between calculation rounds during
the spin up period in seconds (\si{s}). \Cref{cp:spinuptime} shows us how
long we let the planet spin up in seconds (\si{s}). \Cref{cp:smoothEnable}
is whether we want to enable smoothing using Fast Fourier Transforms (FFTs) or
not, see \Cref{sec:3dsmooth}. \Cref{cp:smoothT} is the smoothing parameter
for the temperature. \Cref{cp:smoothU} describes the smoothing parameter for
the $u$ component of the velocity, see \Cref{sec:velocity}.
\Cref{cp:smoothV} shows us the smoothing parameter for the $v$ component of
the velocity, see \Cref{sec:velocity}. \Cref{cp:smoothW} talks about the
smoothing parameter for the $w$ component of the velocity, see
\Cref{sec:velocity}. \Cref{cp:smoothAdd} is the smoothing parameter for
the change in potential temperature, see \Cref{sec:thermal pot}.
\Cref{cp:save} is used to determine whether we want to enable saving the
model state to a file for later use. \Cref{cp:load} is used to enable loading
the model state from a file and to skip the spin up time. \Cref{cp:saveFreq}
determines how often we save the model state, after how many iterations we save.
\Cref{cp:poleLowLatLimit} is the polar plane approximation lower grid limit,
how far north the polar plane data is calculated from the south pole. This is
mirrored to the north pole as well. \Cref{cp:poleHighLatLimit} defines the
polar plane approximation upper grid limit, how far south the data from the
latitude longitude grid is calculated. This is mirrored to the north pole as
well. \Cref{cp:spongeLayer} is the pressure at which the equations of motion
stop being applied (to absorb upwelling atmospheric waves) in \si{Pa}.

\begin{equ}[!htbp]
    \begin{subequations}
        \label{cp:model}
        \begin{equation}
            \label{cp:resolution}
            \texttt{resolution} \is 3
        \end{equation}
        \begin{equation}
            \label{cp:atmosLevels}
            \texttt{layerCount} \is \texttt{pressure}.length
        \end{equation}
        \begin{equation}
            \label{cp:spinupCalctime}
            \delta \texttt{t}_{\texttt{s}} \leftarrow 60 * 17.2
        \end{equation}
        \begin{equation}
            \label{cp:spinuptime}
            \texttt{t}_{\texttt{s}} \leftarrow 5 * \texttt{day}
        \end{equation}
        \begin{equation}
            \label{cp:smoothEnable}
            \texttt{smoothing} \is \F
        \end{equation}
        \begin{equation}
            \label{cp:smoothT}
            \texttt{smooth}_{\texttt{t}} \is 1
        \end{equation}
        \begin{equation}
            \label{cp:smoothU}
            \texttt{smooth}_{\texttt{u}} \is 0.9
        \end{equation}
        \begin{equation}
            \label{cp:smoothV}
            \texttt{smooth}_{\texttt{v}} \is 0.9
        \end{equation}
        \begin{equation}
            \label{cp:smoothW}
            \texttt{smooth}_{\texttt{w}} \is 0.3
        \end{equation}
        \begin{equation}
            \label{cp:smoothAdd}
            \texttt{smooth}_{\texttt{add}} \is 0.3
        \end{equation}
        \begin{equation}
            \label{cp:save}
            \texttt{save} \is \F
        \end{equation}
        \begin{equation}
            \label{cp:load}
            \texttt{load} \is \F
        \end{equation}
        \begin{equation}
            \label{cp:saveFreq}
            \texttt{saveFrequency} \is 100
        \end{equation}
        \begin{equation}
            \label{cp:poleLowLatLimit}
            \texttt{poleLowerLatLimit} \is -75
        \end{equation}
        \begin{equation}
            \label{cp:poleHighLatLimit}
            \texttt{poleHigherLatLimit} \is -85
        \end{equation}
        \begin{equation}
            \label{cp:spongeLayer}
            \texttt{spongeLayer} \is 1000
        \end{equation}
    \end{subequations}
    \caption{Variable assignments for model specific parameters}
\end{equ}

%Move to initial setup $\delta y \leftarrow \frac{2\pi r}{nlat}$ \Comment*[l]{How far apart the gridpoints in the y direction are (degrees latitude)}
%Move to initial setup $\alpha_a \leftarrow 2 \cdot 10^{-5}$ \Comment*[l]{The diffusivity constant for the atmosphere}
%Move to initial setup $\alpha_p \leftarrow 1.5 \cdot 10^{-6}$ \Comment*[l]{The diffusivity constant for the planet surface}

% \begin{algorithm}
%     \caption{Defining the paramters that only apply to the model}
%     \label{alg:model constants}
%     \SetKwComment{Comment}{//}{}

%     $count \leftarrow 0$ \; %And this is..?
%     \For{$j \in [0, top]$}{
%         $heights[j] \leftarrow count$ \Comment*[l]{The height of a layer (\si{m})}
%         $count \leftarrow count + \frac{top}{nlevels}$ \;
%     }

%     \For{$i \in [0, nlat]$}{
%         $\delta x[i] \leftarrow \delta y\cos(lat[i]\frac{\pi}{180})$ \Comment*[l]{How far apart the gridpoints in the x direction are (degrees longitude)}
%     }

%     \For{$k \in [0, nlevels - 1]$}{
%         $\delta z[k] \leftarrow p_z[k + 1] - p_z[k]$ \Comment*[l]{How far apart the gridpoints in the z direction are (\si{Pa})}
%     }

%     $\Pi \leftarrow$ Array with the same amount of elements as $p_z$ \Comment*[l]{Dimensionless pressure that is used to easily convert from potential temperature to absolute temperature and
%     vice versa}
%     $\kappa \leftarrow \frac{R}{C_p}$ \;
%     \For{$i \leftarrow 0$ \KwTo $\Pi.length$}{
%         $\Pi[i] \leftarrow C_p(\frac{p_z[i]}{p_z[0]})^{\kappa}$ \;
%     }
% \end{algorithm}


\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{geometry}
\usepackage{enumerate}
\usepackage{natbib}
\usepackage{float}%稳定图片位置
\usepackage{graphicx,subfig}%画图
\usepackage{caption}
\usepackage[english]{babel}
\usepackage{indentfirst}%缩进
\usepackage{enumerate}%加序号
\usepackage{multirow}%合并行
\usepackage{hyperref}
\usepackage{tikz}
\hypersetup{hypertex=true, colorlinks=true, linkcolor=black, anchorcolor=black, citecolor=black}
\title{\Large \textbf{VG441 Problem Set 2}\\
\author{\textbf{Pan, Chongdan ID:516370910121}\\
}
}
\begin{document}
\maketitle
\section{Problem 1}
\quad
Let one day be the unit time, then we get $\lambda=500,K=2250,h=\frac{1}{1460}$
\\\[c=\begin{cases}
    1490 & Q<1200\\
    1220 & 1200\leq Q<2400\\
    1100 & Q\geq 2400
\end{cases}\]
\\When we apply the all-units discount structure:
\\$Q_0^*=\sqrt{\frac{2K\lambda}{hc_0}}=\sqrt{\frac{2\times2250\times500\times1460}{1490}}\approx1484.8$
\\$Q_1^*=\sqrt{\frac{2K\lambda}{hc_1}}=\sqrt{\frac{2\times2250\times500\times1460}{1220}}\approx1640.9$
\\$Q_2^*=\sqrt{\frac{2K\lambda}{hc_2}}=\sqrt{\frac{2\times2250\times500\times1460}{1100}}\approx1728.1$
\\\\Only $Q_0^*$ and $Q_1^*$ are realizable
\\$g_1(Q_1)=500\times1200+\sqrt{2\times2250\times500\times\frac{1}{1460}\times1200}\approx611371.2$
\\\\For the breakpoints
\\$g_1(1200)=500\times1220+\frac{2250\times500}{1200}+\frac{1220\times1200}{2\times1460}\approx611438.9$
\\$g_2(2400)=500\times1100+\frac{2250\times500}{2400}+\frac{1100\times2400}{2\times1460}\approx551372.9$
\\Therefore, it's the optimal order quantity is $Q=2400$ ton, which incurs a purchase cost of 1100\$ and the daily cost is 551372.9\$
\\\\When we apply the incremental discount structure:
\\$\bar{c_1}=1490\times1200-1220\times1200=324000$
\\$\bar{c_2}=1490\times1200+1220\times1200-1100\times2400=612000$
\\$Q_0^*=\sqrt{\frac{2\times2250\times500\times1460}{1490}}=1484.8$
\\$Q_1^*=\sqrt{\frac{2\times(2250+324000)\times500\times1460}{1220}}=19759.3$
\\$Q_2^*=\sqrt{\frac{2\times(2250+612000)\times500\times1460}{1100}}=28553.1$
\\\\Only $Q_2^*$ are realizable
\\$g_2(28553.1)=500\times1100+\frac{612000}{2\times1460}+\sqrt{2\times500\times(2250+612000)\times1100\times\frac{1}{1460}}=571722.2$
\\Therefore, it's the optimal order quantity is $Q=28553.1$ ton, which incurs the daily cost 571722.2\$
\section{Problem 2}
$T=52,K=1100,c=2.4$
\begin{figure}[H]
    \centering
    \includegraphics[scale=0.2]{P1.png}
    \caption{Plot of Result}
    \label{P1}
\end{figure}
According to MILP Model computed by guroby package in python, the objective $\sum_{t=1}^T(Ky_t+hx_t)$ is 42583\$, \ref{P1} shows demand, optimal order quantity and corresponding inventory level.
\section{Problem 3}
\textbf{Task 1}
\begin{enumerate}
    \item First, we pick the Path:$s\rightarrow b\rightarrow t$
    \begin{figure}[H]
        \centering
        \includegraphics[scale=0.25]{P2.png}
        \caption{Flow Graph of Step 1}
    \end{figure}
    \begin{figure}[H]
        \centering
        \includegraphics[scale=0.25]{P3.png}
        \caption{Residual Graph of Step 1}
    \end{figure}
    \item Second, we pick the Path:$s\rightarrow a\rightarrow t$
    \begin{figure}[H]
        \centering
        \includegraphics[scale=0.25]{P4.png}
        \caption{Flow Graph of Step 2}
    \end{figure}
    \begin{figure}[H]
        \centering
        \includegraphics[scale=0.25]{P5.png}
        \caption{Residual Graph of Step 2}
    \end{figure}
    Since there is no more path $p\rightarrow t$, the max flow is 5
\end{enumerate}
\textbf{Task 2}
Yes, because by looking the original graph intuitively, we can easily find the max flow is 2000, and the algorithm only needs to take two steps if it prefers $s\rightarrow a\rightarrow t$ and $s\rightarrow b\rightarrow t$
\begin{figure}[H]
    \centering
    \includegraphics[scale=0.25]{P6.png}
    \caption{Intuitive Path}
\end{figure}
However, if the algorithm prefers $E_{ab}$, the first path will either be $s\rightarrow a\rightarrow t$ or $s\rightarrow b\rightarrow t$ with flow 1.
\begin{figure}[H]
    \centering
    \includegraphics[scale=0.25]{P7.png}
    \caption{Flow Graph of Step 1}
\end{figure}
\begin{figure}[H]
    \centering
    \includegraphics[scale=0.25]{P8.png}
    \caption{Residual Graph of Step 1}
\end{figure}
Then, according to the perference and residual graph, the next path will be the opposite one, but still with flow 1. Therefore, it takes 2000 steps for the algorithm to find the max flow. So the perference to $E{ab}$ will lead to more steps for the algorithm.
\section*{Python Code}
\begin{verbatim}
import numpy as np
import pandas as pd
from gurobipy import *
import matplotlib.pyplot as plt

df = pd.DataFrame(pd.read_csv(r"D:\PANDA\Study\VG441\Homework\Problem Set 2\demand.csv"))
d = df.d_t.T
T, K, h = 52, 1100, 2.4
M = 10e5
# 导入数据
WW = Model()
q = WW.addVars(T, lb=np.zeros(T), vtype=GRB.CONTINUOUS, name="order_quantity")
x = WW.addVars(T, lb=np.zeros(T), vtype=GRB.CONTINUOUS, name="inventory_level")
y = WW.addVars(T, vtype=GRB.BINARY, name="if_order")

WW.setObjective(quicksum(K*y[t]+h*x[t] for t in range(T)), GRB.MINIMIZE)

c1 = WW.addConstrs(q[t] <= M*y[t] for t in range(T))
c2 = WW.addConstrs(x[t] == x[t-1] + q[t] - d[t] for t in range(1,T))
c3 = WW.addConstr(x[0] == q[0] - d[0])
WW.optimize()
# WW.printAttr('X')
print(WW.getAttr('X',q).values())

t=np.linspace(0,T-1,T)
X=[234.9999999999999, 122.99999999999835, 0.0, 297.0, 150.0, 0.0, 174.0, 0.0, 197.0, 0.0, 206.99999999999997, 0.0, 240.00000000000006, 0.0, 241.0000000000011, 0.0, 267.0, 0.0, 289.9999999999999, 0.0, 301.0, 1.4203321069368455e-12, 324.9999999999985, 0.0, 343.0000000000001, 0.0, 340.0, 0.0, 323.0, 0.0, 309.0, 0.0, 293.0, 0.0, 272.9999999999999, 0.0, 248.99999999999994, 0.0, 234.99999999999994, 0.0, 204.0, 0.0, 182.99999999999994, 0.0, 163.99999999999994, 0.0, 299.0, 145.0, 0.0, 224.0, 112.0, 0.0]

Q=[342.9999999999999, 0.0, 1.2505552149377763e-12, 426.0000000000004, 0.0, 0.0, 330.0, 0.0, 386.0, 0.0, 409.0, 0.0, 468.00000000000006, 0.0, 483.00000000000216, 0.0, 533.0, 0.0, 559.9999999999999, 0.0, 604.0, 1.4203321069368455e-12, 653.9999999999972, 1.553065288008162e-12, 688.0000000000001, 0.0, 707.0, 0.0, 660.0, 0.0, 634.0, 0.0, 598.0, 0.0, 545.9999999999999, 0.0, 500.99999999999994, 0.0, 477.99999999999994, 0.0, 430.0, 0.0, 386.99999999999994, 0.0, 338.99999999999994, 0.0, 461.0, 0.0, 0.0, 361.0, 0.0, 0.0]
plt.plot(t,X,color='blue',label='Inventory Level')
plt.plot(t,Q,color='red',label='Order Quantity')
plt.plot(t,d,color='green',label='Demand')
plt.legend(loc='upper left', fontsize=10)
plt.show()
\end{verbatim}
\end{document}


\documentclass[12pt]{article}

\usepackage{setspace}

\usepackage{amsmath, amsfonts, amssymb, graphicx, color, fancyhdr, lipsum, scalerel, stackengine, mathrsfs, tikz-cd, mdframed, enumitem, framed, adjustbox, bm, upgreek, xcolor, hyperref}
\usepackage[framed,thmmarks]{ntheorem}
\usepackage[style=alphabetic]{biblatex}
%Set the bibliography file
\bibliography{sources}

%Replacement for the old geometry package
\usepackage{fullpage}

%Input my definitions
\input{./mydefs.tex}

%Shade definitions
\theoremindent0cm
\theoremheaderfont{\normalfont\bfseries}
\def\theoremframecommand{\colorbox[rgb]{0.9,1,.8}}
\newshadedtheorem{defn}[thm]{Definition}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%% Customize Below %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%header stuff
\setlength{\headsep}{24pt}  % space between header and text
\pagestyle{fancy}     % set pagestyle for document
\lhead{Notes on Local Duality} % put text in header (left side)
\rhead{Nico Courts} % put text in header (right side)
\cfoot{\itshape p. \thepage}
\setlength{\headheight}{15pt}
\allowdisplaybreaks

% Document-Specific Macros
% Primes and Maximals for the lazy person.
\newcommand{\p}{\frakp}
\newcommand{\m}{\frakm}

\begin{document}
%make the title page
\title{Local Duality Theorems \vspace{-1ex}}
\author{Nico Courts}
\date{Summer 2019}
\maketitle

\renewcommand{\abstractname}{Introduction}
\begin{abstract}
	These notes are my attempt to understand the current state of the art in ``local duality'' theorems, especially
	of the kind investigated by Benson, Iyengar, Krause, and Pevtsova (herein abbreviated BKIP) in \cite{BIKPgroupschemes} and \cite{BKIPgorenstein}.

	Furthermore I will continue my investigation into quantum groups and other Hopf algebras and see if some of the methods developed earlier
	can be applied to this new area.
\end{abstract}

\section{Current State of the Art}
\subsection{Ideas to flush out}
From meeting with Julia, the idea that I have gathered is that these two papers constitute two (slightly) different approaches
to showing that the notion of Serre duality (which by itself is a ``global'' phenomenon) restricts ($\frakp$)-locally (more on this later)
to an analogous result.

The original result in \cite{BIKPgroupschemes} proves that such a duality exists for finite group schemes, but the objects of study here are
much simpler (for instance the algebras that arise are Frobenius). Furthermore (this part may be sketchy), the results that are proven
rely on the (relatively simple) monoidal structure of $G$-modules (where $G$ is a finite group scheme).

The newer result in \cite{BKIPgorenstein} reconstructs this result in the context of Gorenstein rings, which are decidedly less degenerate than
the case of finite group schemes. What is important here is that this is done although the structure theory of these algebras
is rather poorly understood, so what this represents is the formation of the idea that this duality somehow can be understood at
a higher level, meaning that it may apply to broader classes of algebras.

\subsection{Background results and definitions}
I have seen a good deal of these results already, but it will be useful to put everything into one place so I can reference them as needed.

First, Serre duality, which comes from \cite{hartshorneAG}:
\begin{thm}[Serre Duality]\label{thm-serre-duality}
	Let $XS$ be a projective Cohen-Macaulay scheme of equidimension $n$ over $k$. Then for any locally free sheaf $\scrF$ on $X$,
	there are natural isomorphisms
	\[H^i(X,\scrF)\cong H^{n-i}(X,\scrF^\vee\otimes \omega_X^\circ)'\]
	where $(-)'$ indicates taking a vector space dual, $(-)^\vee$ indicates taking the dual of a locally free sheaf via the functor
	$\mathscr Hom(-,\calO_X)$ (sheaf hom) and $\omega_X^\circ$ denotes a dualizing sheaf (\ref{defn-dualizing-sheaf}) on $X$.
\end{thm}

\begin{defn}\label{defn-dualizing-sheaf}
	Let $X$ be a proper scheme of dimension $n$. Recall that a \textbf{dualizing sheaf} is a (coherent) sheaf $\omega_X^\circ$ such that there is an isomorphism
	\[\Hom(\scrF,\omega_X^\circ)\cong H^n(X,\scrF)'.\]
\end{defn}
\begin{rmk}
	In fact, there is something more: that this isomorphism is induced from a natural pairing of $\Hom$ and $H^n$. I won't worry
	about this too much for now, but it can be found in \cite[p. 240]{hartshorneAG}
\end{rmk}

I will also include the definition and explanation of compact generation that I wrote down for my Brown representability presentation.
\begin{defn}[Compact Object]\label{defn-compact-obj}
	Let $X\in\calT$ be an object in a triangulated category. Then $X$ is called \textbf{compact} if for every coproduct of objects in $\calT$
	\[\Hom_\calT\left(X,\coprod_{\lambda\in\Lambda}t_\lambda\right)=\coprod_{\lambda\in\Lambda}\Hom_\calT(X,t_\lambda)\]
\end{defn}
\begin{rmk}
	The idea here is that when the codomain is a product, this equality always exists. The projections give you
	a product of maps into the factors and the universal property of products gives you a (unique!) map into the product if you
	have maps into each of the factors.

	This does not hold in general for coproducts, however! Recall that in additive categories
	one has a canonical isomorphism between finite products and coproducts. Since triangulated
	categories are additive, this is akin to saying that $X$ is well-behaved in that the maps
	from $X$ still split even when the codomain is an arbitrarily large coproduct.
\end{rmk}
\begin{defn}[Compactly Generated Triangulated Category]\label{defn-compact-tricat}
	Let $\calT$ be a triangulated category. Then $\calT$ is called \textbf{compactly generated by a set $G$} of its elements
	if $\calT$ is closed under small coproducts and $G$ consists of compact objects of $\calT$ such that for all $X\in\calT$,
	\[\Hom_\calT(G,X)=0\quad\Rightarrow\quad X=0.\]
\end{defn}
\begin{rmk}
	Here the generators of $\calT$ are elements that have ``sufficient complexity'' to detect all nonzero elements.

	In the more general context where $\calT$ is not necessarily additive, we can generalize this definition to a set of objects
	such that for every generator $E\in G$ and any $X,Y\in\calC$, if for every $f,g\in\Hom(X,Y)$ and $h\in\Hom(E,X)$ we have
	\[f\circ e=g\circ e\]
	then
	\[f=g\]
	and here we would say that $G$ has ``sufficient complexity'' to differentiate between any two non-identical maps.
\end{rmk}

\begin{defn}\label{defn-R-linear-cat}
	Recall that with such an $R$, an \textbf{$R$-linear category} $\calC$ is one such that the graded ring $\End^\ast_\calC(X)$ admits
	an $R$ module structure via a graded ring homomorphism $\varphi_X:R\to \End^\ast_\calC(X)$.
\end{defn}

The following comes from \cite{nlab-serre-functor}.
\begin{defn}\label{defn-serre-func}
	Let $\calS$ be an endofunctor $\calS:\calA\to\calA$ on a $k$-linear category with finite dimensional $\Hom$ objects,
	where $k$ is any field. Then $\calS$ is called a \textbf{Serre functor} if it is an additive equivalence admitting
	bi-functorial isomorphisms
	\[\phi_{A,B}:\Hom_\calA(A,B)\xrightarrow{\sim}\Hom_\calA(B,\calS(A))^\ast\]
	for all $A$ and $B$ in $\calA$.
\end{defn}

\subsection{BKIP Paper 1---Finite Group Schemes}
Let's start off with the primary result. We will need some definitions and other results to get us there, but it will give us a sense of
where we're headed.
\subsubsection{Main Results}
\begin{thm}[BKIP `18]\label{thm-BKIP18}
	Let $G$ be a finite group scheme over $k$. Fix some homogeneous prime ideal $\frakp\lhd H^\ast(G,k)$ not containing $H^{\ge 1}(G,k)$. Let $C=\gamma_\frakp(\stmod G)$
	and let $d$ be the Krull dimension of $H^\ast(G,k)/\frakp$. Then the assignment
	\[M\mapsto \Omega^d\delta_G\otimes_k M\]
	induces a Serre functor (defn~\ref{defn-serre-func}) for $C$. Thus for all $M$ and $N$ in $C$,
	\[\Hom_{H^\ast(G,k)}(\Hom_C^\ast(M,N),I(\frakp))\cong\Hom_C(N,\Omega^d\delta_G\otimes M)\]
	where $I(\frakp)$ is the injective hull of the graded $H^\ast(G,k)$ module $H^\ast(G,k)/\frakp$.
\end{thm}

\noindent This result follows from a more general result:
\begin{thm}[BKIP `18]\label{thm-BKIP18-ext}
	For any $G$ module $M$ and $I\in\bbZ$, there is a natural isomorphism
	\[\widehat{\Ext}^i_G(M,\Gamma_\frakp(\delta_G))\cong\Hom_{H^\ast(G,k)}(H^{\ast-d-i}(G,M),I(\frakp)).\]
\end{thm}
\begin{rmk}
	Notice that here $\Gamma_\frakp(\delta_G)$ plays the part of the dualizing object in the second theorem, as Serre duality takes
	on a similar form when $\scrF$ is a coherent sheaf on a nonsingular projective variety $X$ of dimension $n$:
	\[\Ext_X^i(\scrF,\omega_X)\cong \Hom_k(H^{n-i}(X,\scrF),k)\]
\end{rmk}

\subsubsection{Conventions}

Throughout we are fixing $R$, a \textbf{graded commutative, Noetherian} ring and $\calT$, a \textbf{compactly-generated (\ref{defn-compact-obj}, \ref{defn-compact-tricat})
$R$-linear (\ref{defn-R-linear-cat}) triangulated category.} Let $\calT^c$ be the full subcategory of $\calT$ comprising of compact objects.

\subsubsection{Torsion and Localization}
We should brush up on a bit of how torsion and localization from rings passes to such a $\calT$: We say that $M\in \Rmod$ is \textbf{$\fraka$-torsion} if
$M_\frakq=0$ whenever $\fraka\not\subseteq\frakq$. In other words, whenever we invert something in $\fraka$, we kill everything. Analogously,
we say that $X\in\calT$ is $\fraka$-torsion if $\Hom^\ast_\calT(C,X)$ is $\fraka$-torsion for all $C\in\calT^c$.

Now if $\p$ is a (homogeneous!) prime in $R$,  we say that $M\in \Rmod$ is $\p$-local if the localization map $M\mapsto M_\frakp$ is invertible.
This means that ``all of the action is at $\p$'' -- recall that in the case of rings, this would mean that $\frakp$ is maximal and contains all non-units,
so $R$ is local. We say that $X\in\calT$ is $\p$-local if $\Hom^\ast_\calT(C,X)$ is $\p$-local for all $C\in\calT^c$.

We will be devoting significant attention to $\Gamma_\p(\calT)$, the (full, localizing) subcategory of $\calT$ consisting
of the $\p$-local $\p$-torsion elements. As far as I can tell, we should be thinking of $R/\p^i$ as an analogy in $\Rmod$.

One of the primary functors in question (the one that extracts the ``local'' nature) is $\Gamma_\p$, which assigns to $\calT$ the
set (actually it's a localizing subcategory in $\calT$)
\[\Gamma_\p(\calT)=\{X\in\calT| X\text{is $\p$-local and $\p$-torsion\}}.\]

The paper points this out as an important result:
\begin{lem}
	$\Gamma_\p(\StMod G)$ is finitely generated as a triangulated category by the family of objects $(M//\p)_\p$.
\end{lem}
Here $M//\p$ is defined as $M//p_1\otimes\cdots\otimes M//p_k$ where $p_1,\dots,p_k$ generate $\p$ and $M//a$ is defined to
be the mapping cone of the map $f_a:k\to \Omega^{-d}k$ that comes from the element $a\in H^d(G,k)$.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%  Bibliography %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\medskip

\printbibliography

\end{document}