\documentclass[a4paper]{article}

\def\npart{III}

\def\ntitle{Complex Dynamics}
\def\nlecturer{H.\ Krieger}

\def\nterm{Lent}
\def\nyear{2020}

\input{header}

\newcommand{\D}{\mathbb{D}}

\begin{document}

\input{titlepage}

\tableofcontents

\setcounter{section}{-1}

\section{Introduction}

What is complex dynamics? Iteration of holomorphic self-maps of Riemann surfaces

long term behaviour under iteration

origin: iterative root finding algorithm, e.g. Newton's method. When and why does this work? Algebraically, the problem is to ask the convergence of the iteration of the map
\[
  f(z) = z - \frac{p(z)}{p'(z)}: \hat \C \to \hat \C
\]
where \(\hat \C\) is the Riemann sphere.

Goals:
\begin{itemize}
\item equidistribution theorem

  \begin{theorem}[Friere-Lopez-Mañe, 1983]
    Let \(f: \hat \C \to \hat \C\) with degree \(d \geq 2\) holomorphic.  Then there exists a unique \(f\)-invariant probability measure \(\mu_f\) supported on the unstable locus of \(f\), such that for almost all \(\alpha \in \hat \C\), \(\frac{1}{d^n} \sum_{f^n(z) = \alpha} \delta_z \to \mu_f\) in weak-* topology.
  \end{theorem}
\item universality of the Mandelbrot set: fix \(d \geq 2\), define for \(c \in \C\), \(f_c(z): z^d + c\). The \(d\)-Mandelbrot set is
  \[
    M_d = \{c \in \C: |f_c^n(0)| \nto \infty\}.
  \]

  \begin{theorem}[McMullen 1997]
    The Mandelbrot set is universal for bifurcations, i.e. in any bifurcation locus we see (slightly distorted) copics of some \(M_d\).
  \end{theorem}
\end{itemize}

\section{Riemann surfaces}

Recall at the end of IID Riemann Surfaces

\begin{theorem}[uniformisation]
  Every Riemann surface \(R\) is conformally isomorphic to \(\tilde R/G\) where \(\tilde R\) is one of the three simply connected Riemann surfaces (\(\hat \C, \C, \D\)) and \(G \subseteq \aut(\tilde R)\) acts freely and properly discontinuously.
\end{theorem}

Three cases:
\begin{enumerate}
\item \(\hat \C\): as \(\aut(\hat \C)\) are precisely the Möbius transformations and all Möbius transformations have fixed points, \(G = 1\) so \(R = \hat \C\).
\item \(\C\): \(\aut(\C) = \{p(z) = az + b, a \ne 0\}\) so \(G\) only contains translations, so can be identified by a subgroup of \(\C\). Can show that \(G\) is one of \(\{0\}, \Z \omega_1\) or \(\Lambda = \Z\omega_1 \oplus \Z\omega_2\), a lattice. Then \(R\) is one of \(\C, \C^*\) or \(\C/\Lambda\), a complex torus.
\item \(\D\): \(\aut(\D) = \{\lambda \cdot \frac{z - a}{1 - \conj a z}: \lambda \in S^1, a \in \D\}\), which has a lot of elements with no fixed point. This is called \emph{hyperbolic}.
\end{enumerate}

Recall \(\D\) is equipped with metric \(ds = \frac{2 |dz|}{1 - |z|^2}\), i.e.\ the distance between \(x, y \in \D\) is
\[
  \rho(x, y) = \inf_\gamma \int_a^b \frac{2 |\gamma'(t)|}{1 - |\gamma(t)|^2} dt
\]
where \(\gamma: [a, b] \to \D\) is a smooth curve from \(x\) to \(y\). One can use the origin to show that
\[
  \rho(x, y) = \frac{\log(1 + R)}{\log(1 - R)}
\]
where \(R = |\frac{y - x}{1 - \conj x y}|\). Elements of \(\aut(\D)\) are isometries of this metric so it descends to a hyperbolic metric on any hyperbolic Riemann surface, such that the covering map \(\tilde R \to R\) is a local isometry.

\begin{ex}
  Let \(R = \D/G\), \(f: R \to R\) holomorphic. Then \(f\) lifts to a holomorphic \(\tilde f: \D \to \D\), unique up to a composition with an element of \(G\), and induces a group homomorphism \(\gamma \mapsto \gamma'\) such that \(\tilde f \compose \gamma = \gamma' \compose \tilde f\).
\end{ex}

\begin{theorem}[Pick]
  Let \(f: S \to T\) be hyperbolic Riemann surfaces with Poincaré metric \(\rho_S, \rho_T\) respectively. Then for all \(x, y \in S\),
  \[
    \rho_T(f(x), f(y)) \leq \rho_S(x, y).
  \]
\end{theorem}

\begin{proof}
  By lifting (of \(f \compose \pi_S: \D \to T\)) it suffices to show this for \(S = T = \D\). By computation this is the same as showing
  \[
    \frac{\log (1 + R')}{\log (1 - R')} \leq \frac{\log (1 + R)}{\log (1 - R)}
  \]
  where \(R = |\frac{y - x}{1 - \overline y x}|, R' = |\frac{f(y) - f(x)}{1 - \overline{f(y)} f(x)}|\). Note \(\frac{\log (1 + x)}{\log (1 - x)}\) is strictly increasing, so suffices to show \(R' \leq R\). Let \(\mu_1(z) = \frac{y - z}{1 - \conj y z}, \mu_2(z) = \frac{f(y) - z}{1 - \conj{f(y)} z}\). Let \(g = \mu_2 \compose f \compose \mu_1^{-1}: \D \to \D\). By Schwarz's lemma \(|g(z)| \leq |z|\), i.e.\ \(|\mu_2(f(w))| \leq |\mu_1(w)|\), so \(R' \leq R\).
\end{proof}

\begin{remark}
  It follows from the ``strict inequality'' bit of Schwarz's lemma that exists \(x, y\) such that \(\rho_T(f(x), f(y)) = \rho_S(x, y)\) if and only if \(f\) lifts to a disk automorphism.
\end{remark}

\begin{eg}
  Contracting holomorphic maps is a very strong requirement. Compre to, for example, \(f(z) = z + 1\) on \(\hat \C\) (drawing of different behaviour on two hemispheres).
\end{eg}

Case of \(\hat \C\):

\begin{proposition}
  Let \(f: \hat \C \to \hat \C\) be a holomorphic nonconstant map. Then \(f\) is a rational map, i.e.\ exists \(a_1, \dots, a_m, b_1, \dots, b_n, c \in \C\) such that
  \[
    f(z) = c \cdot \frac{(z - a_1) \cdots (z- a_m)}{(z - b_1) \cdots (z- b_n)}.
  \]
\end{proposition}

\begin{proof}
  wlog \(f(\infty) \in \C\) (if not, replace with \(\frac{1}{f}\)). Then exist a finite collection \(f^{-1}(\infty) = \{b_1, \dots, b_n\} \subseteq \C\). About any \(b_i\) have locally
  \[
    f(z) = \sum_{j = -k}^\infty a_{ij} (z - b_i)^j.
  \]
  Set \(Q_i = \sum_{j = -k}^{-1} a_{ij} (z - b_i)^j\). Then \(g - f - Q_1 - \dots - Q_n\) has no pole so must be constant.
\end{proof}

Universal cover \(\C\): just a remark. Yes there are interesting dynamics. For example \(z \mapsto e^z\) belongs to the realm of transcendental dynamics. \(\C/\Lambda\) also admits nonconstant holomorphic maps. See example sheet 1.

\paragraph{stable and unstable locus}

Motivating example: \(z \mapsto z^2\) on \(\hat \C\). We can restrict \(f\) to the unit disk and we see \(f|_\D^n \to 0\) uniformly on compact subsets of \(\D\). Similarly on \(\hat \C \setminus \overline \D\), \(f|_{\hat \C \setminus \overline \D}^n \to \infty\). On the other hand for \(|z_0| = 1\), there is no neighbourhoood \(z_0 \in U\) such that \(f|_U^n(z)\) converging to a holomorphic function, as such a limit would have a discontinuity.

\begin{definition}[locally uniform convergence/divergence]\index{locally uniform convergence}\index{locally uniform divergence}
  Let \(S, T\) be metric spaces, \(f_n: S \to T\) a sequence of continuous maps. We say \((f_n)\) \emph{converges locally uniformly} if for all compact \(K \subseteq S\), for all \(\varepsilon > 0\) exists \(N \in \N\) such that for all \(m, n > N\), \(\sup_{x \in K} d_T(f_m(x), f_n(x)) < \varepsilon\).

  We say \((f_n)\) \emph{diverges locally uniformly} if for all compact \(K \subseteq S\) and all compact \(K' \subseteq T\), exists \(N \in \N\) such that for all \(n > N\), \(f_n(K) \cap K' = \emptyset\).
\end{definition}

Recall that if holomorphic \(f_n\)'s converge locally uniformly on \(S\) then it has a holomorphic limit function.

\begin{remark}
  If \(T\) is compact then we never have locally uniform divergence.
\end{remark}

\begin{definition}[normal family]\index{normal family}
  We say a family \(\mathcal F = \{f: S \to T\}\) of continuous functions is \emph{normal} if every sequence \((f_n) \subseteq \mathcal F\) has a subsequence which either converges locally uniformly or diverges locally uniformly.
\end{definition}

\begin{ex}\leavevmode
  \begin{enumerate}
  \item Show normality depends only on the topology, not the metric, of the spaces.
  \item Normality is local: if \(\mathcal F\) is a family of continuous maps, \(S = \bigcup_\alpha U_\alpha\), then if \(\mathcal F|_{U_\alpha}\) is normal for all \(\alpha\) then \(\mathcal F\) is normal for \(S\).
  \end{enumerate}
\end{ex}

A word of caution: in some texts (such as Ahlfors) the definition of normality excludes divergence.

\begin{definition}[equicontinuity]\index{equicontinuity}
  A family \(\mathcal F\) of continuous maps on a domain \(U \subseteq \C\) with values in a metric space \(T\) is \emph{equicontinuous} if for all \(\varepsilon > 0\), exists \(\delta > 0\) such that for all \(z, w \in U\) and for all \(f \in \mathcal F\), if \(|z - w| < \delta\) then \(d_T(f(z), f(w)) < \varepsilon\).
\end{definition}

\begin{theorem}[Arzela-Ascoli]
  Let \(\mathcal F\) be a family of continuous maps \(U \to T\) with \(U \subseteq \C\) a domain and \(T\) a metric space. Then \(\mathcal F\) has the property that any sequence has a locally uniformly convergent subsequence if and only if
  \begin{enumerate}
  \item \(\mathcal F\) is equicontinuous on every compact \(K \subseteq U\),
  \item for every \(z \in U\), \(\{f(z): f \in \mathcal F\}\) lies in a compact subset of \(T\).
  \end{enumerate}
\end{theorem}

\begin{corollary}
  If \(T\) is compact then \(\mathcal F\) is normal if and only if it is equicontinuous on compact subsets of \(U\).
\end{corollary}

\begin{proof}
  Only if is easy. For if, we use separability of \(\C\). Let \(\{z_k\}\) be a countable dense subset of \(U\) and fix \(\{f_n\} \subseteq \mathcal F\). Can find a set of indices \(n_{11} < n_{12} < \cdots\) such that \(f_{n_{1i}}(z_1)\) converges, and a subsequence of these \(n_{21} < n_{22} < \cdots\) such that \(f_{n_{2i}}(z_2)\) converges. Let \(g_k = f_{n_{kk}}\). Then for all \(z_i\) the limit \(\lim_{k \to \infty} g_k(z_i)\) exists in \(T\). Now given \(K \subseteq U\) compact, by equicontinuity for any \(\varepsilon > 0\) exists \(\delta > 0\) such that for all \(z, w \in U\) with \(|z - w| < \delta\), we have for all \(f \in \mathcal F\), \(d_T(f(z), f(w)) < \varepsilon\). Cover \(K\) by \(\delta\)-balls, extract a finite subcover, and choose some \(z_i\) in each, say \(z_1, \dots, z_\ell\). For each \(z_i\), \(1 \leq i \leq \ell\), exists \(N_i\) such that for all \(n, m \geq N_i\), \(d_T(g_n(z_i), g_m(z_i)) < \varepsilon\). Let \(N = \max_i N_i\). Then for all \(z \in K\),
  \begin{align*}
    d_T(g_n(z), g_m(z))
    &\leq d_T(g_n(z), g_n(z_i)) + d_T(g_n(z_i), g_m(z_i)) + d_T(g_n(z_i), g_m(z)) \\
    &< 3\varepsilon
  \end{align*}
\end{proof}

\begin{theorem}[Montel]\index{Montel's theorem}
  Suppose \(S, T\) are Riemann surfaces and \(T\) is hyperbolic. Then all families of holomorphic maps \(S \to T\) are normal.
\end{theorem}

\begin{proof}
  If \(S\) is not hyperbolic, lifting plus Liouville's theorem imply that all maps are constant. Given a family \(\mathcal F\) of constant maps, let \(\{f_n\} \subseteq \mathcal F\) be a sequence. Then if \(\{f_n(S)\}\) lies in a compact set in \(T\), then exists a convergent subsequence; if not, exists a subsequence which leaves any compact set, so diverges locally uniformly.

  Suppose \(S\) is hyperbolic, \(\{f_n\} \subseteq \mathcal F\). If exists \(x \in S\) such that \(\{f_n(x)\}\) lies in a compact subset of \(T\), the same is true for all \(y \in S\). Pick's therom implies equicontinuity so by Arzela-Ascoli \(\{f_n\}\) has a convergent subsequence. Otherwise fix \(x \in S\) and \(y \in T\) and exists a subsequence \(\{f_{n_k}\}\) such that \(d_T(f_{n_k}(x), y) \to \infty\). Given \(K \subseteq S, K' \subseteq T\) compact, by Pick's theorem \(d_T(f_{n_k}(z), y) \to \infty\) for all \(z \in K\) and so \(f_{n_k}(K) \cap K' = \emptyset\) for \(k \gg 1\). Thus the sequence diverges locally uniformly.
\end{proof}

\begin{eg}
  If \(f: \hat \C \to \hat \C\) is a rational map and \(D \subseteq \hat \C\), then the family of iterates \(\mathcal F = \{f^n\}_{n \in \N}\) is normal if \(\bigcup_{n \in \N} f^n(D)\) omits 3 or more points of \(\hat \C\), as any domain of \(\hat \C\) with complement of cardinality \(\geq 3\) is hyperbolic.
\end{eg}

\begin{definition}[proper map]\index{proper map}
  Suppose \(U, V\) are open subsets of Riemann surfaces and \(f: U \to V\). \(f\) is proper if for every \(K \subseteq V\) compact, \(f^{-1}(K)\) is compact in \(U\).
\end{definition}

Proper maps have well-defined degrees and satisfies the Riemann-Hurwitz formula. The proofs are similar to the compact case.

\begin{proposition}
  Suppose \(U, V\) are open in \(\hat \C\). If \(f: U \to V\) is proper holomorphic nonconstant then \(f\) has a well-defined degree, i.e.\ for all \(x\in V\), \(|f^{-1}(x)|\) is independent of \(x\), counting multiplicity.
\end{proposition}

\begin{theorem}[Riemann-Hurwitz]
  With same assumptions as above, the Euler characteristic \(\chi(U)\), \(\chi(V)\) satisfy
  \[
    \chi(U) = (\deg f) \chi(V) - \sum_{p \in U}(e_p - 1)
  \]
  where \(e_p\) is the local degree/ramification index of \(f\) at \(p\).
\end{theorem}

Note that one strategy is to observe that for \(U \subseteq \C\), we can cover by \(\delta\)-grid, let \(\delta \to 0\), we obtain a covering of \(U\) by open balls with compact closures and smooth boundaries.

\begin{corollary}
  If \(f: \hat \C \to \hat \C\) is holomorphic of degree \(d\), then \(f\) has \(2d - 2\) critical points, counting multiplicity.
\end{corollary}

\begin{corollary}
  If \(\chi(U) = \chi(V) = 0\) then \(f: U \to V\) proper holomorphic nonconstant is unramified.
\end{corollary}

\begin{definition}[Fatou set, Julia set]\index{Fatou set}\index{Julia set}
  Let \(f: \hat \C \to \hat \C\) be a holomorphic nonconstant map. The \emph{Fatou set} of \(f\) is
  \[
    F(f) = \{z \in \hat \C: \text{ on some nbhd } z \in U, f^n \text{ forms a normal family}\}.
  \]
  The \emph{Julia set} of \(f\) is \(J(f) = \hat \C \setminus F(f)\).
\end{definition}

\begin{eg}
  For \(z \mapsto z^2\), we have normality on \((\hat \C \setminus \overline \D) \cup \D\), and normality fails on any open neighbourhood which intersects \(S^1\). Thus \(J(z^2) = S^1\). This example might be slightly misleading, as we'll see that the Julia set of a rational map is almost never smooth.
\end{eg}

\begin{lemma}
  \(F(f)\) and \(J(f)\) are totally \(f\)-invariant, i.e.\ \(f^{-1}(F(f)) = F(f), f^{-1}(J(f)) = J(f)\).
\end{lemma}

\begin{proof}
  Suffices to show that if \(U \subseteq \hat \C\) then \(\{f^n|_U\}\) is normal on \(U\) if and only if \(\{f^{n + 1}|_{f^{-1}(U)}\}\) is normal on \(f^{-1}(U)\). If \(K \subseteq f^{-1}(U)\) compact then
  \[
    \sup_{z \in K} d(f^n(z), f^m(z)) = \sup_{w \in f(K)} d(f^{n - 1}(z), f^{m - 1}(z)).
  \]
  Since \(f\) is proper (continuous map from compact space to Hausdorff space is proper) and continuous, compactness is preserved by both \(f\) and \(f^{-1}\).
\end{proof}

\begin{lemma}
  \(J(f) = J(f^n)\) and \(F(f) = F(f^n)\) for all \(n\).
\end{lemma}

\begin{proof}
  Exercise.
\end{proof}

\begin{remark}
  The Julia set of \(f\) is the smallest (?) closed subset of \(\hat \C\) which is totally \(f\)-invariant and contains at least \(3\) points (for the moment assume \(|J(f)| \geq 3\)), since the complement of any such set has \(\{f^n\}\) normal by Montel.
\end{remark}

For the rest of the course, we consider only rational maps with \(\deg f \geq 2\). See example sheet 1 for a description of \(J(\mu)\) for \(\mu\) a Möbius transformation.

\begin{theorem}
  Let \(z \in U \subseteq J(f)\) be open. Then the union \(V = \bigcup_{n \in \N} f^n(U)\) contains all but at most 2 points of \(\hat \C\). Any point \(w \notin V\) is a critical point of the Fatou set.
\end{theorem}

\begin{proof}
  The first statement follows from Montel. If \(w \notin V\), since \(f(V) \subseteq V\), then for all \(n \in \N\), \(f^{-n}(w) \cap V = \emptyset\). Suppose there are two points \(\{z_0, z_1\}\). Then examining possible ramification for these two points which are fixed under \(f^{-1}\), the only possiblities are \(z_i \mapsto z_i\) with degree \(d\), or \(z_1 \mapsto z_2, z_2 \mapsto z_1\) with degree \(d\). The case for a single point is similiar.

  Replacing \(f\) by \(f^2\) if needed, it suffcies to show that if \(f(z) = z\) and \(f'(z) = 0\) then \(z \in F(f)\). Note that if \(\mu \in \aut(\hat \C)\), \(g = \mu^{-1} \compose f \compose \mu\), then \(g^n = \mu^{-1} \compose f^n \compose \mu\), and so \(\mu(J(g)) = J(f)\). Thus wlog \(f(0) = 0, f'(0) = 0\). Locally we have \(f(z) = a_2 z^2 + a_3z^3 + \dots = z^2(a_2 + O(z))\) about \(0\), so \(|f(z)| < |z|\) for \(z\) sufficiently close to \(0\), so on a neighbourhood of \(0\), \(f^n \to 0\) so form a normal family.
\end{proof}

The three cases do happen: \(z \mapsto z^d, z \mapsto z^{-d}, z \mapsto p(z)\) for \(p\) a polynomial with nonzero constatnt term.

\begin{remark}
  If \(f^n(z_0) = z_0\) for some \(n \in \N\) and \((f^n)'(z_0) = \prod_{i = 0}^{n - 1} f'(f^i(z_0)) = 0\) then \(z_0 \in F(f)\).
\end{remark}

\begin{corollary}
  If \(J(f)\) contains an interior point then \(J(f) = \hat \C\).
\end{corollary}

\begin{proof}
  If \(U\) is open in \(J(f)\), \(V = \bigcup f^n(U)\) contains all but at most 2 points on \(\hat \C\). Since \(J(f)\) is closed by definition, \(J(f) = \hat \C\).
\end{proof}

This does happen: let \(E_t: y^2 = x(x - 1)(x - t)\) for \(t \in \C \setminus \{0, 1\}\) be an elliptic curve.
\[
  \begin{tikzcd}
    E_t \ar[r, "{[2]}"] \ar[d] & E_t \ar[d] \\
    \hat \C \ar[r, "f_t"] & \hat \C
  \end{tikzcd}
\]
where the vertical maps are quotient by ?, i.e.\ \((x, y) \mapsto x\). Then
\[
  f_t(z) = \frac{(z^2 - t)^2}{4z(z-1)(z - t)}.
\]
We can show \(J(f_t)\) is dense in \(\hat \C\) by showing the Julia set of \([2]\) is dense, and thus \(J(f_t) = \hat \C\).

\begin{definition}[period, multiplier]\index{period}\index{multiplier}
  Let \(z_0 \in \hat \C\). We say \(z_0\) is \emph{periodic} for a rational \(f\) if exists \(m \in \N\) such that \(f^m(z_0) = z_0\). The minimal such \(m\) is the \emph{period} of the cycle containing \(z_0\). If \(m = 1\) we also call it a \emph{fixed point}.

  If \(z_0\) has period \(m\), the \emph{multiplier} of the cycle is
  \[
    (f^m)'(z_0) = \prod_{i = 0}^{m - 1} f'(f^i(z_0)).
  \]
  Let \(\lambda\) be the multiplier of \(z_0\). We say \(z_0\) is
  \begin{enumerate}
  \item \emph{superattracting} if \(\lambda = 0\),
  \item \emph{attracting} if \(0 \leq |\lambda| < 1\),
  \item \emph{indifferent} if \(|\lambda| = 1\),
  \item \emph{repelling} if \(|\lambda| > 1\).
  \end{enumerate}
\end{definition}
Recall that we might have to use the chart at infinity to compute the derivative. For example if \(z_0 = \infty, f(\infty) = \infty\) then
\[
  \lambda = \lim_{z \to \infty} \frac{1}{f'(z)}.
\]

\begin{definition}[basin of attraction]\index{basin of attraction}
  Suppose \(C = \{z_0, f(z_0), \dots, f^{m - 1}(z_0)\}\) is an attracting cycle. The \emph{basin of attraction} for \(C\) is
  \[
    A = \{z \in \hat \C: \lim_{n \to \infty} f^{nm}(z) = f^i(z_0) \text{ for some } 0 \leq i \leq m - 1\}.
  \]
\end{definition}

\begin{theorem}
  If \(f: \hat \C \to \hat \C\) has an attracting cycle then the basin of attraction is in \(F(f)\). On the other hand all repelling cycles are contained in \(J(f)\).
\end{theorem}

\begin{eg}
  The theorem completely describes the Fatou and Julia set of \(z \mapsto z^2\). \(z_0\) is periodic if and only if exists \(n\) such that \(z_0^{2^n} = z_0\), so \(z_0\) is \(0, \infty\) or some root of unity (which forms a dense subset of \(S^1\)). \(A_0 = \D, A_\infty = \hat \C \setminus \overline \D\). All other cycles are repelling and so \(J(f) = S^1\).
\end{eg}

\begin{proof}
  Since \(J(f^m) = J(f)\), wlog assume \(z_0\) is a fixed point. Suppose that \(\lambda = f'(z_0)\) is such that \(|\lambda| < 1\). By Taylor expansion \(|f(z) - z_0| \leq c |z - z_0|\) for some constant \(c < 1\) for \(z\) sufficiently close to \(z_0\). So on a neighbourhood of \(_0\), \(f^n(z)\) converges uniformly on compact subsets to the constant function \(z_0\). So \(z_0 \in F(f)\).

  On the other hand if \(z_0\) is repelling so \(|\lambda| > 1\), suppose for contradiction that \(z_0 \in F(f)\), so exists open neighbourhood \(U\) of \(z_0\) on which \(f^n\) has a subsequence converging to a holomorphic limit. Since \((f^n)'(z_0) = \lambda^n\), absurd.
\end{proof}

\begin{remark}
  We will classify later when indifferent points are Julia.
\end{remark}

\subsection{Holomorphic Lefschetz fixed point formula}

\begin{definition}[residue index]\index{residue index}
  Let \(z_0\) be a fixed point of a rational map \(f\). The \emph{residue index} of \(f\) at \(z_0\) is
  \[
    i_f(z_0) = \frac{1}{2\pi i} \int_\gamma \frac{dz}{z - f(z)}
  \]
  where \(\gamma\) is a small, positively oriented circle about \(z_0\).
\end{definition}

\begin{lemma}
  Let \(z_0\) have multiplier \(\ne 1\). Then \(i_f(z_0) = \frac{1}{1 - \lambda}\).
\end{lemma}

\begin{proof}
  It is an exercise to check the multiplier is coordinate-independent. By definition the resude index is translation/conjugation independent, so wlog \(z_0 = 0\). Then on a neighbourhood of \(0\), \(f(z) = \lambda z + a_2z^2 + \dots\) so
  \[
    \frac{1}{z - f(z)} = \frac{1}{(1 - \lambda) z (1 + O(z))} = \frac{1}{(1 - \lambda) z} + g(z)
  \]
  with \(g\) holomorphic on a neighbourhood of \(0\). Integrate.
\end{proof}

\begin{theorem}[holomorphic Lefschetz on \(\hat \C\)]
  Say \(f: \hat \C \to \hat \C\) of degree \(\geq 2\). Then the fixed points of \(f\) satisfy
  \[
    \sum_{z = f(z)} i_f(z) = 1.
  \]
\end{theorem}

\begin{proof}
  Conjugation if necessary (exercise: use the above lemma to show the residue index is coordinate-independent), wlog \(f(\infty) \ne \infty\). Choose \(R \gg 0\) so that all fixed points of \(f\) are in \(D(0, R)\). Call the positively oriented boundary \(C_R\). By residue theorem
  \begin{align*}
    \sum_{z = f(z)} i_f(z)
    &= \frac{1}{2\pi i} \int_{C_R} \frac{dz}{z - f(z)} \\
    &= \frac{1}{2\pi i} \int_{-C_{1/R}} \frac{-dw}{w^2(\frac{1}{w} - f(\frac{1}{w}))} \\
    &= \frac{1}{2\pi i} \int_{C_{1/R}} \frac{dw}{w(1 - wf(\frac{1}{w}))} \\
    &= \operatorname{Res}_{w = 0} \frac{1}{w(1 - wf(\frac{1}{w}))} \\
    &= 1
  \end{align*}
\end{proof}

\begin{corollary}
  Suppose \(\deg f \geq 2\). Then \(J(f) \ne \emptyset\).
\end{corollary}

\begin{proof}
  Consider the fixed points of \(f\). Assume first no fixed point multiplier is \(1\). Then \(\lambda \mapsto \frac{1}{1 - \lambda}\) sends the unit circle to the line \(\Re = \frac{1}{2}\), and \(\D\) to \(\Re > \frac{1}{2}\). Thus if \(|\lambda| \leq 1\) for all fixed point multipliers, and not equal to \(1\), (there is no multiplicity), there are \(d + 1 \geq 3\) distinct fixed points (?), so \(\Re( \sum_{z = f(z)} i_f(z)) \geq \frac{3}{2}\), absurd. If exists a repelling point then done. So suppose \(z_0\) is fixed with \(\lambda = 1\). Then in local coordinates \(f(z) = z + a_kz^k + \dots\) where \(a_k \ne 0\). Inductively \(f(z) = z + na_kz^k + \dots\) so the \(k\)th derivative of \(f^n(z_0)\) is \(k! na_k \to \infty\) as \(n \to \infty\), so the iterates cannot form a normal family on a neighbourhood of \(z_0\).
\end{proof}

\begin{remark}\leavevmode
  \begin{enumerate}
  \item Suppose \(z_0\) is a indifferent fixed point, \(\lambda\) a root of unity. If \(\lambda^k = 1\) then \((f^k)'(z_0) = \prod_{i = 0}^{k - 1} f'(f(z_0)) = \lambda^k = 1\). Thus the preceding argument shows that \(z_0 \in J(f^k) = J(f)\).
  \item It is possible for a rational map to have non repelling fixed point. For example \(z \mapsto z^2 + \frac{1}{4}\). The fixed points are \(\infty\) and \(\frac{1}{2}\) which is a double fixed point.
  \item Any finite \emph{grand orbit} (the set \(\{z \in \hat \C: f^m(z) = f^n(z_0) \text{ for some } m, n\}\)) is necessarily Fatou (exercise), so \(|J(f)| = \infty\).
  \end{enumerate}
\end{remark}

Recall: suppose \(f: \hat \C \to \hat \C\) is a rational map of degree \(d \geq 2\).

\begin{enumerate}
\item If \(U\) is open, \(U \cap J(f) \ne \emptyset\) then \(\bigcup_{n \geq 1} f^n(U)\) contains all but at most 2 points and contains \(J(f)\).
\item \(J(f)\) contains all repelling cycles and all indifferent cycles with roots of unity multipliers.
\item \(J(f) \ne \emptyset\) and \(|J(f)| = \infty\).
\end{enumerate}

\begin{proposition}
  Suppose \(f\) has a periodic cycle which is attracting, with attracting basin \(A\). Then \(J(f) = \p A\).
\end{proposition}

\begin{proof}
  Given \(U\) an open neighbourhood such that \(U \cap J(f) \ne \emptyset\), exists \(n\) such that \(f^n(U) \cap A = \emptyset\). As \(A\) is closed under preimages, \(U \cap A \ne \emptyset\). Thus \(J(f) \subseteq \overline A\). Since \(A \subseteq F(f)\), \(J(f) \subseteq \p A\).

  Conversely suppose \(z_0 \in \p A\) and \(U\) is a neighbourhood of \(z_0\). Suppose \(\{f^n\}\) forms a normal family on \(U\). On \(U \cap A\), any holomorphic limit \(g\) of iterates of \(f\) must take finitely many constant values, but \(g\) cannot be locally constant as \(U\) contains points not in the basin, absurd. Thus \(z_0 \in J(f)\).
\end{proof}

\begin{eg}
  Any \emph{polynomial} \(f\) has \(J(f)\) the boundary of basin at \(\infty\). Note that it might also be the boundary of another basin, for example \(z \mapsto z^2, z \mapsto z^2 - 1\).
\end{eg}

\begin{corollary}
  Fix \(z_0 \in J(f)\). Then the full preimage \(\{z: f^n(z) = z_0 \text{ for some } n \geq 0\}\) forms a dense subset of \(J(f)\).
\end{corollary}

\begin{proof}
  Fix \(z_1 \in J(f)\) and a neighbourhood \(U \ni z_1\). If it contains no preimage of \(z_0\) then \(\bigcup f^n(U) \notin z_0\), absurd.
\end{proof}

Topological preimage equidistribution

\subsection{Attracting (and repelling) cycles}

\begin{definition}[topologically attracting]\index{topologically attracting}
  A fixed point \(p\) of \(f\) is \emph{topologically attracting} if there exists a neighbourhood \(U \ni p\) such that \(\{f^n\}\) converges locally uniformly to \(p\) on \(U\).
\end{definition}

\begin{lemma}
  A fixed point \(p\) of \(f\) is attracting if and only if it is topologically attracting.
\end{lemma}

\begin{proof}
  Exercise. Taylor's theorem in one direction, and Schwarz lemma in the other.
\end{proof}

\begin{theorem}
  Suppose \(f\) has a fixed point \(p\) with multiplier \(\lambda\), \(|\lambda| \ne 0, 1\). Then exists local holomorphic change of coordinates \(\phi\) such that \(\phi(p) = 0\) and \(\phi \compose f \compose f^{-1}(w) = \lambda w\). Thus coordinate is unique up to multiplication by a constant. \(\phi\) is known as the \emph{Kaenig linearising map}\index{Kaenig linearising map}.
\end{theorem}

\begin{proof}
  wlog \(p = 0\) and first suppose \(0 < |\lambda| < 1\). Choose a constant \(c\) such that \(c^2 < |\lambda| < c\). Find \(r > 0\) such that for all \(z \in D(0, r)\), \(|f(z)| \leq c |z|\), so \(|f^n(z)| \leq c^n r\). We can find \(B > 0\) such that for all \(z \in D(0, r)\), \(|f(z) - \lambda z| \leq B |z|^2\). Thus for all \(z \in D(0, r)\),
  \[
    |f^{n + 1}(z) - \lambda f^n(z)| \leq B |f^n(z)|^2 \leq B r^2 c^{2n}.
  \]
  Let \(w_n = \frac{f^n(z)}{\lambda^n}\). Then
  \[
    |w_{n + 1}(z) - w_n(z)|
    = \left| \frac{f^{n + 1}(z)}{\lambda^{n + 1}} - \frac{f^n(z)}{\lambda^n} \right|
    \leq \frac{1}{|\lambda|^{n + 1}} Br^2 c^{2n}
    = \frac{Br^2}{\lambda} \left|\frac{c^2}{\lambda}\right|^n
  \]
  so \(w_n\) converges locally uniformly on \(D(0, r)\). Set \(\phi(z) = \lim w_n(z)\). As \(z \mapsto w_n(z)\) has derivative \(1\) at \(0\), so does \(\phi\) so it has a holomorphic inverse.

  For uniqueness suppose \(\psi\) is another such coordinate, then for \(w \in \psi(U)\) have \(\lambda \phi(\psi^{-1}(w)) = \phi(\psi^{-1}(\lambda w))\). Done by comparing local power series.

  For \(|\lambda| > 1\) apply the same argument to a branch of \(f^{-1}\).
\end{proof}

\begin{corollary}
  Suppose \(p\) is an attracting fixed point of \(f\) with multiplier \(\lambda \ne 0\) and basin \(A\). Then exists a holomorphic \(\phi: A \to \C\) such that the following diagram commutes
  \[
    \begin{tikzcd}
      A \ar[r, "f"] \ar[d, "\phi"] & A \ar[d, "\phi"] \\
      \C \ar[r, "\lambda"] & \C
    \end{tikzcd}
  \]
\end{corollary}

\begin{proof}
  Define \(\phi(z) = \lim_{n \to \infty} \frac{\phi_0(f^n(z))}{\lambda^n}\) where \(\phi_0\) is the linearlising coordinates on a neighbourhood of \(p\). Check the details.
\end{proof}

\begin{definition}[immediate basin]\index{immediate basin}
  The \emph{immediate basin} of an attracting cycle is the union of the Fatou components containing the cycle elements.
\end{definition}

...

\(\frac{z^2 - 1}{z^2 - c}\) attracting \(5\)-cycle \(\infty \mapsto 1 \mapsto 0 \mapsto \frac{1}{c}\)

\begin{proposition}
  Let \(f\) be a rational map with \(f(p) = p\) an attracting fixed point. Then the immediate basin of \(p\) contains a critical point of \(f\).
\end{proposition}

\begin{proof}
  wlog \(p = 0\). The component \(U\) of \(F(f)\) is hyperbolic as \(|J(f)| = \infty\). Thus we have
  \[
    \begin{tikzcd}
      \D \ar[r, "F"] \ar[d, "\pi"] & \D \ar[d, "\pi"] \\
      U \ar[r, "f"] & U
    \end{tikzcd}
  \]
  If \(f\) has no critical points in \(U\) then \(f \compose \pi\) is a covering map \(\D \to U\) so exists \(G: \D \to \D\) covering it. If \(\pi, F, G\) fix \(0\), \(G\) is inverse to \(F\). Thus \(F \in \aut(\D)\) so \(F, f\) are hyperbolic local isometries, contradicting \(0\) an attracting fixed point.
\end{proof}

\begin{corollary}
  \(f\) has at most \(2d - 2\) attracting cycles.
\end{corollary}

\begin{corollary}
  \(f\) has at most \(4d - 4\) non-repelling cycles.
\end{corollary}

\begin{proof}
  Holomorphic perturbation. Let \(f_t(z) = (1 - t) f(z) + tz^d\). Note \(f_0 = f(z), f_1 = z^d\). Suppose \(f^n(\alpha) = \alpha\) with multiplier \(\lambda \in S^1\). If \(\alpha\) is not a repeated root of \(f^n(z) - z\) there is a neighbourhood of \(0\) and holomorphic \(t \mapsto \alpha(t)\) such that \(\alpha(0) = \alpha\) and \(f^n(\alpha(t)) = \alpha(t)\) for all \(t\), i.e.\ if \(\lambda \ne 1\) (?). But if \(\lambda = 1\) we can base change \(t \mapsto t^k\). We then have \(t \mapsto \lambda(t)\) homomorphic in \(t\), \(\lambda(0) = \lambda\) and \((f^n)'(\alpha(t)) = \lambda(t)\). Either \(\lambda(t)\) is the constant \(1\) (more argument needed), or another constant \(\lambda\), or nonconstant. The first two cases contradict \(z^d\) having no indifferent cycles at \(t = 1\).

  By conformality of holomorphic maps, the measure
  \[
    \mu(\{\theta \in S^1: |\lambda(\varepsilon e^{i\theta})|\}) \to \frac{1}{2}
  \]
  as \(\varepsilon \to 0\). Repeating this process for all indifferent cycles, exists a direction \(\theta\) such that perturbation in the \(\theta\)-direction makes half of these cycles attracting. For sufficiently small choice of \(\varepsilon e^{i\theta}\), attracting cycles remain attracting. Let \(N\) be the number of indifferent cycles of \(f\), \(M\) the number of attracting cycles of \(f\), then the number of non-repelling cycles of \(f\) is \(N + M = 2(M/2 + N/2) \leq 2 (2d - 2)\).
\end{proof}

\begin{remark}
  \(f^n(z) = z\) has \(z^n + 1\) roots counting multiplicity, so must have a repelling cycle.
\end{remark}

Note we can be more precise, see example sheet.

\begin{theorem}
  If \(f(0) = 0\) is attracting with multiplier \(\lambda \ne 0\). Let \(\phi\) be a linearising coordinate with local inverse \(\psi: \D(0, \varepsilon) \to A_0\), where \(A_0\) is the immediate basin of \(0\). \(\psi\) extends to a holomorphic map on a disk \(\D(0, r)\) of some maximal radius \(r\), extending homeomorphically to \(\p \D(0, r)\) and \(\psi(\p \D(0, r))\) contains a critical point of \(f\).
\end{theorem}

\begin{remark}
  Actually detecting whether \(f\) has an attractor is harder. Open problem: does \(z \mapsto z^2 - \frac{3}{2}\) has an attractor?
\end{remark}

Caution: linearising map need not continuously extend to \(J(f)\).

\begin{theorem}
  If \(f\) rational has \(J(f)\) disconnected then \(J(f)\) has uncountably many connected components.
\end{theorem}

\begin{proof}
  If \(J(f) = J_0 \cup J_1\) where \(J_0, J_1\) are disjoint compact nonempty. Given \(z \in J\), define a seuqnce \(\beta(z) = (\beta_n(z))\) where \(\beta_n(z) = i\) if \(f^n(z) \in J_i\). If \(z, w\) are in the same connected component of \(J(f)\) then \(\beta(z) = \beta(w)\). It suffices to show that for any initial \(\beta_1(z), \dots, \beta_k(z)\), exists \(n > k\) such that exists \(z' \in J(f)\) such that \(\beta_i(z') = \beta_i(z)\) for all \(1 \leq i \leq k\) but \(\beta_n(z') \ne \beta_n(z)\). Define
  \[
    U_{z, k} = \{w \in \hat \C: f^i(w) \notin J_{1 - \beta_i(z)} \text{ for all } 1 \leq i \leq k\}.
  \]
  This is open and contains \(F(f)\). Some subsequence \((\beta_{n_j}(z))\) is constant, say the constant \(0\). If \(\beta_i(z') = \beta_i(z)\) for all \(1 \leq i \leq k\) then \(\beta_i(z') = \beta_i(z)\) for all \(i\), then
  \[
    f^{n_j}(U_{z, k}) \subseteq \C \setminus J_1.
  \]
  The maps \(f^{nj}: U_{z, k} \to \C \setminus J_1\) form a normal family, contradiction. Thus \(\{\beta(z): z \in J(f)\}\) is uncountable.
\end{proof}

\paragraph{Superattractor}

\begin{theorem}
  Suppose \(f(0) = 0\) is with local expansion \(f(z) = a_mz^m + a_{m + 1}z^{m + 1} + \dots, m \geq 2\). Then there exists a holomorphic change of coordinates \(\phi\) on a neighbourhood of \(0\) such that \(\phi(0) = 0\), \(\phi(f(z)) = \phi(z)^m\). \(\phi\) is unique up to multiplication by an \((m - 1)\)th root of unity. \(\phi\) is called the \emph{Böttcher coordinate}\index{Böttcher coordinate}.
\end{theorem}

\begin{proof}
  We sketch the proof only. The details are the same as Kaenig's. Write locally \(f(z) = z^m(1 + h(z))\), where \(h(z) \to 0\) as \(z \to 0\) is holomorphic, where \(a_m = 1\) (otherwise conjugate by \(\alpha f(z/\alpha)\)). Write \(1 + h(z) = \exp(k(z))\) for some holomorphic \(h(z)\) on a neighbourhood of \(0\). Then there exists holomorphic \(k_n(z)\) on this neighbourhood so that \(f^n(z) = z^{m^n} \exp(k_n(z))\). Choose the branch \(\phi_n(z)\) of the \(m^n\)th root of \(f^n(z)\) such that \(\phi_n(z) = z(1 + O(z))\). Then \(\phi_n\) converges uniformly to some holomorphic \(\phi\) on this neighbourhood which satisfies the statement. Uniqueness follows from identification of Taylor expansion, a la Kaenig.
\end{proof}

\begin{corollary}
  Let \(f(0) = 0\) be superattracting, with basin \(A\) and Böttcher coordinate \(\phi\) on a neighbourhood of \(0\). Then \(z \mapsto |\phi(z)|\) extends to a continuous map \(|\phi|: A \to [0, 1)\) satisfying \(|\phi(f(z))| = |\phi(z)|^m\) for \(z \in A\).
\end{corollary}

\begin{proof}
  Given \(z \in A\), set \(|\phi|(z) = |\phi(f^n(z))|^{1/m^n}\), where \(n \gg 1\) such that \(f^n(z)\) is in the neighbourhood domain of \(\phi\). The desired equality is immediate.
\end{proof}

\section{Polynomial dynamics}

\begin{definition}[filled Julia set]\index{filled Julia set}
  Let \(p(z) = a_dz^d + a_{d - 1}z^{d - 1} + \dots + a_0, d \geq 2, a_d \ne 0\). The \emph{filled Julia set} of \(p\) is
  \[
    K(p) = \{z \in \C: |f^n(z)| \nto \infty \text{ as } n \to \infty\}.
  \]
\end{definition}

Note this is the complement of the basin of infinity.

From our results on boundaries of basins, \(\p K(p) = J(p)\). We know we have a Böttcher coordinate on a neighbourhood of \(\infty\): choose this (i.e.\ \(\phi(1/z)^{-1}\)) such that \(\phi(\infty) = \infty\).

\begin{definition}[Green's function]\index{Green's function}
  Suppose \(p(z)\) is a degree \(d\) polynomial. The \emph{Green's function} associated to \(p\) is
  \[
    G_p(z) = \lim_{n \to \infty} \frac{\log^+ |p^n(z)|}{d^n}
  \]
  where \(\log^+x = \max\{\log x, 0\}\) for \(x \geq 0\).
\end{definition}

\begin{lemma}
  \(G_p(z)\) satisfying the following:
  \begin{enumerate}
  \item \(G_p\) is continuous everywhere and harmonic on \(\C \setminus K(p)\).
  \item \(G_p(z) = \log |z| + O(1)\) as \(|z| \to \infty\).
  \item \(G_p(z) \to 0\) as \(z \to K(p)\).
  \item \(G_p(p(z)) = d G_p(z)\).
  \end{enumerate}
  1, 2, 4 uniquely characterises \(G_p\), and \(G_p(z) = \log |\phi_p(z)|\), where \(\phi_p\) is a Böttcher coordinate at \(\infty\) on \(\hat \C \setminus K(p)\).
\end{lemma}

\begin{remark}\leavevmode
  \begin{enumerate}
  \item This is how pictures of filled Julia sets are drawn.
  \item The Green's function depends only on \(K(p)\).
  \end{enumerate}
\end{remark}

\begin{proof}\leavevmode
  \begin{enumerate}
  \item Consider the function \(\log^+|p(z)| - d \log^+|z|\) on \(\hat \C\). It is continuous and takes real values, so is bounded by some \(C \in \R\). Then for all \(n\),
    \[
      \left| \frac{\log^+|p^n(z)|}{d^n} - \frac{\log^+|p^{n - 1}(z)|}{d^{n - 1}}\right| \leq \frac{C}{d^n}
    \]
    so for \(m \leq n\),
    \[
      \left| \frac{\log^+|p^n(z)|}{d^n} - \frac{\log^+|p^m(z)|}{d^m}\right| \leq \sum_{k = m + 1}^n \frac{C}{d^k} \leq \frac{C}{d^m (d - 1)}
    \]
    so \(G_p\) is a uniform limit of continuous function so continuous.

    Locally, a function is harmonic if and only if it is the real part of a holomophic function, if and only if it equals to \(\log |f|\) for some holomorphic \(f\) that does not vanish anywhere (since on a simply connected domain we can take logarithm). Given \(z \notin K(p)\), find a small disk \(D \ni p\) such that \(\overline D \cap K(p) = \emptyset\). There exists \(N \gg 1\) such that \(p^n(\overline D) \cap \D = \emptyset\) for \(n \geq N\). Then \(\frac{\log^+ |p^n(z)|}{d^n}\)  is harmonic on \(\overline D\). Since a uniform limit of harmonics is harmonic, we have \(G_p(z)\) is harmonic on \(D\) as well. Note if \(K(p)^{\mathrm{int}}(p) \ne \emptyset\) then \(G_p(z) = 0\) there so is harmonic as well. In other words, \(G_p(z)\) fails to be harmonic precisely on the Julia set (for more rigorous argument see later).
  \item Set \(m = 0\), then the bound in 1 gives
    \[
      \left| \frac{\log^+ |p^n(z)|}{d^n} - \log^+|z| \right| \leq \frac{C}{d - 1}
    \]
    so as \(n \to \infty\), \(|G_p(z) - \log |z|| \leq \frac{C}{d - 1}\) for \(|z| \gg 0\).
  \item \(G_p(z) = 0\) on \(K(p)\).
  \item Definition.
  \end{enumerate}

  Suppose \(H(z)\) is a function satisfying 1, 2 and 4 and consider \(G(z) = G_p(z) - H(z)\). By 1 and 2 it is continuous and bounded on \(\hat \C\). By 4, as \(n \to \infty\), \(G(p^n(z)) = d^n G(z) \to \infty\) unless \(G(z) = 0\). We thus have \(G_p(z) = H(z)\). For \(G_p(z) = \log |\phi_p(z)|\), check continuity, growth at \(\infty\) and transformation.
\end{proof}

\begin{eg}
  For \(z \mapsto z^d\),
  \[
    G_p(z) = \lim \frac{\log^+|z^{d^n}|}{d^n} = \log^+|z|.
  \]
  \(K(p) = \overline D\), where \(\log^+ |z| = 0\). The basin of infinity is \(\hat \C \setminus \D\).
\end{eg}

\begin{remark}
  \(G_p(z)\) is also known as the \emph{potential function}\index{potential function} associated to \(K(p)\).
\end{remark}

Now back to superattractors.

\begin{theorem}
  Suppose \(f(0) = 0\) is superattracting, with Böttcher coordinate \(\phi\) for \(f\) at \(0\). There there exists a unique open disk \(\D(0, r)\) of maximal radius \(0 < r \leq 1\) such that the inverse \(\psi\) of \(\phi\) extends holomorphically to \(\psi: \D(0, r) \to A_0\), the immediate basin of attraction of \(0\). If \(r = 1\) then \(\psi: D(0, t) \cong A_0\) and \(0\) is the only critical points of \(f\) in \(A_0\). On the other hand if \(r < 1\) there exists a nonzero critical point in \(A_0\), which lies on \(\b \psi(\D(0, r))\).
\end{theorem}

\begin{proof}
  Guided on example sheet 2. Non-examinable.
\end{proof}

\begin{eg}
  \(f(z) = z^2 + \frac{1}{2}\). \(\phi\) sends a neighbourhood of \(\infty\) to the complement of a large closed disk in \(\hat \C\) isomorphically. \(\psi\) can be extended until it hits the image of a critical point.
\end{eg}

In the case \(f_c(z) = z^2 + c\), there are two critical points \(\infty, 0\). \(\infty\) is mapped to itself with multiplicity \(2\). We have

\begin{corollary}
  Suppose \(0 \notin K(f_c)\), i.e.\ \(f_c^n(0) \to \infty\) as \(n \to \infty\). Then the Böttcher coordinate \(\phi_c\) of \(f_c\) at \(\infty\) extends to a conformal isomorphism on a neighbourhood of \(\infty\) which contains \(c\).
\end{corollary}

\begin{proof}
  \(0\) is the only critical point that can move around and \(f(0) = c\). Now use extension of Böttcher coordinate.
\end{proof}

\begin{proposition}
  A closed subset of the sphere is connected if and only if the connected components of its complement are simply connected.
\end{proposition}

\begin{proof}
  Beardon, Iteration of Rational Functions and Ahlfors.
\end{proof}

\printindex
\end{document}

% prerequisite:
% ES 0: basics of Riemann surfaces
% measure theory: definitions and basics up to Fubini's
%
% References
% McMullen: Riemann surfaces, complex dynamics and hperbolic geometry
% potential theory: Ramsford book


\documentclass[main.tex]{subfiles}
\begin{document}

\section{Chiral interactions}

\marginpar{Saturday\\ 2020-6-20, \\ compiled \\ \today}

(Coming from an exercise, 9.1.e)

Consider the following interaction Lagrangian
%
\begin{align}
\mathscr{L} _{\text{int}} =\varphi \overline{\psi}_{\ell} \qty(a_{\ell} + i b_\ell \gamma_{5}) \psi_{\ell}
\,,
\end{align}
%
which describes the interaction between a real scalar field and a fermion. \(a_\ell\) and \(b_\ell\) are small real parameters.

It is self-adjoint: its conjugate reads
%
\begin{align}
\mathscr{L} _{\text{int}} ^\dag &= \varphi \psi_{\ell} ^\dag \qty(a_{\ell} - i b_\ell \gamma_{5} ^\dag) \gamma^{0 \dag} \psi_{\ell} ^\dag  \\
&= \varphi \psi_{\ell} ^\dag \qty(a_{\ell} - i b_\ell \gamma_{5}) \gamma_0 \psi_{\ell}   \marginnote{\(\gamma_5 \) and \(\gamma^0 \) are self-adjoint.} \\
&= \varphi \psi_{\ell} ^\dag \gamma^{0} \qty(a_{\ell} + i b_\ell \gamma_{5}) \psi_{\ell}
\,,
\end{align}
%
where we switched the sign when anticommuting \(\gamma_5\) and \(\gamma^{0}\).

\subsection{Vertex contribution}

The Feynman rule for this interaction is given from the interaction Hamiltonian; in our case there are no derivative couplings so that is just minus the interaction Lagrangian. The vertex contribution to the diagram is given by the first-order term in the expansion of the \(S\)-matrix: in momentum space we do not have to include the integral over \(\dd[4]{x}\) so the vertex contribution is simply \(-i \mathscr{H} _{\text{int}} = i \mathscr{L} _{\text{int}}\), with all the fields removed: so it is
%
\begin{align}
i \qty(a_{\ell} + i b_\ell \gamma_{5})
\,.
\end{align}

We want to consider an initial state of \(\ket{i} = \ket{e^{-}(p)}\), and a final state of \(\ket{f} = \ket{s(q) e^{-}(k)}\).
The transition amplitude \(\bra{f} S \ket{i}\) will be given by
%
\begin{align}
S_{fi}
= (2 \pi )^{4} \delta^{(4)} (p - q - k)
i\overline{u}_{s'}(k) \qty(a_e + i b_e \gamma_{5}) u_s (p)
\,,
\end{align}
%
where there is no trace of the scalar: in fact, its contribution is only  \(\varphi_{+} ^\dag (x) \ket{s(p)} = e^{-ipx} \ket{0}\), which only comes up in the momentum conservation.

\subsection{\(e^{+} e^{-} \to \mu^+ \mu^-\) scalar-mediated scattering}

This is similar to the QED scattering in terms of incoming and outgoing particles, but the coupling is different: the Feynman diagram to second order is shown in figure \ref{fig:scalar-mediator-eemumu}.

\begin{figure}[ht]
\centering
\feynmandiagram[horizontal = y to x]{
e1 -- [fermion] y -- [fermion] e2,
y -- [scalar] x,
mu1 -- [fermion] x -- [fermion] mu2
};
\caption{\(e^{+} e^{-} \to \mu^+ \mu^-\) scattering with a scalar mediator.}
\label{fig:scalar-mediator-eemumu}
\end{figure}

Let us denote \(a = a_e = a_\mu \) and similarly for \(b\).
Then, the unpolarized Feynman amplitude will read:
%
\begin{align}
\begin{split}
\abs{\mathcal{\overline{M}}}^2
&= \frac{1}{4 (k^2- M^2 (+ i \epsilon))^2 }
\Tr[ (a + i b \gamma_5 ) (\slashed{p} + m_e) \qty(a + i b \gamma_5 ) \qty(\slashed{q} - m_e)] \times \\
&\phantom{=}\
\times \Tr[ (a + i b \gamma_5 ) (\slashed{p}' + m_\mu ) \qty(a + i b \gamma_5 ) \qty(\slashed{q}' - m_\mu )]
\end{split}
\,,
\end{align}
%
since the scalar propagator in momentum space is \(1/ (k^2 - m^2)\), and we get two of them from taking the square modulus.
The factor \(1/4\) is due to the average being taken on the initial polarizations.
\(M\) is the mass of the scalar, \(m_e\) and \(m_\mu\) are those of the electron and muon respectively.

The traces to compute seem to be many, but actually only three terms survive for each: this is because of the fact that, beyond the fact that traces of an odd number of \(\gamma^{\mu }\) vanish, we also have
%
\begin{align}
\Tr[\gamma_5 ]
= \Tr[\gamma_5 \gamma^{\mu }]
= \Tr[\gamma_5 \gamma^{\mu } \gamma^{\nu }]
= \Tr[\gamma_5 \gamma^{\mu } \gamma^{\nu } \gamma^{\rho }]
= 0
\,,
\end{align}
%
while the nonvanishing ones are \cite[section 6.3]{kumerickiFeynmanDiagramsBeginners2016}:
%
\begin{align}
\Tr[\gamma_5 \gamma_5 ] = 4 \qquad \text{and} \qquad
\Tr[\gamma_5 \gamma^{\mu } \gamma^{\nu } \gamma^{\rho } \gamma^{\sigma }] = -4i \epsilon^{\mu \nu \rho \sigma }
\,,
\end{align}
%
since \(\gamma_{5} \gamma_5  = \mathbb{1} \).

So, we get:
%
\begin{align}
\Tr[ (a + i b \gamma_5 ) (\slashed{p} + m_e) \qty(a + i b \gamma_5 ) \qty(\slashed{q} - m_e)] &= 4 \qty( (a^2 + b^2) p \cdot q +  m_e^2 ( b^2 -a ^2))
\,.
\end{align}

This was found by writing all the pieces on paper. Recall that the matrices \emph{anticommute}, so if we need to bring two \(\gamma_5\)s together we have to keep count of the number of swaps.

Then, our polarization-averaged square amplitude reads:
%
\begin{align}
\abs{\mathcal{\overline{M}}}^2
&=
\frac{4 \qty( (a^2 + b^2) p \cdot q +  m_e^2 ( b^2 -a ^2)) \qty( (a^2 + b^2) p' \cdot q' +  m_\mu^2 ( b^2 -a ^2))}{ (k^2- M^2 + i \epsilon)^2 }
\,.
\end{align}

This is an \(s\)-channel diagram: \(s = k^2\), and we can also express this Mandelstam variable as \(s = (p + q)^2 = (p'+ q')^2 = 2 m_e^2 + 2p \cdot q  = 2 m_\mu^2 + 2 p' \cdot q'\).

We can assume the electron mass to be zero, since it is small compared to the muon's:
%
\begin{align}
\abs{\mathcal{\overline{M}}}^2
&=
\frac{4 (a^2 + b^2) p \cdot q \qty( (a^2 + b^2) \qty( p \cdot q - m_\mu^2) +  m_\mu^2 ( b^2 -a ^2))}{ (k^2- M^2 + i \epsilon)^2 }
\,.
\end{align}

Now, we can calculate the cross section: for simplicity, let us move to the center of mass frame. Then, we will have
%
\begin{align}
\dd{\sigma } = \frac{\abs{\mathcal{\overline{M}}}^2}{4 I_{12}} \dd{\phi }^{(n_f)}
\,,
\end{align}
%
where the phase space element is given by
%
\begin{align}
\dd{\phi } = (2 \pi )^{4} \delta^{(4)} (p+q-p'-q')
\frac{ \dd[3]{p'}}{(2 \pi )^3 2 \omega_{p}'}
\frac{ \dd[3]{q'}}{(2 \pi )^3 2 \omega_{q}'}
\,,
\end{align}
%
while in our frame
%
\begin{align}
I_{12} &=  \sqrt{(p \cdot q)^2 - m_e^{4}}  \\
&= \sqrt{\omega_{e}^{4} + 2 \omega_{e}^2 \abs{\vec{p}}^2 + \abs{p}^{4} - m_e^{4}}  \\
&= \sqrt{4 \omega_{e}^2 \abs{p}^2} = 2 \omega_{e} \abs{p}
\,.
\end{align}

We are basically replicating what we have done when deriving the two-output cross section: the result, in the approximation \(m_e \approx 0\), is given by \eqref{eq:zero-initial-mass-cross-section}:
%
\begin{align}
\dv{\sigma }{\Omega_1 } &= \frac{1}{64 \pi^2}\frac{\abs{\mathcal{\overline{M}}}^2 }{s} \sqrt{1 - \frac{4 m_\mu^2}{s}}  \\
&= \frac{(a^2 + b^2) (s/2) \qty( (a^2 + b^2) \qty( s/2 - m_\mu^2) +  m_\mu^2 ( b^2 -a ^2))}{ (16 \pi^2 s) (s- M^2 + i \epsilon)^2 }
\sqrt{1 - \frac{4 m_\mu^2}{s}}  \\
&= \frac{(a^2 + b^2)\qty( (a^2 + b^2) \qty( s/2 - m_\mu^2) +  m_\mu^2 ( b^2 -a ^2))}{ 32 \pi^2 (s- M^2 + i \epsilon)^2 }
\sqrt{1 - \frac{4 m_\mu^2}{s}}
\,.
\end{align}

There is no angular dependence! Scalar-mediated interactions are \textbf{isotropic}.

\subsection{Scalar decay rate}

We want to calculate the decay rate of the process with initial state \(\ket{i} = \ket{s(p)}\) and final state \(\ket{f} = \ket{e^{-}(p') e^{+} (q')}\).

The polarization-averaged amplitude is given (in the lab=center of mass frame) by:
%
\begin{align}
\abs{\mathcal{\overline{M}}}^2
&= \frac{1}{(k^2 - M^2 + i \epsilon )^2}
\Tr[ (a + i b \gamma_5 ) (\slashed{p} + m_e) \qty(a + i b \gamma_5 ) \qty(\slashed{q} - m_e)]  \\
&= \frac{(a^2 + b^2)(p' \cdot q') + m_e^2 (b^2 - a^2)}{(k^2 -M^2+ i \epsilon)^2}  \\
&=\frac{(a^2 + b^2)(M^2 / 2- m_e^2) + m_e^2 (b^2 - a^2)}{(k^2 -M^2+ i \epsilon)^2}
\,.
\end{align}

Then, we can compute the differential decay rate \eqref{eq:differential-decay-rate-equal-masses}:
%
\begin{align}
\dv{\Gamma}{\Omega_1 } &= \frac{\abs{\mathcal{\overline{M}}}^2}{64 \pi^2 M}\sqrt{1 - \frac{4 m_e^2}{M^2}}  \\
&=\frac{(a^2 + b^2)(M^2 /2- m_e^2) + m_e^2 (b^2 - a^2)}{64 \pi^2 M (k^2 -M^2+ i \epsilon)^2}
\sqrt{1 - \frac{4 m_e^2}{M^2}}  \\
&= \qty[2 a^2 \qty( \frac{M^2}{4 } - m_e^2) + b^2 \frac{M^2}{2}] \frac{1}{64 \pi^2 M (k^2 -M^2+ i \epsilon)^2}
\sqrt{1 - \frac{4 m_e^2}{M^2}}  \\
\Gamma &= \qty[2 a^2 \qty( \frac{M^2}{4 } - m_e^2) + b^2 \frac{M^2}{2}] \frac{1}{16 \pi M (k^2 -M^2+ i \epsilon)^2}
\sqrt{1 - \frac{4 m_e^2}{M^2}}
\,.
\end{align}

\end{document}


\documentclass[12pt,letterpaper,oneside,reqno]{amsart}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{float}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage[left=1in,right=1in,bottom=1in,top=1in]{geometry}
\usepackage[pdfpagelabels,hyperindex,colorlinks=true,linkcolor=blue,urlcolor=magenta,citecolor=green]{hyperref}

\newcommand \coeffA [3][A] {{\mathbf{#1}} \sb{#2,#3}}

\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}{Lemma}[section]
\newtheorem{conj}[thm]{Conjecture}

%--------Meta Data: Fill in your info------
\title[Goldbach-like conjectures via Bertrand's Postulate]{Goldbach-like conjectures via Bertrand's Postulate}
\author[Petro Kolosov]{Petro Kolosov}
\email{kolosovp94@gmail.com}
\keywords{Bertrand's Postulate, Goldbach Conjecture, Ternary Goldbach Conjecture}
\urladdr{https://kolosovpetro.github.io}
\subjclass[2010]{11P32, 11A41, 97F60}
\date{\today}
\hypersetup{
    pdftitle={Goldbach-like conjectures via Bertrand's Postulate},
    pdfsubject={Discrete Mathematics, Number Theory},
    pdfauthor={Petro Kolosov},
    pdfkeywords={Bertrand's Postulate, Goldbach Conjecture, Ternary Goldbach Conjecture}
}
\begin{document}
    \begin{abstract}
        In this manuscript the ternary and binary Goldbach's conjectures are reviewed from Bertrand's postulate prospective.
        As a result, a relations between both ternary and binary Goldbach's conjectures and Bertrand's postulate
        are established.
        Furthermore, a three Goldbach-like conjectures are proposed and discussed.
        Verification programs are attached to the last section.
    \end{abstract}
    \maketitle
    \tableofcontents

    \section{Introduction} \label{sec:introduction}
    In number theory, Bertrand's postulate is a statement that was first conjured in 1845 by
    Joseph Bertrand~\cite{bertrand1845}.
    \begin{thm}
        \label{bertrand_theorem} (Bertrand–Chebyshev theorem.)
        For every positive integer $n>1$ exists at least one prime $p$ such that
        \[
            n < p < 2n
        \]
    \end{thm}
    Bertrand's postulate completely proved by Chebyshev in 1852~\cite{Tchebichef1852}.
    From Bertrand's postulate immediately follows
    \begin{lem}
        \label{bertrands_partition_lemma} (Even Bertrand's partition.)
        By Bertrand's postulate, for every positive integer $n>1$ there is at least one partition such that
        \[
            2n = p + \verb!odd!,
        \]
        where \verb!odd! is odd member of Even Bertrand's partition.
    \end{lem}
    Now we have to recall ternary Goldbach's conjecture or namely Goldbach's weak conjecture
    \begin{conj}
        \label{ternary_goldbach_conjecture} (Ternary Goldbach's Conjecture.)
        Every odd number greater than 7 can be expressed as the sum of three odd primes.
        \[
            2n+1 = \mathfrak{p}_i +  \mathfrak{p}_j + \mathfrak{p}_k, \quad n > 2,
        \]
        where $\mathfrak{p}_i +  \mathfrak{p}_j + \mathfrak{p}_k$ is ternary Goldbach partition.
    \end{conj}
    Ternary Goldbach's conjecture is claimed to be true by H.A Helfgott~\cite{helfgott2013minor, helfgott2014ternary}.
    Furthermore, the proof was clarified in~\cite{helfgott2015ternary}.
    From this prospective, let express the lemma~\ref{bertrands_partition_lemma} for positive odd numbers,
    \begin{lem}(Odd Bertrand's partition.)
        \label{bertrands_odd_partition_lemma}
        By Bertrand's postulate, for every positive integer $n>1$ there is at least one partition such that
        \[
            2n + 1 = p + \verb!odd! + 1 = p + \verb!even!,
        \]
        where \verb!even! is even member of Odd Bertrand's partition.
    \end{lem}
    Then we have the following relation between Odd Bertrand's Partition~\ref{bertrands_odd_partition_lemma} and
    Ternary Goldbach's Partition~\ref{ternary_goldbach_conjecture}, for every positive integer $n>2$
    \begin{equation}
        2n + 1 = p + \verb!odd! + 1 = \mathfrak{p}_i +  \mathfrak{p}_j + \mathfrak{p}_k
        \label{eq:goldbach_and_bertrand_relation}
    \end{equation}
    From equation~\eqref{eq:goldbach_and_bertrand_relation} imply the Goldbach-like conjectures
    \begin{conj}
        For every prime $p< 2n-1$ in positive Odd $2n+1, \; n>2$ Bertrand's Partition~\ref{bertrands_odd_partition_lemma},
        the prime $p$ is always a member of Ternary Goldbach's Partition
        \[
            2n+1 = \mathfrak{p}_i +  \mathfrak{p}_j + p
        \]
    \end{conj}
    \begin{conj}
        For every positive odd $2n+1, \; n>2$ Bertrand's partition~\ref{bertrands_odd_partition_lemma},
        the prime $p < 2n-1$ always satisfies
        \[
            \bigvee_{t \in \{i, j, k\}} \mathfrak{p}_t = p,
        \]
        where $\mathfrak{p}_i, \; \mathfrak{p}_j, \; \mathfrak{p}_k$ are members of ternary Goldbach's partition of $2n+1$.
    \end{conj}
    \begin{conj}
        For every positive odd $2n+1, \; n>2$ Bertrand's partition~\ref{bertrands_odd_partition_lemma}
        the even part is always a sum of two primes
        \[
            2n + 1 = p + \verb!even! \rightarrow \verb!even! = \mathfrak{p}_j + \mathfrak{p}_k, \; n > 2
        \]
    \end{conj}

    \section{Discussion}\label{sec:discussion}
    Consider the Conjecture 1.3.
    Suppose it is true.
    Then for every even integer $2k>2$, take an odd prime $p<2k$, and let $n=k+\frac{p-1}{2}$.
    Then $n<p<2n-1$, so the true scenario would imply that there is a ternary Goldbach partition of $2n+1$ containing $p$.
    But $2n+1=2k+p$, giving us a binary Goldbach partition of $2k$.

    Suppose the Conjecture 1.3 is false.
    Then for some $n > 2$, there is a prime $p$ such that $n<p<2n-1$ and $p$ is not a member
    of an odd Goldbach partition of $2n+1$.
    It implies that $2n+1-p$ is an even integer which is not the sum of two primes.

    The Conjecture 1.3 implies Goldbach strong conjecture, however from different prospective.
    It doesn't assume that all positive even numbers greater than 4 are sum of two primes,
    but only provides a relation between Bertrand's postulate and ternary Goldbach partition.
    Conjecture 1.3 is immediately true if Goldbach's strong conjecture is true.
    Conjectures 1.4, 1.5 are following directly from Conjecture 1.3.

    \section{Verification}\label{sec:verification}
    Conjecture 1.3 may be verified up to $5 \times 10^3$ via the program~\cite{kolosov2021github}.
    However, in order to verify larger bounds, the program should be optimized and rewritten using any
    low-level programming language, for instance, C or C++.
    Currently, it has an asymptotic complexity of $O(n^2)$ and written on high-level language C\#.
    The verification results are at
    \href{https://github.com/kolosovpetro/GoldbachConjecture/blob/master/GoldbachConjecture.BertrandValues.UI/PartitionsTo5000.txt}
    {\texttt{github.com/kolosovpetro/GoldbachConjecture/PartitionsTo5000.txt}}
    \bibliographystyle{unsrt}
    \bibliography{OnTheBertrandsPostulate}
\end{document}


\documentclass[twoside]{MATH77}
\usepackage{multicol}
\usepackage[fleqn,reqno,centertags]{amsmath}
\begin{document}
\begmath 18.3 Sorting Partially Ordered Data of
\hbox{Arbitrary Structure in Memory}

\silentfootnote{$^\copyright$1997 Calif. Inst. of Technology, \thisyear \ Math \`a la Carte, Inc.}

\subsection{Purpose}

Sort data having an organization or structure not supported by one of the
subprograms in Chapter~18.1, for example, data having more than one key to
determine the sorted order. This subprogram has similar functionality
to GSORTP of Chapter~18.2 and is more efficient when the data are initially
partially ordered, or when the ordering criterion is expensive to
determine.

\subsection{Usage}

\subsubsection{Program Prototype}

\begin{description}
\item[INTEGER]  \ {\bf N, L}($\geq $N){\bf , L1, COMPAR}

\item[EXTERNAL]  \ {\bf COMPAR}
\end{description}

Assign values to N and data elements indexed by~1 through N. Require
N $\geq 1.$
$$
\fbox{{\bf CALL INSORT (COMPAR, N, L, L1)}}
$$
Following the call to INSORT the contents of L(1) through L(N) contain a
linked list that defines the sorted order of the data. L1 is the index of
the first record of the sorted sequence. Let I = L(J). If I = 0 record
J is the last record in the sorted sequence, else record I is the immediate
successor of record J in the sorted sequence.

\subsubsection{Argument Definitions}

\begin{description}
\item[COMPAR]  \ [in] An INTEGER FUNCTION subprogram that defines the
relative order of elements of the data. COMPAR is invoked as COMPAR(I, J),
and is expected to return $-$1 (or any negative integer) if the $\text{I}^{th}$
element of the original data is to precede the $\text{J}^{th}$ element in
the sorted sequence, +1 (or any positive integer) if the $\text{I}^{th}$
element is to follow the $\text{J}^{th}$
element, and zero if the order is immaterial. INSORT does not have access to
the data. It is the caller's responsibility to make the data known to
COMPAR. Since COMPAR is a dummy procedure, it may have any name. Its name
must appear in an EXTERNAL statement in the calling program unit.

\item[N]  \ [in] The upper bound of the indices to be presented to COMPAR.

\item[L()]  \ [out] An array to contain the definition of the sorted
sequence. L(1:N) are set so that the immediate successor of the $%
\text{J}^{th}$ record of the sorted sequence is L(J) if the $\text{J}^{th}$
record is not the last record in the sorted sequence, else L(J) is zero.

\item[L1]  \ [out] The index of the first record of the sorted sequence.
\end{description}

\subsubsection{Converting the Linked List in L() to a Permutation Vector}

The linked list produced by INSORT (or by INSRTX, see Chapter~18-04) in
the array L() may be converted to a permutation vector by
$$
\fbox{\bf CALL PVEC (L, L1)}
$$
where L() and L1 are as above. Upon return from PVEC, L() is a permutation
vector, as described for the argument IP() of GSORTP (Chapter~18.2).

\subsection{Examples and Remarks}

The program DRINSORT illustrates the use of INSORT to sort 1000 randomly
generated real numbers. The output should consist of the single line

\hspace{.2in}INSORT succeeded

\subparagraph{Stability}

A sorting method is said to be $stable$ if the original relative order of
equal elements is preserved. This subroutine uses a  merge sort algorithm,
which is not inherently stable. To impose stability, return COMPAR =
I $-$ J if the $\text{I}%
^{th}$ and $\text{J}^{th}$ elements are equal.

\subsection{Functional Description}

The INSORT subprogram uses an opportunistic merge sort algorithm, as
described by Sedgewick \cite{Sedgewick:1983:A}, with a modification
suggested by Power \cite{Power:1980:ISU}.  In the basic opportunistic
merge sort algorithm, the first step consists of detecting either
ascending or descending sequences of initially ordered data.  In the
second step, these sequences are merged in pairs to form half as many
sequences, each approximately twice as long as the original sequences
(descending sequences are considered in reverse order).  The second step
is repeated until only one sequence remains.  The Power modification
consists of putting each sequence into a ``bucket" indexed by the base-2
logarithm of its length.  When a third sequence is to be put into a
bucket, the two longest sequences are merged and put into the next bucket.
If this would require putting three sequences into the next bucket, the
process is repeated.  Finally, sequences remaining in the buckets after
the initial order-detecting stage are merged, starting with the smallest
sequences and proceeding to the largest, to produce a single sequence.

\bibliography{math77}
\bibliographystyle{math77}

\subsection{Error Procedures and Restrictions}

INSORT neither detects nor reports any erroneous conditions.

Limitations on the size of array that can be sorted are imposed by the
amount of memory available to hold the array, and the length of an internal
array to hold the ``buckets" used in the Power modification. The number of
buckets is given by a Fortran PARAMETER, currently set to~32. This permits
sorting at least 4,294,467,295 records.

\subsection{Supporting Information}

The source language is Fortran~77.

\begin{tabular}{@{\bf}l@{\hspace{5pt}}l}
\bf Entry & \hspace{.2in} {\bf Required Files}\vspace{2pt} \\
INSORT & \hspace{.35in} INSORT\\
PVEC & \hspace{.35in} PVEC\\\end{tabular}

Designed and coded by W. V. Snyder, JPL 1974. Power modification~1980.
Adapted to MATH77,~1990.

\begcode
\medskip\

\lstset{language=[77]Fortran,showstringspaces=false}
\lstset{xleftmargin=.8in}

\centerline{\bf \large DRINSORT}\vspace{10pt}
\lstinputlisting{\codeloc{insort}}
\end{document}


\documentclass[twocolumn]{article}
\usepackage[margin=1in]{geometry}
\usepackage{outlines}
\usepackage{amsmath}
\title{Ch. 11, 12 Notes}
\author{John Yang}
\setcounter{section}{+10}

\begin{document}
\maketitle
\section{Solids and Fluids}
\subsection{States of Matter}
\begin{outline}
    \1 Solid - semirigid collection of atoms or molecules that maintains a definite shape and volume
    \1 liquid - collection of atoms or molecules that has a density similar to solids, maintains definite volume but takes the shape of its container.
    \1 gas - loose collection of atoms or molecules that exhibits flow characteristics but fills its container. More easily compressed and expanded than liquids or solids
    \1 plasma - when electrons are liberated from their parent atoms
    \1 there are other more exotic states of matter that exist (such as bose-einstein condensate)
    \1 fluids - materials that flow
\end{outline}
\subsection{Stress, Strain and Young's Modulus for Solids}
\begin{outline}
    \1 Tensile forces - forces that stretch
        \2 Elongation of a wire or rope is proportional to force applied; that is \[F=k\Delta \ell\]
    \1 If applied force is too large, the rope permanently deforms and is said to be \textbf{inelastic}. Even greater forces cause the rope to break
\0 \[\Delta \ell = \dfrac{1}{E} \dfrac{F\ell}{A}\] \[k=\dfrac{EA}{\ell}\]
    \1 where $E$ is the Young's Modulus of the material; constant. $A$ is the cross sectional area of the rope.
    \1 tensile stress $\equiv \dfrac{F}{A}$
    \1 tensile strain $\equiv\dfrac{\Delta \ell}{\ell}$
    \1 therefore, \[E\equiv\dfrac{\text{tensile stress}}{\text{tensile strain}}=\dfrac{F/A}{\Delta \ell/\ell}\]
    \1 shear stress, forces applied opposite and parallel over a separation $\ell$
    \1 shear stress $= F/A$
    \1 shear strain $=\Delta \ell/\ell$, where $\Delta \ell$ is the deformation
    \1 shear modulus $G$ is shear stress over shear strain;
    \[G=\dfrac{F/A}{\Delta \ell/\ell}\]
    \1 change in volume is $\Delta V = V_f-V_i$
    \1 Bulk modulus $B$ is \[B\equiv-\dfrac{\text{pressure}}{\text{volume strain}}\], where volume strain is $\Delta V/V_i$
    \1 Compressibility $\beta$ is \[\beta\equiv\dfrac{1}{B}\]
\end{outline}
\subsection{Fluid Pressure}
\begin{outline}
    \1 \[P=\dfrac{dF}{dA}\]
    \1 Pressure is a scalar; magnitude of force per unit area acting on any differential area regardless of orientation within the fluid
    \1 Units: $1\text{ N}/\text{m}^2\equiv1\text{ Pa}$
        \2 $1\text{ atm}\equiv101.325\text{ kPa}$
    \1 gauge pressure $\equiv P-1\text{ atm}$
\end{outline}
\subsection{Static Fluids}
\begin{outline}
\0 \[\dfrac{dP}{dy}=-\rho g\]
    \1 For incompressible fluids, \[P(y)=P_0-\rho gy\]
    \1 Pressure is the same  at all points at same depth or elevation regardless of horizontal location
    \1 For compressible fluids, density is a function of height.
\0 \[P(y)=P_0e^{-\dfrac{\rho_0}{P_0}gy}\]
    \1 Scale height $\equiv\dfrac{P_0}{\rho_0g}$
\end{outline}
\subsection{Pascal's principle}
\begin{outline}
    \1 If pressure is increased on the surface of an enclosed liquid, pressure increases by the same amount at all points throughout the liquid and on the walls of the container, regardless of shape.
\0 \[\dfrac{F_1}{A_1}=\dfrac{F_2}{A_2}\]
\end{outline}
\subsection{Archimedes' Principle}
\begin{outline}
    \1 a system submerged or floating in a fluid has a buoyant force acting on it with a magnitude equal to the weight of the fluid displaced. Direction is upwards. \[F_{buoy}=\rho_{fluid}V'g\]
    \1 where $V'$ is the volume of the system immersed in the fluid; if the system is totally submerged, $V'=V$
    \1 a system will float in any liquid with a density greater than the avg. density of the system.
\end{outline}
\subsection{The center of buoyancy}
\begin{outline}
    \1 The weight acts at the center of mass of the object, which depends on the shape and mass distribution of the object.
    \1 Buoyant force acts at the position of the center of mass of the fluid imagined to be in the hole created by the object in the fluid, a point known as the center of buoyancy.
    \1 For a totally submerged system to be in stable equilibrium, the center of mass must be below the center of buoyancy.
    \1 The point of intersection of the original line of action of the buoyant force with the new line of action of the buoyant force is known as the \textbf{metacenter}
    \1 if the elevation of the metacenter is above the elevation of the cm, the system will return to its original orientation when tilted and the floating equilibrium is stable. If the elevation of the metacenter is below the cm, then the system is in unstable equilibrium bc the torque of the buoyant force accentuates the tilt, causing the system to roll over.
    \1 a floating system is in stable equilibrium if the metacenter is above the cm in every possible roll. The same is true for submerged systems.
\end{outline}
\subsection{Surface tension}
\begin{outline}
    \1 some objects more dense than certain liquids can float due to increased intermolecular forces at the surface of the liquid.
    \1 magnitude of surface tension force is \(\gamma\ell\) where $\gamma$ is the coefficient of surface tension of the liquid and $\ell$ is the perimeter of the part of the floating object in contact with the liquid.
\end{outline}
\subsection{Capillary action}
\begin{outline}
    \1 The forces between a molecule and another molecule of a liquid are cohesive forces, and forces between a molecule of liquid and another material are adhesive forces.
    \1 contact angle $\theta_{cont}$, angle b/w vertical direction of container and surface of liquid at wall of container.
        \2 angles less than 90, concave meniscus and wetting occurs.
        \2 angles greater than 90, no wetting and convex meniscus.
    \1 when wetting occurs, surface tension draws the liquid up a thin tube inserted into the liquid; capillary action. Continues until surface tension equals the weight of the liquid in the tube. \[\gamma\ell\cos{\theta_{cont}}=mg\]
    \1 If tube has circular cross section, \[h=\dfrac{2\gamma\cos{\theta_{cont}}}{\rho gr}\]
\end{outline}
\subsection{Fluid dynamics: Ideal fluid}
\begin{outline}
    \1 \textbf{Ideal fluid:}
        \2 no viscous or frictional effects
        \2 flow is steady, that is, velocity doesn't change with time
        \2 density is constant; incompressible flow
        \2 no rotational currents, that is, no turbulence
\end{outline}
\subsection{Equation of flow continuity}
\begin{outline}
    \1 A small particle of flowing incompressible fluid follows a path called a streamline. A set of streamlines makes up a flow tube.
    \1 eqn of flow continuity:
    \1 At any two points along a flow tube, \[\rho_1A_1v_1=\rho_2A_2v_2\]
    \1 For incompressible fluids, density is constant; \[A_1v_1=A_2v_2\]
\end{outline}
\subsection{Bernoulli's Principle for Incompressible Ideal Fluids}
\begin{outline}
\0 \[P_1+\dfrac{1}{2}\rho v^2_1+\rho gy_1=P_2 +\dfrac{1}{2}\rho v^2_2+\rho gy_2\]
    \1 In other words, the quantity \(P+\dfrac{1}{2}\rho v^2+\rho gy\) has the same value at every point along a flow tube.
    \1 If the fluid isn't moving, \[P=P_0-\rho gy\]
    \1 In a horizontal pipe, \[P_1+\dfrac{1}{2}\rho v^2_1=P_2 +\dfrac{1}{2}\rho v^2_2\]
    \1 In other words, pressure decreases as the speed of the fluid increases.
\end{outline}
\subsection{Nonideal Fluids}
\begin{outline}
    \1 coefficient of viscosity $\eta$- measure of a fluid's resistance to flow
\0 \[\eta=\dfrac{F/A}{\Delta v/\Delta y}\]
    \1 imagine viscous fluids to be a series of planes of thin fluid layers stacked on top of each other; each plane exerts a frictional/viscous force on the layers it's in contact with
\end{outline}
\subsection{Viscous Flow}
\begin{outline}
    \1 Poiseuille's law, for circular pipes \[|\Delta P|=\dfrac{8}{\pi r^4}Q\eta\ell\]
\end{outline}
\section{Waves}
\subsection{What is a wave?}
\begin{outline}
    \1 A classical wave is a propagating disturbance that transfers energy and momentum at its own characteristic speed from one region of space to another with little if any mass transfer.
\end{outline}
\subsection{Longitudinal and Transverse Waves}
\begin{outline}
    \1 Waves whose oscillation is along the line the wave propagates are longitudinal waves.
    \1 Waves whose oscillation is perpendicular to the line along which the wave propagates are transverse waves
    \1 The plane in which the oscillations of a transverse wave occur is the plane of polarization of the transverse wave.
    \1 waves can be either or both transverse and longitudinal
\end{outline}
\subsection{Wavefunctions, waveforms and oscillations}
\begin{outline}
    \1 wavefunction $\Psi$ represents how a wave propagates through space and time; therefore it is a function of space and time; \(\Psi(x,y,z,t)\)
    \1 waveform - freezing a wave in time by taking a sort of snapshot of it at a certain point in time; \(\Psi(x,y,z,t_0)\)
    \1 oscillation; imagine a specific point \((x_0,y_0,z_0)\) and examine its behavior as a function of time.
\end{outline}
\subsection{Waves propagating in one, two, and three dimensions}
\begin{outline}
    \1 peaks are crests and minima are troughs
    \1 wavelength is distance from crest to crest or trough to trough
    \1 wave train - area in space where waveform is nonzero
    \1 Waveforms with wave trains of finite extent are wavepackets.
\end{outline}
\subsection{One-D waves at constant velocity}
\begin{outline}
    \1 One-D wave propagating at constant speed $v$ for increasing values of $x$ is \(\Psi(x-vt)\)
    \1 One-D wave propagating at constant speed $v$ for decreasing values of $x$ is \(\Psi(x+vt)\)
\end{outline}
\subsection{The classical wave equation for one-d waves}
\begin{outline}
    \1 Classical wave equation for one-d waves is \[\dfrac{\partial^2\Psi}{\partial x^2}-\dfrac{1}{v^2}\dfrac{\partial^2\Psi}{\partial t^2}=0\]
\end{outline}
\subsection{Periodic waves}
\begin{outline}
    \1 waves that periodically repeat themselves are periodic waves.
\0 \[v=f\lambda=\dfrac{\lambda}{T}\]
\end{outline}
\subsection{Sinusoidal (harmonic) waves}
\begin{outline}
\0 \[\Psi(x,t)=A\cos\left[k(x-vt)\right]\] where \(k(x-vt)\) is measured in radians and not degrees.
    \1 waveform of a sinusoidal wave at $t=0$ \[\Psi(x,0\text{ s})=A\cos(kx)\]
    \1 the constant $k$ is \[k=\dfrac{2\pi\text{ rad}}{\lambda}\] which is known as the angular wavenumber, which represents the number of wavelengths in exactly $2\pi$ meters.
    \1 standard form of a sinusoidal wave is \[\Psi(x,t)=A\cos(kx-\omega t)\]
\end{outline}
\subsection{Waves on a string}
\begin{outline}
    \1 wave speed on a string is \[v=\sqrt{\dfrac{F}{\mu}}\] where $F$ is the tension in the string and $\mu$ is the linear mass density $m/\ell$
    \1 In solids, the speed of sound is \[v_{solid}=\sqrt{\dfrac{E}{\rho}}\] where $E$ is the young's modulus of the material and $\rho$ is the density
    \1 In liquids, the speed of sound is \[v_{liquid}=\sqrt{\dfrac{B}{\rho}}\] where $B$ is the bulk modulus.
\end{outline}
\subsection{Reflection and transmission of waves}
\begin{outline}
    \1 rope with fixed end, reflects and changes phase by $\pi$. Flips.
    \1 rope with free end, reflects but doesn't change phase. No flip.
    \1 wave traveling through a boundary of two strings with diff. mass per unit length. Both transmission and reflection.
\end{outline}
\subsection{energy transport via mechanical waves}
\begin{outline}
\1 power transfer in a mechanical wave is \[P=\dfrac{1}{2}\mu\omega^2A^2v\] (in a string). Power transfer is proportional to the square of angular frequency, square of amplitude, and to the propagation speed of the wave.
\end{outline}
\subsection{Wave Intensity}
\begin{outline}
    \1 Intensity of a wave is the average power transmitted by the wave through one square meter oriented perpendicular to the direction the wave is propagating
    \1 From previous eqn, intensity of a wave is proportional to square of amplitude and square of frequency.
    \1 Intensity from a point source is \[I=\dfrac{P}{4\pi r^2}\] inverse square
\end{outline}
\subsection{What is a sound wave?}
\begin{outline}
    \1 sound exists in an elastic material if a propagating disturbance is a variation in the ambient density caused by a bulk shift in the positions of the particles of the material away from their nominal equilibrium positions. \1 Density wave disturbance $\Psi_{density}$ is $\pi/2$ rad out of phase with particle position wave disturbance $\Psi_{position}$
\end{outline}
\subsection{sound intensity and sound level}
\begin{outline}
    \1 threshold of hearing is \(I_0\equiv10^{-12}\text{ W/m}^2\)
    \1 Intensity level $\beta$ is \[\beta\equiv(10\text{ dB})\log_{10}\dfrac{I}{I_0}\]
    \1 Each factor of 10 increase in sound intensity produces an additive change in sound level of 10 dB
\end{outline}
\subsection{Acoustic Doppler effect}
\begin{outline}
    \1 general equation, linear motion \[f'=f\left(\dfrac{v\pm v_{obs}}{v\mp v_{source}}\right)\]
    \1 $+$ sign if source is moving away and $-$ sign if source is moving toward observer
    \1 even more general equation, if the medium is moving \[f'=f\left(\dfrac{v\pm v_{med}\pm v_{obs}}{v\pm v_{med}\mp v_{source}}\right)\]
\end{outline}
\subsection{Shock waves}
\begin{outline}
    \1 Speed of the source exceeds the speed of sound
    \1 Mach number $=\dfrac{v_{source}}{v}$
    \1 mach angle $\phi$,  \(\sin\phi=\dfrac{1}{\text{Mach number}}\)
\end{outline}
\subsection{Diffraction of waves}
\begin{itemize}
    \item Diffraction - spreading out of waves after they pass through or around obstacles or openings comparable in size to the wavelength.
\end{itemize}
\subsection{Principle of superposition}
\begin{outline}
\1 When two or more similar types of waves exist simultaneously at a point in space, we say the waves interfere with each other. If the resulting wave disturbance at a point is greater than that produced by any of the waves acting alone, we say the waves exhibit constructive interference. If the resulting disturbance is less that that produced by the waves acting alone, the waves exhibit destructive interference.
\end{outline}
\subsection{Standing waves}
\begin{outline}
\1 locations with 0 wave disturbance are nodes
\1 successive nodes are separated in space by half a wavelength, as well as antinodes on a string fixed at both ends
\1 Disturbance resulting from superposition of two waves of equal amplitude and frequency traveling in opposite directions is called a standing wave
\1 permitted wavelengths on a string are \[\lambda_n=\dfrac{2\ell}{n}\] where $n$ is a positive integer
\1 frequencies of higher harmonics are integer multiples of the fundamental frequency $f_1$
\1 frequencies that may exist on the string are called eigenfrequencies
\1 collection of allowed frequencies and their amplitudes is called the frequency spectrum of the system.
\1 closed pipe frequencies \[\lambda_n=\dfrac{4\ell}{n}\] always a node at the closed end, goes 1,3,5$f$
\1 open pipe frequencies \[\lambda_n=\dfrac{2\ell}{n}\] always antinodes at open ends, goes 1,2,3$f$
\end{outline}
\subsection{Wave groups and beats}
\begin{outline}
\1 If the speeds of waves of different frequency are not the same, we say there is dispersion; which means that the speeds of individual waves depend on the particular wavelength or frequency.
\0 \[f_b=|f_1-f_2|\]
\end{outline}
\subsection{Fourier analysis and the uncertainty Principles}
\begin{outline}
\1 fourier analysis - modeling things as sinusoidal functions
\1 the frequencies in a Fourier representation of a periodic oscillation always are harmonics of the fundamental frequency of the periodic oscillation
\1 any periodic function can be represented by a fourier sum of harmonic, sinusoidal functions having a discrete spectrum.
\0 \[\Delta t\Delta\omega\approx2\pi\text{ rad}\]
\1 which means that the shorter the duration of the pulse (of a wave), the greater the spread of the angular frequencies in its Fourier representation, and vice versa. Also, \[\Delta x\Delta k\approx2\pi\text{ rad}\]
\1 which are known as uncertainty relations.
\end{outline}
\end{document}


\documentclass[10pt]{article}

% landscape, twocolumn
\usepackage[a4paper, landscape, twocolumn, twoside]{geometry}
% \usepackage[a4paper, top = 0.6in, bottom = 0.3in, left = 0.5in, right = 0.5in, landscape, twocolumn, twoside]{geometry}

\usepackage{calc}
\setlength{\topmargin}{-1in + 15pt}
\setlength{\headheight}{12pt}
\setlength{\headsep}{10pt}
\setlength{\footskip}{0pt}
\setlength{\textheight}{\paperheight - 60pt}

\setlength{\oddsidemargin}{-1in + 30pt}
\setlength{\evensidemargin}{-1in + 30pt}
\setlength{\textwidth}{\paperwidth - 60pt}

\usepackage[xetex, colorlinks]{hyperref}
\usepackage{fontspec, xunicode, xltxtra}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{color}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fancyhdr}

\setlength{\columnsep}{0.4in}

\pagestyle{fancy}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO,RE]{\bfseries\leftmark}
\fancyhead[C]{\bfseries foreverbell}
\fancyfoot{}

% \newfontfamily{\lsttype}{Liberation Mono}

\definecolor{dkgreen}{RGB}{63, 127, 85}
\definecolor{dkpurple}{RGB}{127, 0, 85}
\definecolor{dkgrey}{RGB}{127, 127, 127}
\definecolor{dkred}{RGB}{154, 0, 0}
\lstset {
  basicstyle = \small\ttfamily,
  language = C++,
  aboveskip = 0pt,
  numbers = left,
  numberstyle = \footnotesize\ttfamily\color{dkgrey},
  numbersep = 5pt,
  tabsize = 2,
  breaklines = true,
  breakindent = 1.1em,
  keywordstyle = \color{dkpurple},
  commentstyle = \color{dkgreen},
  backgroundcolor = \color{white},
  stringstyle = \color{dkred},
  deletekeywords = {in},
  showspaces = false,
  basewidth = {0.5em, 0.4em},
  frame = trbl,
  rulecolor = \color{dkgrey},
  showstringspaces = false,
  escapeinside = {<TeX>}{</TeX>}
}
\begin{document}
% \title{\LARGE Reference Document \& Code Library}
% \date{}
% \author{\textbf{foreverbell}}
% \maketitle
\tableofcontents
\newpage

\section{Data Structure}
\subsection{Splay}
\lstinputlisting{src/data-structure/splay.cpp}
\subsection{Dynamic Tree}
\lstinputlisting{src/data-structure/link-cut-tree.cpp}
\subsection{KD Tree}
\lstinputlisting{src/data-structure/kd-tree.cpp}
\subsection{Treap}
\lstinputlisting{src/data-structure/treap.cpp}
\subsection{Persistent Treap}
\lstinputlisting{src/data-structure/persistent-treap.cpp}
\subsection{Persistent Segment Tree}
\lstinputlisting{src/data-structure/persistent-segment-tree.cpp}

\section{String Algorithms}
\subsection{Base}
\lstinputlisting{src/string-algorithm/kmp.cpp}
\lstinputlisting{src/string-algorithm/minimum-representation.cpp}
\lstinputlisting{src/string-algorithm/manacher.cpp}
\subsection{Aho-Corasick Automaton}
\lstinputlisting{src/string-algorithm/aho-corasick-automaton.cpp}
\subsection{Suffix Array}
\lstinputlisting{src/string-algorithm/suffix-array.cpp}

\section{Math}
\subsection{Number Theory}
\lstinputlisting{src/math/number-theory/base.cpp}
\lstinputlisting{src/math/number-theory/inverse.cpp}
\lstinputlisting{src/math/number-theory/crt.cpp}
\lstinputlisting{src/math/number-theory/prime.cpp}
\lstinputlisting{src/math/number-theory/factorize.cpp}
\lstinputlisting{src/math/number-theory/discrete-logarithm.cpp}
\lstinputlisting{src/math/number-theory/primitive-root.cpp}
\lstinputlisting{src/math/number-theory/ressol.cpp}
\subsection{Matrix Multiplication}
\lstinputlisting{src/math/matrix.cpp}
\paragraph{$\blacksquare$ Optimization of recursion matrix}
\noindent \\
$h_n=a_1h_{n-1}+a_2h_{n-2}+a_3h_{n-3}+ \ldots + a_kh_{n-k}$, Construct matrix of $k*k$:
\begin{gather*}
  \mathbf{M} =
  \begin{bmatrix}
    a_1 & a_2 & a_3 & \cdots & a_{k-2} & a_{k-1} & a_k \\
    1 & 0 & 0 & \cdots & 0 & 0 & 0 \\
    0 & 1 & 0 & \cdots & 0 & 0 & 0 \\
    0 & 0 & 1 & \cdots & 0 & 0 & 0 \\
    \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots \\
    0 & 0 & 0 & \cdots & 1 & 0 & 0 \\
    0 & 0 & 0 & \cdots & 0 & 1 & 0 \\
  \end{bmatrix}
\end{gather*}
Then the characteristic polynomial of $\mathbf{M}$ is
\begin{gather*}
  f(\lambda)=|\lambda \mathbf{E} - \mathbf{M}| =
  \begin{bmatrix}
    \lambda - a_1 & -a_2 & -a_3 & \cdots & -a_{k-2} & -a_{k-1} & -a_k \\
    -1 & \lambda & 0 & \cdots & 0 & 0 & 0 \\
    0 & -1 & \lambda & \cdots & 0 & 0 & 0 \\
    0 & 0 & -1 & \cdots & 0 & 0 & 0 \\
    \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots \\
    0 & 0 & 0 & \cdots & -1 & \lambda & 0 \\
    0 & 0 & 0 & \cdots & 0 & -1 & \lambda \\
  \end{bmatrix}
  \\
  =\lambda ^k - a_1 \lambda ^ {k-1} - a_2 \lambda ^ {k-2} - \ldots - a_k.
\end{gather*}
Apply Hamilton-Cayley theorem, we have $f(\mathbf{M})=\mathbf{0}$. \\
And, $\forall i$, $\mathbf{M} ^ i$ can be written as a linear combination of $\mathbf{E}$,$\mathbf{M}$,$\mathbf{M} ^2$,$\ldots$,$\mathbf{M} ^ {k-1}$.\\
So the matrix multiplication is reduced to polynomial multiplication, which can be computed in $O(n^2)$. \\
\lstinputlisting{src/math/linear-recurrence-sequence.cpp}
\paragraph{$\blacksquare$ Spanning tree count}
\noindent \\
Laplacian matrix $L=(\ell_{i,j})_{n*n}$ is defined as: $L=D-A$, that is, it is the difference of the degree matrix $D$ and the adjacency matrix $A$ of the graph. \\
From the definition it follows that:
\begin{displaymath}
  \ell_{i,j}=
  \left\{ \begin{array}{ll}
    deg(v_i) & \textrm{if } i=j \\
    -1 & \textrm{if }i\ne j\textrm{ and }v_i\textrm{ is adjacent to }v_j \\
    0 & \textrm{otherwise}
  \end{array} \right.
\end{displaymath}
Then the number of spanning trees of a graph on $n$ vertices is the determinant of any $n-1$ submatrix of $L$.
\subsection{Gauss Elimiation}
\lstinputlisting{src/math/gauss-elimination.cpp}
\subsection{Polynomial Root}
\lstinputlisting{src/math/polynomial-root.cpp}
\subsection{Number Partition}
\lstinputlisting{src/math/number-partition.cpp}
\subsection{Simplex Linear Programming}
\lstinputlisting{src/math/simplex-linear-programming.cpp}
\subsection{Simpson Integration}
\lstinputlisting{src/math/simpson-integration.cpp}
\subsection{Fast Fourier Transform}
\lstinputlisting{src/math/fast-fourier-transform.cpp}
\subsection{Number Theoretic Transform}
\lstinputlisting{src/math/number-theoretic-transform.cpp}

\section{Computational Geometry}
\subsection{2D Base}
\lstinputlisting{src/computational-geometry/2d-base.cpp}
\subsection{Graham Convex Hull}
\lstinputlisting{src/computational-geometry/convex-hull-2d.cpp}
\subsection{Minkowski Sum of Convex Hull}
\noindent
Wiki: \\
The Minkowski sum of two sets of position vectors $A$ and $B$ in Euclidean space is formed by adding each vector in $A$ to each vector in $B$, i.e. the set
\begin{displaymath}
  A+B=\{ \vec{a} + \vec{b} \, | \, \vec{a} \in A, \vec{b} \in B \}.
\end{displaymath}
For all subsets $S_1$ and $S_2$ of a real vector-space, the convex hull of their Minkowski sum is the Minkowski sum of their convex hulls $\mathrm{Conv} (S_1 + S_2) = \mathrm{Conv} (S_1) + \mathrm{Conv} (S_2)$. \\
Minkowski sums are used in motion planning of an object among obstacles. They are used for the computation of the configuration space, which is the set of all admissible positions of the object. In the simple model of translational motion of an object in the plane, where the position of an object may be uniquely specified by the position of a fixed point of this object, the configuration space are the Minkowski sum of the set of obstacles and the movable object placed at the origin and rotated $180$ degrees. \\
\lstinputlisting{src/computational-geometry/minkowski-convex-hull.cpp}
\subsection{Rotating Calipers}
\lstinputlisting{src/computational-geometry/rotating-caliper.cpp}
\subsection{Closest Pair Points}
\lstinputlisting{src/computational-geometry/closest-pair-points.cpp}
\subsection{Halfplane Intersection}
\lstinputlisting{src/computational-geometry/halfplane-intersection.cpp}
\lstinputlisting{src/computational-geometry/halfplane-intersection-nlogn.cpp}
\subsection{Tri-Cir Intersection \& Tangent}
\lstinputlisting{src/computational-geometry/circle-tangent.cpp}
\lstinputlisting{src/computational-geometry/circle-intersection.cpp}
\lstinputlisting{src/computational-geometry/triangle-circle-area-intersection.cpp}
\subsection{Circle Area Union}
\lstinputlisting{src/computational-geometry/circle-area-union.cpp}
\subsection{Minimum Covering Circle}
\lstinputlisting{src/computational-geometry/minimum-circle.cpp}
\subsection{Convex Polygon Area Union}
\lstinputlisting{src/computational-geometry/polygon-area-union.cpp}
\subsection{3D Base}
\lstinputlisting{src/computational-geometry/3d-base.cpp}
\subsection{3D Convex Hull}
\lstinputlisting{src/computational-geometry/convex-hull-3d.cpp}
\subsection{Quaternion}
\lstinputlisting{src/computational-geometry/quaternion.cpp}

\section{Graph}
\subsection{Tarjan}
\lstinputlisting{src/graph-algorithm/tarjan.cpp}
For bidirectional graph(cut vertex \& bridge): \\
root: $u$ has $2$ or more children. \\
others: exist a child $v$ satifsying $dfn[u] \le low[v]$. \\
$(u, v)$ is bridge only if $dfn[u] < low[v]$ (trick: multiple edges).\\
\subsection{Maximum Flow}
\lstinputlisting{src/graph-algorithm/maximum-flow.cpp}
Notes on vertex covering and independent set on bipartite graph:\\
Minimum Vertex Covering Set V': $\forall (u,v) \in E$, $u \in V'$ or $v \in V'$ holds. \\
Maximum Vertex Independent Set V': $\forall u,v \in V'$, $(u,v) \notin E$ holds.\\
Construct a flow graph $G$, run DFS from $s$ on reduction graph, the vertices not visited in left side and visited in right side form the minimum vertex covering set.\\
Maximum vertex independent set vice versa.\\
\subsection{Minimum Cost, Maximum Flow}
\lstinputlisting{src/graph-algorithm/minimum-cost-maximum-flow.cpp}
\subsection{Kuhn Munkras}
\lstinputlisting{src/graph-algorithm/kuhn-munkras.cpp}
\subsection{Hopcroft Karp}
\lstinputlisting{src/graph-algorithm/hopcroft-karp.cpp}
\subsection{Blossom Matching}
\lstinputlisting{src/graph-algorithm/blossom-matching.cpp}
\subsection{Stoer Wagner}
\lstinputlisting{src/graph-algorithm/stoer-wagner.cpp}
\subsection{Arborescence}
\lstinputlisting{src/graph-algorithm/arborescence.cpp}
\subsection{Manhattan MST}
\lstinputlisting{src/graph-algorithm/manhattan-mst.cpp}
\subsection{Minimum Mean Cycle}
\lstinputlisting{src/graph-algorithm/minimum-mean-cycle.cpp}
\subsection{Dominator Tree}
\noindent
A dominator tree is a tree where each node's children are those nodes it immediately dominates. Because the immediate dominator is unique, it is a tree. The start node is the root of the tree.
\lstinputlisting{src/graph-algorithm/dominator-tree.cpp}

\section{Miscellaneous}
% \subsection{High Precision Calculation}
% \lstinputlisting{src/high-precision-calculation.cpp}
\subsection{Parser}
\lstinputlisting{src/misc/parser.cpp}
\subsection{Steiner's Problem}
\lstinputlisting{src/misc/steiner-problem.cpp}
\subsection{AlphaBeta}
\lstinputlisting{src/misc/alphabeta.cpp}
\subsection{LCA}
\lstinputlisting{src/misc/lowest-common-ancestor.cpp}
\subsection{Divide and Conquer on Tree}
\lstinputlisting{src/misc/divide-and-conquer-on-tree.cpp}
\subsection{Dancing Links X}
\lstinputlisting{src/misc/dancing-links-x.cpp}
Find the minimum row set, satisfying each column has exactly one $1$. \\
Let the row representing each choice, if some choices are mutually exclusive, add a column with these rows associated. \\
Use the sudoku problem as an instance. There are $729$ choices($81$ squares can be filled in with $9$ numbers), $4$ constraints:\\
(1). Each box has exactly one number; \\
(2). Number $1$ to $9$ appears exactly once in each row, column, sub square. \\
Thus we can construct a $729*324$ matrix, each $81$ columns representing each constraint.\\
\subsection{Mo-Tao Algorithm}
\lstinputlisting{src/misc/motao-algorithm.cpp}
\subsection{Cyclic LCS}
\lstinputlisting{src/misc/cyclic-longest-common-subsequence.cpp}

\section{Tips}
\subsection{Snippets \& Black Magic}
\begin{itemize}
  \item Accelerated C++ stream IO
    \begin{lstlisting}[frame=none]
#include <iomanip>
ios_base::sync_with_stdio(false);
    \end{lstlisting}
  \item Enumerate all non-empty subsets
    \begin{lstlisting}[frame=none]
for (int sub = mask; sub > 0; sub = (sub - 1) & mask)
    \end{lstlisting}
  \item Enumerate $\mathrm{C}_{n}^{k}$
    \begin{lstlisting}[frame=none]
for (int comb = (1 << k) - 1; comb < 1 << n; ) {
  // ...
  int x = comb & -comb, y = comb + x;
  comb = ((comb & ~y) / x >> 1) | y;
}
    \end{lstlisting}
  \item Convert YY/MM/DD to date
    \begin{lstlisting}[frame=none]
int days(int y, int m, int d) {
  if (m < 3) y--, m += 12;
  return 365 * y + y / 4 - y / 100 + y / 400 + (153 * m + 2) / 5 + d;
}
    \end{lstlisting}
  \item Calculate $\lfloor f(n/d) \rfloor$, $d=1, 2, \ldots, n$.
    \begin{lstlisting}[frame=none]
void iterate(int n) { // calc sum f(n/d), d<-[1..n]
  int root = sqrt(double(n)), to = n;
  for (int d = 1; d <= root; ++d) {
    int l = n / (d + 1), r = n / d;
    // (r - l) * f(d)
    to = min(to, l);
  }
  for (int d = 1; d <= to; ++d) {
    // accumlate single f(n / d)
  }
}
    \end{lstlisting}
  \item pb-ds
    \lstinputlisting[frame=none]{src/pb-ds.cpp}
  \item mulmod
    \lstinputlisting[frame=none]{src/mulmod.cpp}
  \item Modify stack limit
    \lstinputlisting[frame=none]{src/stack-limit.cpp}
\end{itemize}
\subsection{Formulas}
\subsubsection{Geometry}
\paragraph{$\blacksquare$ Euler's Formula}
\noindent \\
For convex polyhedron: $V-E+F=2$. \\
For planar graph: $|F|=|E|-|V|+n+1$, $n$ denotes the number of connected components.
\paragraph{$\blacksquare$ Pick's Theorem}
\begin{eqnarray*}
  S=I+\frac{B}{2}-1
\end{eqnarray*}
$S$ is the area of lattice polygon, $I$ is the number of lattice interior points, and $B$ is the number of lattice boundary points.
\paragraph{$\blacksquare$ Heron's Formula}
\begin{eqnarray*}
  && S=\sqrt{p(p-a)(p-b)(p-c)} \\
  && p=\frac{a+b+c}{2}
\end{eqnarray*}
\paragraph{$\blacksquare$ Volumes}
\noindent
\begin{itemize}
  \item Pyramid $V=\frac{1}{3}Sh$.
  \item Sphere $V=\frac{4}{3}\pi R^3$.
  \item Frustum $V=\frac{1}{3}h(S_1+\sqrt {S_1S_2}+S_2)$.
  \item Ellipsoid $V=\frac{4}{3} \pi abc$.
  \item Tetrahedron \\
    For tetrahedron $O-ABC$, let $a=AB,b=BC,c=CA,d=OC,e=OA,f=OB$, ${(12V)}^2=a^2d^2(b^2+c^2+e^2+f^2-a^2-d^2)+b^2e^2(c^2+a^2+f^2+d^2-b^2-e^2)+c^2f^2(a^2+b^2+d^2+e^2-c^2-f^2)-a^2b^2c^2-a^2e^2f^2-d^2b^2f^2-d^2e^2c^2$.
\end{itemize}
\paragraph{$\blacksquare$ Radius of Inscribedcircle \& Circumcircle}
\begin{eqnarray*}
  && r=\frac{2S}{a+b+c},\, R=\frac{abc}{4S}
\end{eqnarray*}
\paragraph{$\blacksquare$ Hypersphere}
\begin{eqnarray*}
  && V_2=\pi R^2,\, S_2=2\pi R \\
  && V_3=\frac{4}{3}\pi R^3,\, S_3=4\pi R^2 \\
  && V_4=\frac{1}{2}\pi ^2 R^4,\, S_4=2\pi ^2 R^3 \\
  && V_5=\frac{8}{15}\pi ^2 R^5,\, S_5=\frac{8}{3}\pi ^2 R^4 \\
  && V_6=\frac{1}{6}\pi ^3 R^6,\, S_6=\pi ^3 R^5 \\
  && \mathrm{Generally}, V_n=\frac{2\pi}{n}V_{n-2},\, S_{n-1}=\frac{2\pi}{n-2}S_{n-3} \\
  && \mathrm{Where}, S_0=2,\, V_1=2,\, S_1=2\pi ,\, V_2=\pi
\end{eqnarray*}
% \paragraph{$\blacksquare$ Affine Transformation}
% \begin{gather*}
% \mathrm{Tr} = \mathrm{TrTra} * \mathrm{TrRot} * \mathrm{TrSca} =
% \begin{bmatrix}
% 1 & 0 & T_x \\
% 0 & 1 & T_y \\
% 0 & 0 & 1
% \end{bmatrix}
% \begin{bmatrix}
% \cos \alpha & - \sin \alpha & 0 \\
% \sin \alpha & \cos \alpha & 0 \\
% 0 & 0 & 1
% \end{bmatrix}
% \begin{bmatrix}
% S_x & 0 & 0 \\
% 0 & S_y & 0 \\
% 0 & 0 & 1
% \end{bmatrix}
% \\
% =
% \begin{bmatrix}
% S_x \cos \alpha & -S_y \sin \alpha & T_x \\
% S_x \sin \alpha & S_y \cos \alpha & T_y \\
% 0 & 0 & 1
% \end{bmatrix}
% \end{gather*}
% The fixed point is $(x_0,y_0)$, where
% \begin{eqnarray*}
% && x_0 =  - \frac{T_x (S_y \cos \alpha - 1)}{S_x S_y - S_x \cos \alpha - S_y \cos \alpha + 1} - \frac{S_y T_y \sin \alpha}{S_x S_y - S_x \cos \alpha - S_y \cos \alpha + 1} \\
% && y_0 = \frac{S_x T_x \sin \alpha}{S_x S_y - S_x \cos \alpha - S_y \cos \alpha + 1} - \frac{T_y (S_x \cos \alpha - 1)}{S_x S_y - S_x \cos \alpha - S_y \cos \alpha + 1}
% \end{eqnarray*}
\paragraph{$\blacksquare$ Matrix of rotating $\theta$ about arbitrary axis A}
\begin{gather*}
  \begin{bmatrix}
    c+(1-c)A_x^2 & (1-c)A_xA_y-sA_z & (1-c)A_xA_z+sA_y \\
    (1-c)A_xA_y+sA_z & c+(1-c)A_y^2 & (1-c)A_yA_z-sA_x \\
    (1-c)A_xA_z-sA_y & (1-c)A_yA_z+sA_x & c+(1-c)A_z^2
  \end{bmatrix}
\end{gather*}
Where $c=\cos(\theta)$, $s=\sin(\theta)$ and $A=(A_x,A_y,A_z)$.
\subsubsection{Math}
\paragraph{$\blacksquare$ Sums}
\begin{eqnarray*}
  && 1+2+\ldots +n=\frac{n^2}{2}+\frac{n}{2} \\
  && 1^2+2^2+\ldots +n^2=\frac{n^3}{3}+\frac{n^2}{2}+\frac{n}{6} \\
  && 1^3+2^3+\ldots +n^3=\frac{n^4}{4}+\frac{n^3}{2}+\frac{n^2}{4} \\
  && 1^4+2^4+\ldots +n^4=\frac{n^5}{5}+\frac{n^4}{2}+\frac{n^3}{3}-\frac{n}{30} \\
  && 1^5+2^5+\ldots +n^5=\frac{n^6}{6}+\frac{n^5}{2}+\frac{5n^4}{12}-\frac{n^2}{12} \\
  && 1^6+2^6+\ldots +n^6=\frac{n^7}{7}+\frac{n^6}{2}+\frac{n^5}{2}-\frac{n^3}{6}+\frac{n}{42} \\
  && \mathrm{P}(k)=\frac{(n+1)^{k+1}-\sum_{i=0}^{k-1}\binom{k+1}{i}\mathrm{P}(i)}{k+1}, \mathrm{P}(0)=n\textbf{+1}
\end{eqnarray*}
\begin{eqnarray*}
  && \sum_{k=1}^{n}k(k+1)=\frac{n(n+1)(n+2)}{3} \\
  && \sum_{k=1}^{n}k(k+1)(k+2)=\frac{n(n+1)(n+2)(n+3)}{4} \\
  && \sum_{k=1}^{n}k(k+1)(k+2)(k+3)=\frac{n(n+1)(n+2)(n+3)(n+4)}{5}
\end{eqnarray*}
\paragraph{$\blacksquare$ Power Reduction}
$a^b\%p=a^{(b\% \varphi (p))+\varphi (p)}\% p \, (b \ge \varphi (p))$
\paragraph{$\blacksquare$ Burnside's Lemma}
\noindent
\begin{displaymath}
  |X/G|=\frac{1}{|G|}\sum_{g\in G}|X^g|
\end{displaymath}
\begin{displaymath}
  \mathrm{Polya}: X^g=t^{c(g)}
\end{displaymath}
Let $X^g$ denote the set of elements in $X$ fixed by $g$. \\
$c(g)$ is the number of cycles of the group element $g$ as a permutation of $X$.
\paragraph{$\blacksquare$ Lucas's Theorem}
\noindent \\
For non-negative integers $m$ and $n$ and a prime $p$, holds the equation \\
\begin{displaymath}
  \binom{m}{n} \equiv \prod_{i=0}^k \binom{m_i}{n_i} \mod p
\end{displaymath}
where $m=m_kp^k+m_{k-1}p^{k-1}+\ldots +m_1p+m_0$, and $n=n_kp^k+n_{k-1}p^{k-1}+\ldots +n_1p+n_0$, are the base $p$ expansions of $m$ and $n$ respectively.
\paragraph{$\blacksquare$ Wilson's Theorem}
\noindent \\
$p$ is a prime $\iff (p-1)! \equiv -1 \pmod{p}$.
\paragraph{$\blacksquare$ Polynomial Congruence Equation}
\noindent \\
Solve the polynomial congruence equation $f(x)\equiv 0 \mod m$, $m=\prod_{i=1}^{k}p_i^{a_i}$. \\
We just simply consider the equation $f(x)\equiv 0 \mod p^a$, then use the Chinese Remainder theorem to merge the result. \\
If $x$ is the root of the equation $f(x)\equiv 0 \mod p^a$, then $x$ is also the root of $f(x)\equiv 0 \mod p^{a-1}$. \\
$f'(x')\equiv 0 \mod p$ \textbf{and} $f(x')\equiv 0 \mod p^a \Rightarrow x=x'+dp^{a-1}(d=0,\ldots ,p-1)$ \\
$f'(x')\not\equiv 0 \mod p \Rightarrow x=x'-\frac{f(x')}{f'(x')}$
\paragraph{$\blacksquare$ Binomial Coefficients}
\begin{eqnarray*}
  && \mathrm{C}_{r}^{k}=\frac{r}{k}\mathrm{C}_{r-1}^{k-1}\qquad \qquad \: \: \: \mathrm{C}_{r}^{k}=\mathrm{C}_{r-1}^{k}+\mathrm{C}_{r-1}^{k-1} \\
  && \mathrm{C}_{r}^{m}\mathrm{C}_{m}^{k}=\mathrm{C}_{r}^{k}\mathrm{C}_{r-k}^{m-k}\qquad \sum_{k\le n}\mathrm{C}_{r+k}^{k}=\mathrm{C}_{r+n+1}^{n} \\
  && \sum_{0 \le k \le n}\mathrm{C}_{k}^{m}=\mathrm{C}_{n+1}^{m+1}\qquad \sum_{k}\mathrm{C}_{r}^{k}\mathrm{C}_{s}^{n-k}=\mathrm{C}_{r+s}^{n}
\end{eqnarray*}
The number of non-negative solutions to equation $x_1 + x_2 + x_3 + \ldots + x_k = n$ is $\binom{n+k-1}{k-1}$.
\paragraph{$\blacksquare$ Probability Distribution}
\begin{itemize}
  \item Binomial distribution:
    $\mathrm{Pr}[\mathit{X}=k]=\binom{n}{k}p^kq^{n-k}, p+q=1, \mathrm{E}[\mathit{X}]=np.$
  \item Poisson distribution:
    $\mathrm{Pr}[\mathit{X}=k]=\frac{e^{-\lambda }\lambda ^{k}}{k!}, \mathrm{E}[\mathit{X}]=\lambda .$
  \item Gaussian distribution:
    $p(x)=\frac{1}{\sigma \sqrt{2\pi }}e^{-(x-\mu)^2/2\sigma ^2}, \mathrm{E}[\mathit{X}]=\mu .$
  \item Geometric distribution:
    $\mathrm{Pr}[\mathit{X}=k]=pq^{k-1}, p+q=1, \mathrm{E}[\mathit{X}]=\frac{1}{p}.$
\end{itemize}
\paragraph{$\blacksquare$ Catalan Number}
\noindent \\
The number of sequences with $1$ of $m$ and $-1$ of $n$, and m$\ge n$, satifisying the constraint that any sum of the first $k$ elements is always non-negative: $\mathrm{C}_{m+n}^{m}-\mathrm{C}_{m+n}^{m+1}$. \\
Specially, when $m=n$, it equals to $\mathrm{C}_{n}=\frac{\mathrm{C}_{2n}^{n}}{n+1}$, which is the Catalan number. \\
The first 10 Catalan numbers are $1$, $2$, $5$, $14$, $42$, $132$, $429$, $1430$, $4862$, $16796$, from $n=1$, and $C_0=1$. \\
Besides, $C_{n+1}=\sum_{i=0}^{n}C_{i}C_{n-i}$, for $n\ge 0$.
\paragraph{$\blacksquare$ Stirling Number of $\mathrm{2^{nd}}$}
\noindent \\
The Stirling number of the second kind is the number of ways to partition a set of $n$ objects into $k$ non-empty subsets, denoted by $S(n,k)$. \\
$S(n,k)=kS(n-1,k)+S(n-1,k-1)$, and $S(0,0)=1$, $S(n,0)=0$, $S(n,n)=1$.
\paragraph{$\blacksquare$ Bell Number}
\noindent \\
The Bell Number is the number of ways to partition a set of $n$ objects into several subsets, denoted by $B_{n}$. \\
The first few Bell Numbers are $1$, $1$, $2$, $5$, $15$, $52$, $203$, $877$, $4140$, $21147$, $115975$. \\
$B_{n+1}=\sum_{k=0}^{n} \binom{n}{k}B_k$, $B_n=\sum_{k=0}^{n}S(n,k)$, where $S(n,k)$ is Stirling Number of $\mathrm{2^{nd}}$. \\
If $p$ is a prime then, $B_{p+n} \equiv B_n+B_{n+1} (mod \; p)$, $B_{p^m+n} \equiv m B_n + B_{n+1} (mod \; p)$.
\paragraph{$\blacksquare$ Derangement Number}
\noindent \\
The number of permutations of n elements with no fixed points, denotes as $D_n$. \\
$D_n=n!(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\ldots +{(-1)}^n\frac{1}{n!})$, or $D_n=n*D_{n-1}+{(-1)}^n,D_n=(n-1)*(D_{n-1}+D_{n-2})$, with $D_1=1,D_2=1$.
The first 10 derangement numbers are $0$, $1$, $2$, $9$, $44$, $265$, $1854$, $14833$, $133496$, $41334961$, from $n=1$.
\subsubsection{Integrals}
\input{integrals.tex}
\subsection{Primes}
\noindent
$100003$, $200003$, $300007$, $400009$, $500009$, $600011$, $700001$, $800011$, $900001$, \\
$1000003$, $2000003$, $3000017$, $4100011$, $5000011$, $8000009$, $9000011$, \\
$10000019$, $20000003$, $50000017$, $50100007$, \\
$100000007$, $100200011$, $200100007$, $250000019$

\end{document}