%!TEX root = ../main.tex

	\begin{thm}[Lemma 3.1 in {[Stovall], originally due to [Dendrinos\&Wright]}, complexified]
	\label{lem:geometric_lemma}
		Let $\gamma:\mathbb C \to \mathbb C^d$ be a polynomial curve of degree $N$, and assume $\Lambda^{(d)_\gamma} \not \equiv 0$, then we can split $\mathbb C \cup \{\infty\}$ into $M = O_{N}(1)$ non-overlapping triangles $\{T_j\}_{j=1}^M$ so that on each triangle $T_j$:
		\begin{equation}
		\label{eq:power_geometric_estimates}
			|\Lambda_{\gamma'}^{(d)}(z)| \sim A_j |z-b_j|^{k_j}, \,\, and \,\, |\gamma'_1(t)|\sim B_j|z-b_j|^{l_j}
		\end{equation}
		and, for $z := (z_1, \dots z_d) \in T_j^d$:
		\begin{equation}
			\tag{DW}
			\label{eq:hard_jacobian_estimate}
			\left|\frac{J_{\gamma'}(z)}{v(z)}\right|\gtrsim_N \prod_{i=1}^d \Lambda^{(d)}_{\gamma'}(z_i)^{1/d}
		\end{equation}
		Moreover, for each triangle $T_j$ there is a closed, zero-measure set $R_j \subseteq T_j^d$ so that the sum map $\Sigma(z):=\sum_{i=1}^d \gamma(z_i)$ is $O_N(1)$-to-one in $T_j^d\setminus R_j$.
	\end{thm}
\todo[inline]{Schur polynomials are strictly column increasing weak row increasing.}

	To simplify notation, and since the inequality we want to prove above concerns $\gamma'$ only and not $\gamma$, we will prove inequality \eqref{eq:hard_jacobian_estimate} for a generic curve $\gamma$ that will end up being the $\gamma'$ above.\\

	The strategy to prove the theorem will be the following: First inequality \eqref{eq:hard_jacobian_estimate} will be shown for the moment curve, or for generalized moment curves (that is, curves that are affine equivalent to a curve of the form $(z_1^{\delta_1}, \dots z_1{^{\delta_d}}x)$). Then, we will show  that the result is in fact stable to suitable small perturbations of the polynomial. This, together with a compactness argument on $\mathbb C \cup \{\infty\}$, will give the non-uniform estimate (where the constant could depend on the polynomial). The only potential source of non-uniformity at this point will be the number of open sets, and finally we will show a stability on the number of open sets to use, and a compactness argument on the set of polynomials with coefficients $\lesssim 1$ will finish the proof.

	\subsection{Preliminaries} % (fold)
	\label{sub:prelim}

	In this section we will define a systematic way of changing co-ordinates to polynomial curves to understand the behavior near a point, which we refer to as \textit{the zoom-in method} from now on.

	\begin{defi}
		[Canonical form for a curve]
		Let $\gamma = (\gamma_1, \dots \gamma_d)$ be a polynomial curve. Let $\delta_i$ be the lowest degree of a non-zero monomial in $\gamma_i$. Then $\gamma$ is in canonical form at zero if:

		\begin{itemize}
			\item $\delta_1< \dots < \delta_d$
			\item The coefficient of degree $\delta_i$ in $\gamma_i$ is $1$.
		\end{itemize}
		similarly, that $\gamma$ is in canonical form at $c\in\mathbb C$ if $\gamma(z-c)$ is in canonical form at zero. The curve $\gamma$ is in canonical form at infinity if $z^D \gamma(z^{-1})$ is in canonical form at zero, where $D$ is the maximum of the degrees of $\gamma_i$.
	\end{defi}

	A polynomial admits a canonical form for every point if and only if the Jacobian for the curve is not the zero polynomial (that is, as long as the curves are linearly independent as polynomials). Given a polynomial $\gamma$, and a linear transformation $L\in GL(d;\mathbb C)$ so that $L \gamma$ is in canonical form, we define a \textbf{zoom in at zero at scale $\lambda$} as the (normalized) zoom-in:

	\begin{defi}
	 The zoom-in of $\gamma$ at scale $\lambda$ is the polynomial curve $\mathcal B_\lambda [\gamma](z) := \text{diag}(\lambda^{-\delta_1}, \dots, \lambda^{-\delta_d})L \gamma(\lambda z)$. Note that the coefficents of $\mathcal B_\lambda [\gamma](z)$ converge to the polynomial $(z^{\delta_1}, \dots z^{\delta_d})$ as $\lambda$ goes to zero.
	\end{defi}
	% subsection a_systematic_blow_up (end)

	\subsection{Model Case: Generealized moment curve} % (fold)
	\label{sub:model_case_generealized_moment_curve}

	For a generalized moment curve $\gamma$ with exponents $\mbf n:= (n_1, \dots n_d)$ (that is $\gamma(z):= (z^{n_1}, \dots z^{n_d})$ ), and for ${\bf z} := (z_1, \dots z_d)$ the following holds:

	\begin{equation}
		\frac{J(\mbf z)}{v(\mbf z)} = S_{\bf n} (\bf z)
	\end{equation}
	where $S_{\bf n}$ is the Schur polynomial of degree $\bf n$, defined as
	\begin{equation}
	S_{\bf n}(z_1, \dots z_d) = \sum_{(t_i) \in T_{\bf n}} z_1^{t_1}\dots z_d^{t_d}
	\end{equation}
	where $T_{\bf n}$ is the set of semistandard Young Tableaux of shape $\bf n$. Now, to compare $J(z_i)$ with $\Lambda(z_1, \dots, z_d)$, the following fact is useful:

	\begin{lemma}
	\label{lem:det_is_limit}
		Let ${\bf z}\in \mathbb C^d$, with $z_i\neq z_j$ for $i\neq z$, let $s\in \mathbb C$, and $\gamma:\mathbb C\to \mathbb C^d$ a polynomial curve, then:
		\begin{equation}
		J_\gamma(s) = \lim_{\lambda\to 0} \frac{\Lambda_\gamma(\lambda {\bf z}+ s)}{v(\lambda {\bf z})}
		\end{equation}
		and, in particular, in the case when $\gamma$ is a moment curve of exponent $\bf n$,
		\begin{equation}
		\label{eq:det_is_schur}
			\Lambda^{(d)}_\gamma(s) = S_{\bf n}(s, \dots s)
		\end{equation}
	\end{lemma}

	\begin{proof}
		By Taylor expansion we have:

		\begin{equation}
			\gamma_i(s+ \lambda \mbf z_j) =  \sum_{k=0}^{d-1} \frac 1 {k!}\gamma_i^{(k)}(s) \lambda^k \mbf z_j ^k + O(\lambda^d)
		\end{equation}
		now, defining the matrices $\Gamma_{ij} = \gamma_i(s+ \lambda \mbf z_j)$, $ { Z}_{kj} =  (\lambda \mbf z_j) ^k$, and $(T_\gamma)_{ik} = \frac 1 {k!}\gamma_i^{(k)}(s) $ the equation above can be rewritten as:

		\begin{equation}
			\Gamma = T_\gamma Z + O(\lambda^d)
		\end{equation}
		since the determinant of $Z$ is $v({\bf z})$, the lemma follows from the multiplicative property of the determinant:

		\begin{equation}
			\frac{\Lambda_\gamma(\lambda {\bf z}+ s)}{v(\lambda {\bf z})} =
			\frac{\det \Gamma}{\det Z} =  \det [T_\gamma +  Z^{-1}O(\lambda^d)] \to_{\lambda \to 0} \det T_\gamma =  \Lambda^{(d)}_\gamma(s)
		\end{equation}
		The fact that $Z^{-1}= o(\lambda^{-d})$ (and thus we can eliminate the term as $\lambda\to 0$) is a quick computation from the adjoint forumla for the inverse.
	\end{proof}

	\begin{remark}
		The same argument works as well for $\Lambda^{(k)}_\gamma$, $1\le k<d$, since each component of $\Lambda^{(k)}_\gamma$ is a determinant of components of the polynomial.
	\end{remark}

	Lemma \ref{lem:det_is_limit} is (together with Schur positivity) all we need to show the theorem for the generalized moment curve:

	\begin{proof}
		[Proof (of \eqref{eq:hard_jacobian_estimate}, moment curve case).]

		Let $\mu$ be a generalized moment curve of exponents $\mbf n$. Decompose $\mathbb C = \bigcup W_i$ into finitely many sectors $W_i = \{z: |\arg z - \theta_i|<\epsilon \}$ of angle $\epsilon$ small enough (depending on the exponents). Now, for $\mbf z = (\mbf z_1, \dots \mbf z_d) \in W_i^d$

		\begin{equation}
			 C_n |S_{\bf n}(\mbf z)|
			 \ge
			 |\mbf z_1\cdot \mbf z_2  \dots \mbf z_d|^{\frac{\deg S_{\bf n}}{d}}
			 = C_{\bf n} \left|\prod_{i=1}^d S_{\bf n}(\mbf z_i, \dots , \mbf z_i) \right|^{1/d}
		\end{equation}
		the first inequality is AM-GM inequality for all the monomials of $S_{\bf n}(\mbf z)$. The second equality follows from the fact that $ S_{\mbf n}(\mbf z_i, \dots , \mbf z_i) = C_n \mbf z_i^{{\deg S_{\mbf n}}/{d}}$. Now the result follows from equation \eqref{eq:det_is_schur} on Lemma \ref{lem:det_is_limit}.
	\end{proof}

	Lemma \ref{lem:det_is_limit} leads to the definition of a new differential form that corrects for the Vandermonde factor:

	\begin{defi}
		[Corrected multilinear form]
		For $\gamma:\mathbb C \to \mathbb C^n$ and $\mbf z \in \mathbb C^n$we define:
		\begin{equation}
			\tilde \Lambda_\gamma(\mbf z) =
			\frac
			{\Lambda_\gamma(\mbf z) }
			{v(\mbf z) }
		\end{equation}
		moreover, (as we shall see in the following section) the map ${\tilde\Lambda}_{\cdot}(\cdot)$ is continuous in its domain $ \mathbb C^d \times P_N(\mathbb C)^d$.
	\end{defi}

	there is an extra property of the generalized moment curve that will be used later in this section, that we will prove now: \\

	\todo[inline]{Is this lemma really clearer in sequence form? }

	\begin{lemma}
		[Transversality of the corrected multilinear form for moment curves]
		\label{lem:transversality_corrected} Let $\mu$ be a moment curve, and $W$ a wedge of $\mathbb C$ of angle $\epsilon$ (depending on $\mu$) small enough. Let $\{\bf w^{(k)}\}_{k=1}^{\infty} $ be a sequence of elements in $ W^s$, $ \{\mbf z^{(k)} \}_{k=1}^{\infty}$ a sequence in $ W^t$, with $k:=c+s\le d$, assume $|\mbf z^{(k)}_i| = O(1)$, and $\mbf w^{(k)} \to 0$.

		\begin{equation}
		\label{eq:transversality}
			\|\tilde \Lambda_\mu (\mbf z^{(k)}_1 \dots \mbf z^{(k)}_t, \mbf w^{(k)}_1 \dots \mbf w^{(k)}_s) \| \approx_\mu
			\|\tilde \Lambda_\mu (\mbf z^{(k)}_1 \dots \mbf z^{(k)}_t)\|\|\tilde \Lambda_\mu( \mbf w^{(k)}_1 \dots \mbf w^{(k)}_s) \|
		\end{equation}
	\end{lemma}

	\begin{proof}
		The $\lesssim$ direction is the fact that, for forms $\|a\wedge b\| \le \|a\|\|b\|$.

		For the converse, there is one co-ordinate $e_{n_1} \wedge e_{n_2} \dots \wedge e_{n_k}$ on the LHS that dominates the norm of the form. By restricting to that co-ordinate, it can be assumed that $k=d$. Note also that the term $\|\tilde \Lambda_\mu (z^{(k)}_1 \dots z^{(k)}_t)\|$ is a the absolute value of a Schur polynomial (and therefore is $O(1)$), so we can omit it in the estimates.

		By using the Young tableau decomposition of the Schur polynomials again, it suffices to show that each monomial in $\| \tilde \Lambda_\mu( w^{(k)}_1 \dots w^{(k)}_s) \|$ is dominated by a monomial in $\|\tilde \Lambda_\mu (z^{(k)}_1 \dots z^{(k)}_t, w^{(k)}_1 \dots w^{(k)}_s) \|$. This can be done as follows:

		[DRAW PICTURE OF YOUNG TABLEAUX]
	\end{proof}

	[DO WE NEED WHAT WAS LEMMA 2.5 ANYWHERE]

	% subsection model_case_generealized_moment_curve (end)

	\subsection{Fixed polynomial case} % (fold)
	\label{sub:fixed_polynomial_case}

	This section shows that locally any polynomial can be approximated by a moment curve in such a way that the estimates can be transfered from the moment curve to the polynomial. By compactness, this will allow us to conclude Lemma \eqref{eq:hard_jacobian_estimate} for single polynomials, but with a number of open sets that might depend on the polynomial.

	\begin{lemma}
		[Convergence to the model in the non-degenerate set-up]
		\label{lem:nondegenerate_continuity}The function $\tilde\Lambda_{\mu}({\bf z})$ is continuous in $({\bf z},\mu)\in \mathbb C^k \times P_n(\mathbb C)^d$, where $P_n(\mathbb C)$ denotes the set of polynomials of degree $n$.
	\end{lemma}

	\begin{proof}
		Consider both the numerator and denominator of $\tilde \Lambda_\mu({\bf z})$ as a polynomial in the components of $\mu$ and $z$. The polynomial $\Lambda_\mu(\bf z)$ on the numerator vanishes on the zero set set $\mathcal Z(v(z_1, \dots z_k))$, and since this polynomial does not have repeated factors, $v(z_1, \dots z_k)$ divides the numerator by the Nullstellensatz and the result follows.
	\end{proof}

	This lemma implies the local version of the theorem around points where the Jacobian does not degenerate:

	\begin{prop}
	\label{prop:local_nondegenerate_jacobian}
		Let $\gamma$ be a polynomial curve in $\mathbb C^d$, such that $\Lambda^{(d)}(z) \neq 0$. Then there is a neighborhood $B_\epsilon(0)$, with $\epsilon=\epsilon(\gamma)$ where \eqref{eq:hard_jacobian_estimate} holds with constant depending only on the dimension.
	\end{prop}

	\begin{proof}
		By the affine invarance of \eqref{eq:hard_jacobian_estimate}, we can consider a sequence of zoom-ins in the canonical form parametrized by $\lambda$ that converge to the moment curve (the sequence cannot converge to any other generalized moment curve as the determinant does not vanish at zero). Therefore, we have to show that, for $\lambda$ small enough, the lemma is true for $\mathcal B_\lambda[\gamma]$, that is:

		\begin{equation}
			\left|\frac{J_{\mathcal B_\lambda[\gamma]}(z)}{v(z)}\right|\gtrsim_N \prod_{i=1}^d \Lambda^{(d)}_{\mathcal B_\lambda[\gamma]}(z_i)^{1/d}
		\end{equation}

		For the moment curve (the case $\lambda=0$) inequality \eqref{eq:hard_jacobian_estimate} is true, and reads:

		\begin{equation}
			\tilde \Lambda_{\mu}(z_1, \dots z_d) \gtrsim 1
		\end{equation}
		and since both sides of the inequality converge locally uniformly as $\lambda \to 0$ (the LHS by Lemma \ref{lem:nondegenerate_continuity} and the RHS because it is the $d-$th root of a sequence of converging polynomials), the inequality is true for $\lambda$ small enough in the zoom-in.
	\end{proof}

	For the degenerate points where the Jacobian vanishes a similar, but slightly more technical approach gives the same result.

	\begin{lemma}
		[Convergence to the model case in the degenerate set-up with zoom-in]
		\label{lem:degenerate_convergence}
		Let $W \subseteq C$ be a sector of small amplitude $\epsilon(N,d)$ to be determined. Let ${\bf z}_j$ be a sequence of points in $W^k$ that have norm $\lesssim 1$. Let $\gamma_j:=\mathcal B_{\lambda_j}[\gamma]$, $\lambda_j \to 0$, be a sequence of polynomial curves of degree $N$ that converges to $\mu$, a generalized moment curve of exponents ${\bf n}=(n_1\dots n_d)$. Then:

		\begin{equation}
			\lim_{j\to \infty} \frac{\Lambda_{\gamma_j}({\bf z}_j)}
			{|\Lambda_{\gamma_j}({\bf z}_j)|}-\frac{\Lambda_{\mu}({\bf z}_j)}
			{|\Lambda_{\mu}({\bf z}_j)|} = 0
		\end{equation}
	\end{lemma}

	\begin{proof}
		First note that it suffices to prove that the lemma is true for a subsequence of the $(\lambda_j,\mbf z_j)$. The lemma will follow if we can prove that, for any fixed coordinate $e = e_{l_1} \wedge \dots \wedge e_ {l_k}$ we have:

		\begin{equation}
			\lim_{j\to \infty} \frac{\Lambda_{\gamma_j}({\bf z}_j)|_e}
			{\Lambda_{\mu}({\bf z}_j)|_e} = 1
		\end{equation}
	using the notation $w|_e$ to denote the $e-$th co-ordinate of the form $w$. By restricting the problem to the co-ordinates $(e_{l_1}, \dots  e_ {l_k})$ we may assume $k=d$, and then it suffices to show, in the same set-up of the lemma, that:
	\begin{equation}
			\lim_{j\to \infty} \frac{\tilde \Lambda_{\gamma_j}({\bf z}_j)}
			{\tilde \Lambda_{\mu}({\bf z}_j)} = 1
	\end{equation}

	We will prove this by induction. By passing to a subsequence if necessary, assume WLOG that $\mbf z_j$ has a limit. In the base case none of the components of ${\bf z}_j$ has limit zero. In that case, the denominator converges to a non-zero number (since the denominator is a Schur polynomial in the components of ${\bf z}_j$) and the result follows.

	Our first induction case is when all the components went to zero. In this case, by doing a further zoom-in and passing to a further subsequence if necessary, one can reduce to the case where not all the components of ${\bf z}_j$ go to zero. Thus, assume some, but not all the components of ${\bf z}_j$ go to zero.

	Without loss of generality assume it's the first $0<k'<k$ components that go to zero. Let ${\mbf z'}_j:= ((\mbf z_j)_1, \dots (\mbf z_j)_{k'})$ be the sequence made by the first $k'$ components of each ${\bf z}_j$, and ${\mbf z'}''_j$ the sequence made by the remaining components. Then,

	\begin{equation}
		 \frac{\tilde \Lambda_{\gamma_j}({\bf z}_j)}
			{\tilde \Lambda_{\mu}({\bf z}_j)}
		=  \frac
		{ \sum_{e'\wedge e'' = e}\tilde \Lambda_{\gamma_j}({\bf z}'_j)|_{e'}
			\cdot
		\tilde \Lambda_{\gamma_j}({\bf z}''_j)|_{e''}}
		{ \sum_{e'\wedge e'' = e}\tilde \Lambda_{\mu}({\bf z}'_j)|_{e'}
			\cdot
		\tilde \Lambda_{\mu}({\bf z}''_j)|_{e''}}
	\end{equation}
	we know by the induction hypothesis that each of the terms in the sum in the numerator converges to the corresponding term in the denominator (in the sense that their quotient goes to $1$). So the result will follow if we can prove there is not much cancellation going on on the denominator, that is:

	\begin{equation}
		\limsup_{j \to \infty }
		\frac
		{ \sum_{e'\wedge e'' = e} |\tilde \Lambda_{\mu}({\bf z'}_j)|_{e'}
		\cdot
		\tilde \Lambda_{\mu}({\bf z''}_j)|_{e''}|} {|\tilde \Lambda_{\mu}({\bf z}_j)|_e|}<\infty
	\end{equation}
	but this is a consequence of Lemma \ref{lem:transversality_corrected}, because we can bound each of the elements in the sum by
	$|\tilde \Lambda_{\mu}({\bf z'}_j)|
		\cdot
		|\tilde \Lambda_{\mu}({\bf z''}_j)| \lesssim {|\tilde \Lambda_{\mu}({\bf z}_j)|} $, by equation \eqref{eq:transversality}.

	\end{proof}

	We can also see this lemma in the continuity set-up. Following the same proof as in Proposition \ref{prop:local_nondegenerate_jacobian}, we can prove

	\begin{prop}
	\label{prop:local_degenerate_jacobian}
		Let $\gamma$ be a polynomial curve in $\mathbb C^d$, such that $\Lambda^{(d)}(0) = 0$. Then there is a neighborhood $B_\epsilon(0)$, with $\epsilon=\epsilon(\gamma)$ where \eqref{eq:hard_jacobian_estimate} holds with constant depending only on the dimension.
	\end{prop}

	\begin{proof}
		We have to show that there exists a zoom-in $\mathcal B_{\lambda}[\gamma]$ for $\lambda$ small enough so that the inequality
		$$
		\left|\frac{J_{\mathcal B_{\lambda}[\gamma]}(z)}{v(z)}\right| \prod_{i=1}^d \Lambda^{(d)}_{\mathcal B_{\lambda}[\gamma]}(z_i)^{- 1/d} \gtrsim_N 1
		$$ holds in the unit ball, but lemma \ref{lem:degenerate_convergence} implies that

		$$
		\lim_{\lambda_\to 0}
		\left|\frac{J_{\mathcal B_{\lambda}[\gamma]}(z)}{v(z)}\right| \prod_{i=1}^d \Lambda^{(d)}_{\mathcal B_{\lambda}[\gamma]}(z_i)^{- 1/d} =
		\left|\frac{J_{\mu}(z)}{v(z)}\right| \prod_{i=1}^d \Lambda^{(d)}_{\mu}(z_i)^{- 1/d} \gtrsim 1
		$$
		where the  convergence is locally uniform, and the second inequality is inequality \ref{eq:hard_jacobian_estimate} for the moment curve.

	\end{proof}

	This finishes the proof that \eqref{eq:hard_jacobian_estimate} if we split compact sets in a finite number of sets that may depend on the polynomial. A small variation of Lemma \ref{prop:local_degenerate_jacobian} can be used at a neighborhood of infinity. In this exposition infinity will be considered simultaneously with the uniform case instead.

	% subsection fixed_polynomial_case (end)

	\subsection{Uniformity for polynomials} % (fold)
	\label{sub:uniformity_for_polynomials}

	The aim of this section is to show that the number of open sets in the geometric Lemma \ref{lem:geometric_lemma} does not depend on the polynomial. In order to do so, we will show that given a sequence of polynomial curves there exists a subsequence of curves for which \eqref{eq:hard_jacobian_estimate} holds with a uniformly bounded amount of subsets, and thus there must be a uniform bound for all polynomial curves.

	The main challenge in the proof of the uniformity of the number of open sets in Lemma \ref{lem:geometric_lemma} is the case in which the zeros of the Jacobian \textit{merge}, that is, the curves $\gamma_n$ converge to a curve $\gamma$ such that $J_\gamma$ has less zeros than $\gamma$ (without counting multiplicity). We will use zoom-ins near the zeros of $\gamma$ to keep track of this cases. The following lemma is a key tool to do the zoom in:

	\begin{lemma}\label{lem:annuli_continuity}
		Let $\gamma$ be a non-degenerate polynomial curve in $\mathbb C^d$ of degree $N$ such that $$\gamma_i = \prod_{k=1}^{n_j} (z - w_{i,k}) \prod_{l=1}^{m_j} \left(1 - \frac{z}{v_{i,l}}\right)$$, $v_{i,l}, w_{j,k} \in B_{R }\setminus B_{r}$, $n_1<n_2< \dots < n_d + m_d$ Then there is a constant $C := C(N, d)$ such that $(PI)$ holds on $W \cap (B_{C^{-1}R }\setminus B_{C r})$ for any wedge $W$ of angle $\le \epsilon(N,d)$.
	\end{lemma}

	The lemma (and its proof) can be informally stated as: ``If all the zeros of the components of $\gamma$ are far from an annuli, then $\gamma$ behaves like the corresponding moment curve in the annuli". To prove the lemma we will have to re-write it into an equivalent form, more suitable for compactness arguments:

	\begin{lemma} [Lemma \ref{lem:degenerate_convergence}, annuli verison]\label{lem:annuli_convergence}
		Let $\gamma_n$ be a sequence of polynomial curves for which the coefficients coefficients $w_{(i,k),n} \to_{n\to \infty} 0$, $v_{(i,l),n} \to_{n\to \infty} \infty$,  ($v,w$ defined using the notation of the previous lemma, $\gamma_n \to \mu$, a non-degenerate moment curve). Let $r_n$ define a sequence of annuli $A_n = B_0(1)\setminus B_0(r_n)$, so that $\max_{i,k} w_{(i,k),n} = o(r_n)$. Let $\mbf z_n \in (A_n \cap W)^k$, where $W$ is a sector of small enough angle depending of $n,d$ only. Then:

		\begin{equation}
			\lim_{j\to \infty} \frac{\Lambda_{\gamma_j}({\bf z}_j)}
			{|\Lambda_{\gamma_j}({\bf z}_j)|}-\frac{\Lambda_{\mu}({\bf z}_j)}
			{|\Lambda_{\mu}({\bf z}_j)|} = 0
		\end{equation}
	\end{lemma}

	\begin{proof}
		The proof is the same as the proof in Lemma \ref{lem:degenerate_convergence}. The key difference being the reason why we can zoom in again. In Lemma \ref{lem:degenerate_convergence} the $\gamma_n$ were themselves blow-ups, so blowing up did not change the hypothesis of the lemma. Here, the control of $r_n$ ensures the blow-up will be always at a smaller scale than the scale at which the zeros of $\gamma_n$ are.
	\end{proof}

	\begin{remark}
		Note that in the particular case in which there are no $v_{(i,l),n}$ (that is, all the zeros are going to zero) the annuli can be taken to have exterior radius equal to infinity (that is, the annuli can degenerate to the complement of a disk) or, in the case where all the $w_{(i,k),n}$ are exactly equal to zero, it can be taken to have interior radius equal to 0.
	\end{remark}

	Lemma \ref{lem:annuli_continuity} that we just proved (in its convergence form) lets us control  $J_\gamma$ far from the zeros of the components of $\gamma$. The zeros of the components, however, depend on the co-ordinates we take. In order to solve this, we will show that there is one \textit{honest} co-ordinate system in which, if we have a zero of a co-ordinate of $\gamma$ that has size $O(1)$ then there is also a zero of $\mathcal J_{\gamma}$ that has size $O(1)$.

	\begin{lemma}[Honest zeros lemma]
	\label{lem:honest_zeros}
		For a non-degenerate polynomial curve $\gamma$, let $R(\gamma)$ be the (absolute value of the) supremmum of the zeros of $J_\gamma$ that has absolute value smaller than 1. Let $r_\gamma$ be the supremmum of the zeros of the co-ordinates of $\gamma$ (again in absolute value, and counting only the zeros that have absolute value less than 1).

		Then, for any sequence of polynomial curves $\gamma_n \to \mu$, a non-degenerate generalized moment curve, there is a constant $k := k(\gamma_n)$, a sequence of linear operators $L_n \in GL(n;\mathbb C)$ converging to the identity and a sequence of constants $c_n\to 0$ so that:

		\begin{equation}
			R(L_n \gamma_n(z-c_n)) \ge k r(L_n \gamma_n(z-c_n))
		\end{equation}

		In other words, after a suitable change of co-ordinates, controlling the zeros of a sequence of polynomial curves allows us to control the zeros of its Jacobian without significant losses.
 	\end{lemma}

 	\begin{proof}
 		We will assume that $\mu$ is not the standard moment curve, since otherwise the result is trivial because $J_\mu = 1$. We choose the $c_n \to 0$ to re-center the $\gamma_n$ so that $J_{\gamma_n}$ always has a zero at zero. Let $n_i$ be the degree of the $i-$th co-ordinate of $\mu$. By composing with suitable $L_n\to Id$ we can assume that the degree $n_i$ component of the $i-th$ co-ordinate of $\gamma_n$ is always $1$, and the degree $n_j$ of the $i-$th component (for $i\neq 0$) is $0$ for all $\gamma_n$. Let $\tilde \gamma_n = L_n \gamma_n(z-c_n)$, then, the following holds:

 		\begin{lemma}
 		\label{lem:honest_helper}
 			Let $\hat\gamma_n$ be a sequence of zoom-ins to $L_n \gamma_n(z-c_n)$ at the scale where the zeros of the co-ordinates appear, and assume $\hat\gamma_n \to \gamma$. Then the multiplicity of the zero of $J_\gamma$ at zero is strictly smaller than the multiplicity of $J_\mu$ at zero.
 		\end{lemma}

 		using the lemma above, we can finish the proof by contradiction. Assume $ \gamma_n$ is such that $\tilde \gamma n = L_n \gamma_n(z-c_n)$ contradicts the lemma. Pick a subsequence  for which $R(\tilde\gamma_n)/r(\tilde\gamma_n)$ goes to zero. Let $\hat \gamma_n$ be a zoom-in at the scale at which the first zeros of the components of $\tilde\gamma_n$ appear.Assume, by passing to a subsequence if necesary, that $\hat \gamma_n$ converges. By the hypothesis of $R(\tilde\gamma_n)/r(\tilde\gamma_n)$, it must be that all the zeros of $J:{\hat\gamma_n}$ concentrate back at zero, but this contradicts lemma \ref{lem:honest_helper}.
 	\end{proof}

	% subsection uniformity_for_polynomials (end)

	\begin{proof}
		[Proof (of  Lemma \ref{lem:honest_helper}).]
		Define a matrix $M_{i,k} \in \mathcal M_{(d,N)}(\mathbb C)$ so that $M_{i,k}$ is the coefficient of degree $k$ of the $i$ component. By the transformation we have done, we know the matrix $M_{i,k}$ has rank $d$, and that for the column $i$, the element $M_{i,n_i}$ is equal to $1$ and for $j>n_i$, $M_{i,n_i}$ is equal to $0$. The multiplicity of $J\mu$ at zero is $\sum n_i - \frac{d^2+d}{2}$. To compute the multiplicity of $J_\gamma$ at zero, we do the following procedure:

		Pick the first column (smallest $k$ index) that is non-zero. Pick the first element of this column (smallest $i$) index that is non-zero. Define $\tilde n_i:=k$, where $i$ is the index that is not zero. Row-reduce $M_{i,k}$ so that the $k-$th column is $e_i$. Set all the elements on the right of $(i,n_i)$ to zero. Repeat this process $d$ times.

		This procedure is a row-reduction and blow-up procedure at the origin, that shows that, at the origin, the polynomial curve looks like a generalized moment cuve of degrees $\tilde n_i$, where $\tilde n_i\le n_i$ with at least one of the $\tilde n_i< n_i$. Therefore, the degree at the origin is strictly smaller.
	\end{proof}

	Now we have all the necessary tools to prove \eqref{eq:hard_jacobian_estimate} in  Lemma \ref{lem:geometric_lemma} in the full generality case. The proof is as follows:

	\begin{itemize}
		\item The proof is a proof by contradiction. Assume there is a sequence of $\gamma_n$ for which the minimum number of sets need for the geometric Lemma \ref{lem:geometric_lemma} to hold grows to infinity. The contradiction will come from showing that a certain subsequence of the $\gamma_n$ can be covered by a bounded number of subsets.
		\item By passing to a subsequence if necessary, and re-parametrizing, we will assume that the $\gamma_n$ converge to a non-degenerate generalized moment curve $\hat \gamma$, and that all the zeros of $J_{\gamma_n}$ converge to the origin, with one zero of $J_{\gamma_n}$ being exactly at the origin.
		\item By Lemma \ref{lem:annuli_continuity} [convergence of the Jacobian on annuli with possibly infinite radius], after a suitable reparametrization if necessary, we can cover uniformly $\mathbb C\setminus B_{r_n}$ with wedges so that property \eqref{eq:hard_jacobian_estimate} holds, where $r_n$ is proportional (with a constant depending on $d,N$) to the size of the biggest zero of $J_{\gamma_n}$. After a suitable change of coordinates by Lemma \ref{lem:honest_zeros}, this is equivalent to consider $r_n$ to be of the size of the biggest zero of a component of $\gamma_n$.
		\item Zoom in to the polynomials $\gamma_n$ at scale $r_n$ to obtain the polynomials $\gamma'_n$. We have to show now that the theorem holds for $\gamma'_n$ on the unit ball. By passing to a subsequence, assume WLOG that the polynomials converge to a non-degenerate polynomial curve $\gamma'$. Note that the zeros of $J_{\gamma'}$ cannot all converge to the origin (because for each $\gamma'_n$ there is a zero with size $O(1)$).
		\item By Lemma \ref{lem:annuli_continuity} again, we can find a sequence of annuli of outer radius $O(1)$, centered at the zeros of $\gamma'_n$ so that the condition \eqref{eq:hard_jacobian_estimate} holds after splitting the annuli into wedges.
		\item On the intersection of all the exteriors of all the Annuli (by the exterior meaning the connected component containing infinity of the complement of the annuli), property \eqref{eq:hard_jacobian_estimate} holds for $n$ big enough after splitting into $O(1)$ sets, by compactness and Proposition \ref{prop:local_nondegenerate_jacobian} [Local version of \eqref{eq:hard_jacobian_estimate} in the non-degenerate case].
		\item Therefore, it suffices to prove that property \eqref{eq:hard_jacobian_estimate} wolds in the interior component of the complement of the annuli. But this can be done by induction: Zoom in into each of those components (which, by hypothesis have lower degree than the original one), and repeat the argument.
	\end{itemize}

	\subsection{Injectivity of the $\Sigma$ map} % (fold)
	\label{sub:injectivity_of_the_}

	The goal of this section is the last part of Lemma \ref{lem:geometric_lemma}, which we re-state:

	\begin{lemma}
		For each triangle $T_j$ described in the proof of Lemma \ref{lem:geometric_lemma} there is a closed, zero-measure set $R_j \subseteq T_j^d$ so that the sum map $\Sigma(z):=\sum_{i=1}^d \gamma(z_i)$ is $O_N(1)$-to-one in $T_j^d\setminus R_j$.
	\end{lemma}

	\begin{proof}
		Our set $R_j$ is the set where there is $i\neq j$ where $z_i=z_j$. The fact that $\Lambda_\gamma'(z_1, \dots z_d)$ does not vanish in $T_j\setminus R_j$ (a consequence of \eqref{eq:hard_jacobian_estimate}) tells us that $(z_1, \dots z_d)$ does not belong to an irreducible variety of dimension greater than zero of the variety defined by $\{(x_1, \dots x_d) \in \mathbb C^d | \Lambda_\gamma'(x_1, \dots x_d) = \Lambda_\gamma'(z_1, \dots z_d)\}$. Therefore, the result follows by Bezout's theorem.
	\end{proof}
	% subsection injectivity_of_the_ (end)


\section{Parallel VGLCS Algorithm} \label{sec:parallelVGLCS}

\subsection{Basic Dynamic Programming}

We first describe a basic dynamic programming for
VGLCS~\cite{Peng2011TheLC}. Let $A$ and $B$ denote two input strings
of length $n$ and $m$ respectively, and $G_A$ and $G_B$ be the arrays
of the variable gap constraints.  We define $V[i][j]$ to be the {\em
  maximum} length of the variable gapped longest common subsequence
between substring $A[1, i]$ and $B[1, j]$.  It is easy to see that
$V[i][j]$ is the {\em maximum} among $V[k][l]$, where $k$ is between
$i-1$ and $i-G_A(i)-1$, and $l$ is between $j-1$ and $j-G_B(j)-1$,
i.e., a rectangle within $V$ on the left and upper of $V[i][j]$.
Please refer to Figure~\ref{fig:fig-VGLCS-dp-naive} for an
illustration.

\begin{figure}[!thb]
  \centering \subfigure[How to compute $V$.] {
    \includegraphics[width=0.45\linewidth]{\GraphicPath/fig-VGLCS-dp-naive.pdf}
    % \caption{How to compute $V$.}
    \label{fig:fig-VGLCS-dp-naive}
  } \subfigure[Compute $V$ with incremental suffix maximum queries.] {
    \includegraphics[width=0.45\linewidth]{\GraphicPath/fig-VGLCS-dp.pdf}
    \label{fig:fig-VGLCS-dp}
  }
  \caption{The basic dynamic programming for VGLCS}
  \label{fig:basic-dp-VGLCS}
\end{figure}

The computation of $V$ can be optimized as follows.  Note that the
computation of all $V[i][j]$'s with the same $i$ has the {\em same} gap
constraint $G_A(i)$, so the maximum within the rectangle can be computed
in two steps.  First, we compute the maximum of {\em every column} of
this rectangle, and place them into another array $R$. Then we compute
the maximum of the {\em suffix} of length $G_B$ on $R$, which is exactly
$V[i][j]$.  Please refer to Figure~\ref{fig:fig-VGLCS-dp} for an
illustration.

We note that this optimization requires maximum queries on the suffix
{\em incrementally} in the following sense.  Recall that in the first
step of the optimization, we need to compute the maximum of every column
within the rectangle.  This is just like finding the maximum of the {\em
suffix} of every column in that rectangle.  After we compute the $i$-th
row of $V$ and go to the next row to compute $V[i+1][*]$, we will then
need the maximum of the suffix of every column of length $G_A(i+1)$. It
will be beneficial if we put the $V$'s in each column into a data
structure that supports suffix maximum query.  Similarly, the
computation within the same row, that is, from $V[i][j]$ to $V[i][j+1]$,
also requires the maximum of the suffix on $R$.  We will refer to this
type of queries as {\em incremental suffix maximum query}, i.e., we
would like to maintain a data structure form which we can find the
maximum of its suffix efficiently while we add data at its end.

\subsection{Peng's Algorithm}

The sequential VGLCS algorithm~\ref{alg:serial-VGLCS} by
Peng~\cite{Peng2011TheLC} applies the optimization and is shown as
Algorithm~\ref{alg:serial-VGLCS}.  The outer loop goes through every
row, and the inner loop goes through every element of a row from left to
right.  We use an array of $C$ to answer incremental maximum queries on
all columns.  That is, we can think of $C[j]$ as a data structure that
supports incremental suffix maximum queries on the $j$-th column of $V$.
From the previous observation that all computation of elements in the
$i$-th row of $V$ share the same gap $G_A(i)$, we will query each $C$
for the maximum in the suffix that ends at row $i-1$ with length
$G_A(i)+1$, and place these maximums in another data structure $R$ that
also supports incremental suffix maximum queries.  It is easy to see
that the value of $V[i][j]$ can be obtained by querying $R$ with a
suffix maximum query of length $G_B(j)+1$ as shown in
Figure~\ref{fig:fig-VGLCS-dp}.

We update $V$, $C$, and $R$ as follows.  If the $i$-th character of $A$
matches the $j$-th character of $B$ then $V[i][j]$ is the maximum among
the rectangle plus 1, as shown in Figure~\ref{fig:fig-VGLCS-dp}. This
maximum can be found by querying $R$ for the maximum among the last
$G_B(j)$ elements in it.  Note that $R$ contains the information of the
previous row, up to the element of the $j-1$ element.  After that, we
add the maximum of last $G_B(j)+1$ in the $j$-the column into $R$, and
the newly computed $V[i][j]$ into $C[j]$, which supports ISMQ on the
$j$-the column, before going to column $j+1$.  If the $i$-th character
of $A$ does {\em not} match the $j$-th character of $B$, we simply set
$V[i][j]$ to 0 since it does not affect the answer, then again update
$R$ accordingly.

\input{\AlgoPath/alg-serial-VGLCS-2e}

\subsection{Incremental Suffix Maximum Query}

From the previous discussion of Peng's algorithm, we note that in order
to find VGLCS efficiently, we need to address the {\em incremental
suffix maximum query} (ISMQ) problem.  A data structure that supports
incremental suffix maximum queries should support the three operations.
First, a {\sc Make} operation creates an empty array $A$. Second, an
{\sc Append}$(V)$ operation appends a value $V$ to array $A$. Finally, an
ISMQ {\sc Query}$(x)$ finds the {\em maximum} value among those from $x$
to the end of an array $A$.

Peng uses a {\em disjoint-set} data structure to answer incremental
suffix maximum queries in his VGLCS algorithm.  The disjoint-set data
structure was proposed by Gabow~\cite{Gabow1983ALA} and
Tarjan~\cite{Tarjan1975EfficiencyOA} to solves the {\em union-and-find
problem}.  The set of data is stored in a sequence of disjoint sets, and
the {\em maximum} of each disjoint set is at the root of the tree, and
these maximum are in {\em decreasing} order.  When we add a value $x$,
we make it as a disjoint set with a single element by itself, and as the
{\em last} disjoint set in the sequence.  Then we start joining (with
union operation) from the last set to its previous set until the maximum
of the previous set is {\em larger} than $x$. It is easy to see that the
{\sc Query}$(x)$ operation is simply a {\em find} operation that finds the
root, which has the {\em maximum}, of the tree that $x$ belongs to.  The
amortized time per union/find operation is $O(\alpha(n))$.

\subsection{A Parallel VGLCS Algorithm with Sparse Table}

The sequential VGLCS algorithm~\ref{alg:serial-VGLCS} by
Peng~\cite{Peng2011TheLC} and other variants of LCS are difficult to
parallelize in a row-by-row manner.  These algorithms use several
states to determine a new state with a dynamic programming.  This
construction requires {\em heavy data dependency}, and is difficult to
parallelize in a naive row-by-row manner because an element of the
dynamic table needs the values of elements in the {\em same} row to
compute its value.

It is also difficult to parallelize Peng's algorithm with the wavefront
method because it requires {\em extra space} to keep track of row
status, which is not required in a sequential algorithm. Recall that
VGLCS requires a rectangle of data in $V$ to compute a new element, if
those $V$'s want to compute on a diagonal wavefront, those rectangles of
data will require extra bookkeeping since the gap constraints of those
elements on the wavefront could be very different.  Please refer to
Figure~\ref{fig:fig-VGLCS-dp-wavefront} for an illustration of those
data that must be present (in solid line).  Also, the new elements
computed must be appended to the data structures according to the
wavefront, which incurs more bookkeeping and overheads.

\begin{figure}[!thb]
  \centering \subfigure[The first stage]{
    \includegraphics[width=0.45\linewidth]{\GraphicPath/fig-VGLCS-dp-wavefront-second.pdf}
  } \subfigure[The second stage]{
    \includegraphics[width=0.45\linewidth]{\GraphicPath/fig-VGLCS-dp-wavefront-first.pdf}
  }
  \caption{The bookkeeping data of the wavefront method}
  \label{fig:fig-VGLCS-dp-wavefront}
\end{figure}

We propose a parallel VGLCS algorithm with an optimized row-by-row
approach, which maintains only {\em one} row data structure that
collects suffix maximum values from all columns.  That is, our
optimized row-by-row approach removes the data dependency among
elements {\em within the same row}.

Our optimized row-by-row approach uses less space, has a more balanced
workload, and a smaller thread synchronization overhead, than the
wavefront method.  We observe that the length of the critical path of
a wavefront method is greater than that of a row-by-row method.  In
addition, if we can removes the data dependency among elements within
the same row, then the computation on the elements of the same row can
be {\em fully} and {\em evenly} parallelized.  The result is a much
more balanced workload distribution and a much easier synchronization
among threads.

% On the other hand, if we use the
% Maleki's~\cite{Maleki2016EfficientPU} technique, % need to explain
% this technique it also uses extra space to maintain state
% translation, and spends more time to merge data.  Therefore, it is
% crucial that our parallelization conserves {\em both} memory and
% time.

% It seems that you should use the new figures to explain these???
% Morris: how to make it to row-by-row manner

A sketch of our algorithm is as follows.  Our algorithm computes $V$ one
row at a time.  The computation of each row has two stages.  In the
first stage, the algorithm queries each data structure $C$ for every
column within the rectangle {\em in parallel}, so as to obtain the
maximums of suffix of length $G_A(i) + 1$ of every column, and place
them into an array $R$. Recall from Algorithm~\ref{alg:serial-VGLCS}
that every column of $V$ has a data structure $C$ that supports
incremental suffix maximum on $V$.  Please refer to
Figure~\ref{fig:fig-VGLCS-dp-rmq} for an illustration.

In the second stage, our algorithm issues {\em range maximum queries},
one for each column, on $R$ to compute all $m$ elements of the $i$-th
row of $V$ {\em in parallel}.  Note that unlike the sequential
algorithm, we compute all elements in the $i$-th row of $V$ in parallel,
so we cannot query the {\em suffix} of $R$.  Instead, we need to query a
{\em range} of $R$ for the maximum, where the range is the gap
constraint on that column.  Please refer to
Figure~\ref{fig:fig-VGLCS-dp-rmq} for an illustration.  Note that we
need to add the newly computed $V[i][j]$ into the $C$ of the $j$-th
column {\em incrementally}, so that they will contain the correct
information for the computation of the $(i+1)$-th row.  Also, since the
algorithm iterates in rows, these $C$'s only need to support suffix
maximum query.  No range query on them is required.  In contrast, we do
need to support range maximum query on $R$, and these queries will be in
parallel.

\begin{figure}[!thb]
  \centering \subfigure[The first stage]{
    \includegraphics[width=0.45\linewidth]{\GraphicPath/fig-VGLCS-dp-rmq-first.pdf}
  } \subfigure[The second stage]{
    \includegraphics[width=0.45\linewidth]{\GraphicPath/fig-VGLCS-dp-rmq-second.pdf}
  }
  \caption{Two stages of the computation of one row of $V$.}
  \label{fig:fig-VGLCS-dp-rmq}
\end{figure}

To resolve the data dependency, we need to consider a good data
structure that can handle incremental suffix/range maximum query {\em in
parallel}.  We note that it is {\em not} feasible to parallelize the
disjoint set implementation for three reasons.  First, a query for
disjoint set will change the data structure because a lookup will {\em
compress} the path to the root.  It is difficult to maintain a
consistent view of the data structure when multiple threads are
compressing the path {\em simultaneously}.  Second, when multiple
threads are compressing different paths, the load among them could be
very different, and this will incur load imbalance.  Third, there will
be a large number of threads working on different parts of the disjoint
set, therefore it will be difficult to synchronize them efficiently.

\subsubsection{Sparse Table} \label{sec:sparse-table}

Since the disjoint set cannot be implemented efficiently in parallel,
we use {\em sparse table}~\cite{Berkman1993RecursiveSP} to support
incremental suffix/range maximum queries in our VGLCS algorithm.
Sparse table~\cite{Berkman1993RecursiveSP} requires a $O(n \log n)$
preprocessing, and can support range maximum query in $O(1)$ time on
one dimensional data.  A sparse table is a two dimensional array.  The
element of a sparse table in the $j$-th row and $i$-th column is the
maximum among the $i$-th elements and its $2^j - 1$ predecessors in
the input array.

We give an example of the sparse table
(Figure~\ref{fig:interval-decomposition}).  The input is in array $A$.
Then we build a sparse table $T$ on $A$ as described earlier.  Now a
ranged maximum query on $A$ can be answered by at most {\em two} queries
into the sparse table.  For example, if the query is from 2 to 13, then
the answer is the maximum of from 2 to 9 ($T[3][9]$), and from 6 to 13
($T[3][13]$).  Both are from the third level of the table since each has
the maximum of $2^3 = 8$ elements in the input.

\begin{figure}[!thb]
  \centering \subfigure[Array]{
    \includegraphics[width=0.45\linewidth]{\GraphicPath/fig-interval-decomposition-origin.pdf}
    \label{fig:fig-interval-decomposition}
  } \subfigure[Sparse table]{
    \includegraphics[width=0.45\linewidth]{\GraphicPath/fig-sparse-table-origin.pdf}
    \label{fig:fig-sparse-table}
  }
  \caption{A sparse table example}
  \label{fig:interval-decomposition}
\end{figure}

It is easy to see that one can build a sparse table in parallel
efficiently.  Please refer to
Algorithm~\ref{alg:parallel-sparse-table} for details.
Algorithm~\ref{alg:parallel-sparse-table} builds sparse table in
parallel and in $O(n \log n / p + \log n)$ time, where $n$ is the
number of elements and $p$ is the number of processors.  This
algorithm is very easy to parallelize and implement.

\input{\AlgoPath/alg-parallel-sparse-table-2e}

\subsubsection{A Parallel VGLCS with Sparse Table}

The operations on a sparse table are much easily to parallelize than
those on a disjoint set, which is used within the inner loop of Peng's
sequential VGLCS algorithm.  The inner loop of Peng's algorithm
alternates between append and query operations on $R$.  Please refer
to Algorithm~\ref{alg:serial-VGLCS} for details.  This alternation
between appending and querying incurs heavy data dependency.  In
addition, the parallelism of operations on a disjoint tree is limited
by the length of path under compression.  The length is usually very
short and provides very limited parallelism.

The pseudo code of our parallel VGLCS algorithm with sparse table is
given in Algorithm~\ref{alg:parallel-VGLCS}.  The algorithm computes
$V$ one row at a time.  The computation of each row has two stages.
In the first stage, the algorithm queries the $C$'s {\em in parallel}
to obtain the maximums of suffix of length $G_A+1$ and place them
into an array $R$.  Then we build a sparse table $T$ with the data of
$R$.  Then in the second stage, the algorithm queries $T$ to find the
range maximum in $R$ to compute all elements in the $i$-th row of $V$
{\em in parallel}.

\input{\AlgoPath/alg-parallel-VGLCS-2e}

The implementation of the two stages have different challenges.  The
first stage is easier to parallelize because the operations on
individual columns are {\em independent}.  However, it will insert new
data into $C$, and still needs to answer suffix queries efficiently in
order to build the $R$ array.  The second stage does {\em not}
requires insertion so it is more static.  However, since we compute
all $V$'s in the same row in parallel, it requires {\em ranged
  queries}, instead of suffix queries, on the sparse table $T$.  The
next two sections will describe our approaches to address these
challenges of two stages.  For ease of presentation we will describe
our approach for the second stage in Section~\ref{sec:parallelRMQ}
first.  Then we address the first stage in Section~\ref{sec:QIUD}.


 \documentclass[pre,twocolumn,superscriptaddress]{revtex4}

\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{color}
\usepackage{comment}
\usepackage{float}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[utf8]{inputenc} % allows using accents directly in text, like ÔøΩ
\usepackage{subfig}
\usepackage{xspace}
%\usepackage{cuted}

\captionsetup{justification=raggedright,
singlelinecheck=false
}

\newcommand{\pygbe}{\texttt{PyGBe}\xspace}
\newcommand{\gb}{{\small G\,B1\,D4$^\prime$}\xspace}
\newcommand{\gmres}{\textsc{gmres}\xspace}
\newcommand{\bem}{\textsc{bem}\xspace}
\newcommand{\ses}{\textsc{ses}\xspace}
\newcommand{\sam}{\textsc{sam}}
\newcommand{\gpu}{\textsc{gpu}}
\newcommand{\cpu}{\textsc{cpu}}
\newcommand{\apbs}{\textsc{apbs}\xspace}
\newcommand{\nvidia}{\textsc{nvidia}\xspace}
\newcommand{\msms}{\texttt{\textsc{msms}}\xspace}
\newcommand{\amber}{\texttt{\textsc{amber}}\xspace}
\newcommand{\ccby}{\textsc{cc-by}\xspace}
\newcommand{\bigO}{\mathcal{O}}
\renewcommand{\O}[1]{\mathcal{O}(#1)}

\graphicspath{{figs/}} %  PATH to figure files-- change to ./ for submission

\begin{document}

\title{Computational nanoplasmonics in the quasistatic limit for biosensing applications}

\author{Natalia C. Clementi}
\email{ncclementi@gwu.edu}
\affiliation{Department of Mechanical \& Aerospace Engineering, The George Washington University, Washington, D.C.}

\author{Christopher D. Cooper}
\email{christopher.cooper@usm.cl}
\affiliation{Department of Mechanical Engineering and Centro Cient\'ifico Tecnol\'ogico de Valpara\'iso, Universidad T\'ecnica Federico Santa Mar\'ia, Valpara\'iso, Chile.}

\author{Lorena A.~Barba}
\email{labarba@gwu.edu}
\affiliation{Department of Mechanical \& Aerospace Engineering, The George Washington University, Washington, D.C.}
%\date{\today}

\begin{abstract} % in revtex4, the abstract must come before the \maketitle command

The phenomenon of localized surface plasmon resonance provides high sensitivity in detecting biomolecules through shifts in resonance frequency when a target is present.
Computational studies in this field have used the full Maxwell equations with simplified models of a sensor-analyte system, or neglected the analyte altogether.
In the long-wavelength limit, one can simplify the theory via an electrostatics approximation, while adding geometrical detail in the sensor and analytes (at moderate computational cost).
This work uses the latter approach, expanding the open-source \pygbe code to compute the extinction cross-section of metallic nanoparticles in the presence of any target for sensing.
The target molecule is represented by a surface mesh, based on its crystal structure.
\pygbe is research software for continuum electrostatics, written in Python with computationally expensive parts accelerated on GPU hardware, via PyCUDA.
It is also accelerated algorithmically via a treecode that offers $\mathcal{O}(N \log N)$ computational complexity.
These features allow \pygbe to handle problems with half a million boundary elements or more.
In this work, we demonstrate the suitability of \pygbe, extended to compute LSPR response in the electrostatic limit, for biosensing applications.
Using a model problem consisting of an isolated silver nanosphere in an electric field, our results show grid convergence as $1/N$, and accurate computation of the extinction cross-section as a function of wavelength (compared with an analytical solution).
For a model of a sensor-analyte system, consisting of a spherical silver nanoparticle and a set of bovine serum albumin (BSA) proteins, our results again obtain grid convergence as $1/N$ (with respect to the Richardson extrapolated value).
Computing the LSPR response as a function of wavelength in the presence of BSA proteins captures a red-shift of 0.5 nm in the resonance frequency due to the presence of the analytes at 1-nm distance.
The final result is a sensitivity study of the biosensor model, obtaining the shift in resonance frequency for various distances between the proteins and the nanoparticle.
All results in this paper are fully reproducible, and we have deposited in archival data repositories all the materials needed to run the computations again and re-create the figures. \pygbe is open source under a permissive license and openly developed. Documentation is available at \url{http://barbagroup.github.io/pygbe/docs/}.
\end{abstract}

\maketitle

% Body of paper.

\section{Introduction} \label{sec:intro}
\input{introduction}

%=============
\section{Methods}\label{sec:methods}
\input{methods}

%=============
\section{Results} \label{sec:results}
\input{results}

%=============
\section{Discussion} \label{sec:discussion}
\input{discussion}

\section{Conclusion}
%\input{conclusion}

In this work, we combined the implicit-solvent model of electrostatics interactions in \pygbe
with a long-wavelength representation of LSPR response in nanoparticles.
We extended \pygbe to work with complex-valued quantities, and added functionality to
include an imposed electric field and compute relevant quantities
(dipole moment, extinction cross-section).
Previous work with \pygbe showed its suitability for computing
biomolecular electrostatics considering solvent-filled cavities and Stern layers \cite{CooperBardhanBarba2013},
and for protein-surface electrostatic interactions \cite{CooperBarba2016}.
This latest extension can offer a valuable computational approach to study nanoplasnomics and aid in the design of LSPR biosensors.
Thanks to algorithmic acceleration with a treecode, and hardware acceleration with GPUs, \pygbe is able to compute problems with half a million elements, or more, which is required to represent the molecular surface accurately.

\begin{acknowledgments}

CDC acknowledges the financial support from CONICYT through projects FONDECYT Iniciaci\'on 11160768 and Basal FB0821.
\end{acknowledgments}

% Create the reference section using BibTeX:
%\bibliographystyle{} % revtex ournal sub-style automatically sets this
\bibliography{compbio,bem,scicomp,fastmethods,biosensors} %don't leave spaces between elements, it throws error

\end{document}


\title{\bf Structure Formation}

\section{Basics \& Nomenclature}

Within the overall cosmological growth, fluctuations grow through
gravitation. Inflationary theory predicts that these fluctuations
originate from quantum fluctuations frozen in as progressively larger
scales become causally disconnected in inflation. Cosmic microwave
background observations of temperature fluctuations find that at
recombination ($z\sim 1100$) the density fluctuations were
fractionally of order $10^{-5}$. These fluctuations grow first
linearly and then nonlinearly to form bound structures known as {\it
  dark matter haloes}. It is within these bound structures that
galaxies form.

At lower redshifts, we can define the matter fluctuations around the
homogenous density $\rho_0$:
\begin{equation}
\frac{\rho}{\rho_0} = 1+ \delta
\end{equation}
When it is considered in configuration space, $\delta$ is often
filtered on some scale $\gg 1$ kpc.  However, we often quantify the
two point statistics of this field using the power spectrum $P(k)$ of
$\delta$ and a corresponding correlation function $\xi(r)$.

The power spectrum is defined as:
\begin{equation}
\left\langle \tilde\delta(\vec{k}) \tilde\delta(\vec{k}') \right\rangle
= (2\pi)^3 \delta_D\left(\vec{k} - \vec{k}'\right) P(k).
\end{equation}
In plain language, the power spectrum is the variance in the
amplitudes of the Fourier mode amplitudes as a function of wavenumber
$k$. The Fourier transform of the power spectrum is the correlation
function:
\begin{equation}
\left\langle\delta\left(\vec{x}\right) \delta\left(\vec{x}
+ \vec{r} \right) \right\rangle = \xi(r).
\end{equation}
In plain language, the correlation function is the excess probability
of finding a pair of galaxies with separation $r$, above the
probability for a spatially uniform Poisson distribution with the same
number density of galaxies.  Typically, $P(k)$ and $\xi(r)$ are
expressed in comoving coordinates, because as discussed below under
linear theory their overall shape in comoving coordinates is retained,
and only their amplitude changes.

The inflationary $\Lambda$CDM prediction for $P(k)$ is that during the
era of linear gravitational growth, on large scales (low $k$) its
power law slope is $n\sim 1$ and on small scales (high $k$) its power
law slope is $n\sim -3$ (e.g. \citealt{bardeen86a}; Appendix G). The
turnover scale is associated with the Hubble scale at matter-radiation
equality, for reasons explored in the exercises. We can characterize
the overall second-order amplitude fluctuations on any scale as:
\begin{equation}
\Delta(k) \sim k^3 P(k)
\end{equation}
which makes it clear that the strongest fluctuations are on the
smallest scales, a characteristic known as {\it hierarchical
clustering}. As shown below, $\Delta(k)$ will undergo a linear growth
phase at early times.  When $\Delta(k) \sim 1$, fluctuations on that
scale go nonlinear, and in general the growth rate of fluctuations
accelerates. Because smaller scales clearly go nonlinear first, this
process leads to a nonlinear power spectrum flatter than the linear
spectrum.

The overall amplitude is often quantified by $\sigma_8$, which is the
standard deviation of fluctuations in 8 $h^{-1}$ Mpc radius spheres,
which can also be expressed as an integral of $P(k)$. When the
equivalent quantity $\sigma_{8,g}$ for galaxies is measured in the
galaxy distribution, this quantity is expressed as the observed level
of fluctuations, and consequently includes the nonlinear effects
present in the real universe. When $\sigma_8$ of the matter is
inferred from cosmological observations (the cosmic microwave
background, or gravitational lensing, or redshift space distortions)
it is usually defined as the primordial $\sigma_8$ linearly evolved to
$z=0$ or the redshift in question.

In galaxy surveys, $\delta$ is not directly observable, but the
overdensity $\delta_g$ of some particular class of galaxies can be. On
large scales, where $\delta\ll 1$, often it is sufficient to
approximate the relationship between the two with a {\it linear, local
galaxy bias}:
\begin{equation}
\delta_g(\vec{x}) \approx b \delta(\vec{x})
\end{equation}
On small scales this relationship cannot remain linear and in general
cannot be local either. Bias can alternatively be defined as
$\sigma_{8,g} / \sigma_8$ (or equivalent statistical quantities on
larger scales). In general the halo occupation distribution model is a
more accurate description of the relationship between galaxies and
matter, but the concept of galaxy bias as defined here is still
useful, especially on linear scales.

To understand the linear growth, we start with the equations of motion
for a pressureless, gravitating fluid:
\begin{eqnarray}
\label{eq:homogeneous}
\frac{\mathrm{D}\vec{v}}{\mathrm{D}t} &=& - \vec\nabla\phi
\mathrm{\quad (Euler's~equation)}\cr
\frac{\mathrm{D}\rho}{\mathrm{D}t} &=& - \rho \vec\nabla\cdot \vec{v}
\mathrm{\quad (Continuity~equation)}\cr
\nabla^2\phi &=& 4\pi G \rho
\mathrm{\quad (Poisson's~equation)}
\end{eqnarray}
where the convective derivative is:
\begin{equation}
\frac{\mathrm{D}}{\mathrm{D}t} = \frac{\partial}{\partial t} +
\vec{v}\cdot\vec{\nabla}
\end{equation}
Here and below $\nabla$ refers to a spatial derivative in physical
units (not comoving units).

For the $\Omega_m = 1$ case, we can show that:
\begin{equation}
a(t) = \left(\frac{t}{t_0}\right)^{2/3}
\end{equation}
which if we use to construct a homogeneous solution to the above
equations, we can perturb the density around the homogenous density
$\rho_0(a) \propto a^{-3}$:
\begin{equation}
\frac{\rho}{\rho_0} = 1+ \delta
\end{equation}
We will also make use of the time derivative with respect to a
comoving observer, which is related to the convective derivative by:
\begin{equation}
\frac{\mathrm{D}}{\mathrm{D}t} = \frac{\mathrm{d}}{\mathrm{d} t} +
\vec{v}_p\cdot\vec{\nabla}
\end{equation}
Here we choose to keep the peculiar velocity in physical units, and
the derivative $\nabla$ in physics units (not comoving units).  We can
show the continuity equation holds for peculiar velocities:
\begin{equation}
\label{eq:continuity}
\frac{\mathrm{d}\delta}{\mathrm{d}t} =
- \vec\nabla\cdot\vec{v}_p
\end{equation}
In the perturbed quantities we find to linear order:
\begin{eqnarray}
\frac{\mathrm{d}\vec{v}_p}{\mathrm{d}t} &=&
- \vec\nabla(\delta\phi)
- H(t) \vec{v}_p \cr
\nabla^2\left(\delta\phi\right)&=& 4\pi G \rho_0 \delta
\end{eqnarray}
Remembering that the spatial derivatives are in physical, not comoving
units, we can write:
\begin{equation}
\frac{\mathrm{d}}{\mathrm{d}t} \left[ \vec\nabla\cdot\vec{v}_p \right]
=
\vec\nabla\cdot
\left[\frac{\mathrm{d}\vec{v}_p}{\mathrm{d}t} \right]
+ H(t) \frac{\mathrm{d}\delta}{\mathrm{d}t}
\end{equation}
Then one can take a time derivative with respect to a comoving
observer to Equation \ref{eq:continuity}, and with substitutions this
leads to a second-order equation for the density:
\begin{equation}
\label{eq:secondorder}
\frac{\mathrm{d}^2\delta}{\mathrm{d}t^2} + 2 \frac{\dot a}{a}
\frac{\mathrm{d}\delta}{\mathrm{d}t} - 4 \pi G \rho_0 \delta = 0
\end{equation}
This linear set of equations is separable, so that whatever spatial
pattern exists simply changes in amplitude over time:
\begin{equation}
\delta(x, t) = \delta(x, t_0) \frac{D(t)}{D(t_0)},
\end{equation}
where often the convention is $D(t_0) = 1$.
  The general solution is:
\begin{equation}
\label{eq:lineargrowth}
D(t) = A t^{-1} + B t^{2/3}
\end{equation}
The first mode is decaying, and thus not important to the growth
of structure.  The second mode is the one that contributes to the
growth of structure.

This set of solutions is appropriate for the zero-energy, or ``flat''
Universe, without a cosmological constant, when matter density (rather
than radiation) dominates. At early times (but after matter-radiation
equality), while deceleration dominates the dynamics, it is a good
description of the Universe.  However, at later times it becomes less
good. In particular, in our Universe, which appears to be
accelerating, the growth is slowed down considerably by the
acceleration.

The continuity equation (\ref{eq:continuity}) and linear growth imply
a relationship between the peculiar velocity field and the growth
rate. If we convert the spatial derivative to comoving units we find:
\begin{equation}
\frac{1}{a} \vec\nabla_c\cdot\vec{v}_p = - \delta(\vec{x}, t_0) \dot
D(t),
\end{equation}
(taking $D(t_0) = 1$), which we can rewrite as:
\begin{equation}
\vec\nabla_c\cdot\vec{v}_p = - a \delta(\vec{x}, t_0) \dot
D(t) = - a \delta(\vec{x}, t_0) H f
\end{equation}
where the {\it growth rate} is:
\begin{equation}
f = \frac{\dd \ln D}{\dd \ln a}
\end{equation}
The choice to express this result in terms of the comoving spatial
derivative of the physical peculiar velocity is strange but
conventional.

This peculiar velocity field distorts redshift-based maps of the
universe in a specific way on large scales, that can be measured to
constrain $f$. Since $\delta$ is not directly observable, the directly
observable quantity on linear scales is $\beta = f/b$. Since the
fluctuations in the galaxy sample can be observed, we can recast
$\beta = f \sigma_8 / \sigma_{8,g}$ and the observable is
$\beta \sigma_{8,g}$, from which we infer $f\sigma_8$.

As small scales go nonlinear, gravitationally bound objects will
form. This process can be approximated in the spherical case. If we
situate our coordinate system on the center of a spherical system with
a constant overdensity $\bar\delta > 0$ and size $R$, the system can
be considered completely analogous to a universe with matter density
of $\Omega_m(1+\bar\delta)$. Therefore, if this quantity is greater
than unity, than the sphere will expand for some time, then turn
around at $t=t_{\rm TA}$, and then collapse on itself; this process
can be followed exactly. It can be shown that the mean density of the
sphere at turn-around is about 5.5 times the mean density of the
universe, and collapse occurs in twice the turn-around time. The
virial theorem and energy conservation lead to a typical overdensity
of the collapsed object within its virial radius of $\delta_{\rm vir}
= 18\pi^2 \approx 178$. Meanwhile, the linearly extrapolated
overdensity at that time is only about $\delta_{\rm linear}\approx
1.7$.

The mass spectrum of collapsed halos can be predicted approximately
using {\it excursion set theory}, or the {\it Press-Schechter}
approach (\citealt{press74a, bond91a, lacey93a}). Imagine a patch of
mass $M$ at early times; it will have some specific radius $R$
depending on the mean density. We can predict when it will collapse to
a virialized object when $\delta_{\rm linear} \approx 1.686$ within
radius $R$. At any given time, we can ask what fraction of the
universe's volume, when smoothed on radius $R$, has $\delta_{\rm
linear} > 1.686$. For simplicity, we will smooth by a top-hat in
$k$-space (in configuration space this is smothing by the first order
spherical Bessel function $j_1$). Calculating this fraction tells us
for any mass (that is, smoothing scale), what fraction of the volume
ends up in dark matter halos greater than that mass. This function can
be differentiated to yield the halo mass function:
\begin{equation}
\Phi(M) \dd M
= \frac{1}{\sqrt{2\pi}} \frac{\bar \rho}{M} \frac{\delta_c}{\sigma^3(M)} \left[
- \frac{\dd \sigma^2}{\dd
M}\right] \exp\left[-\frac{\delta_c^2}{2\sigma^2}\right] \dd M
\end{equation}
For $P(k)\propto k^n$, one can show:
\begin{equation}
\Phi(M) \dd{M} = \frac{\bar\rho}{\sqrt{2\pi}
M} \left(\frac{M}{M_\ast}\right)^{(n+3)/6}
\left(\frac{n+3}{3}\right)
\exp\left[-\frac{1}{2}\left(\frac{M}{M_\ast}\right)^{(n+3)/3}\right] \frac{\dd
M}{M}
\end{equation}
Where the nonlinear mass $M_\ast$ is defined by the relation:
\begin{equation}
\sigma^2 = \left(\frac{M}{M_\ast}\right)^{-(n+3)/3} \delta_c^2.
\end{equation}
Because $n>-3$ always, as $\sigma^2$ grows with time, the nonlinear
mass scale grows.  In the standard cosmology, at low small scales (and
thus low masses) $n$ slowly approaches $-3$ from above and
$\Phi(M) \propto M^{-2 + \epsilon}$, where $\epsilon = (n+3) /3$, and
thus is almost divergent.

The detailed prediction of nonlinear growth and collapse to dark
matter halos requires the use of simulations. Because the dark matter
is collisionless, fluid simulations are not sufficient. The universal
approach is to model the dark matter statistically using a large
number of collisionless particles; the $N$-body approximation. An {\it
N-body simulation} is understood to model only the dark matter. These
simulations use some variant of particle-mesh techniques on large
scales, often with an adaptive component on small scales that may use
direct calculations of mutual forms. They invariably employ some
softening length that is reported as the resolution.  {\it
Hydrodynamic} simulations include baryonic fluids in the modeling, and
often their cooling and collapse to stellar systems. They may also
include feedback of supernovae, winds, and active galactic nuclei on
the fluid; this {\it subgrid physics} is typically parameterized in a
simple way.

One important insight from N-body simulations is how halos grow through
accretion of smaller companion halos. These accreted halos often
survive for long periods of time, and are therefore distinct clumps
known as {\it subhalos} within each halo. The centers of halos and
subhalos are the locations where galaxies form (\citealt{wechsler18a}).

The simulations also clarify the internal structure of
halos. Generally their radial profiles can be modeled as:
\begin{equation}
\rho(r) = \frac{\rho_s}{\frac{r}{r_s}\left(1
+ \frac{r}{r_s}\right)^2},
\end{equation}
the ``NFW'' profile of \citet{navarro97a}. In the context of a
specific profile, we define $R_{\rm vir}$ and $M_{\rm vir}$ based on
the radius and enclosed mass within which the mean overdensity is
$\delta_{\rm vir}$ as predicted by the spherical collapse model. Thus:
\begin{equation}
M_{\rm vir} = \frac{4\pi}{3} R_{\rm vir}^3 \bar\rho \left(1+ \delta_{\rm
vir}\right)
\end{equation}
The halo concentration can be characterized by:
\begin{equation}
c_{\rm vir} = \frac{R_{\rm vir}}{r_s}
\end{equation}
The structure of a halo is fully defined by $M_{\rm vir}$ and $c_{\rm
vir}$. In simulations, typically $c_{\rm vir} \sim 5$--$30$
(\citealt{bullock01b, wang20a}), declining with increasing halo mass
and with increasing redshift. Any given choice of halo structure
yields a particular maximum circular velocity $v_{\rm max}$; the
dependence on mass is such that:
\begin{equation}
M_{\rm vir} \propto v_{\rm max}^{3.4}.
\end{equation}

\section{Commentary}

\section{Key References}

\begin{itemize}
  \item
    {\it Physics Foundations of Cosmology},
    \citet{mukhanov05a}
  \item
    {\it The large-scale structure of the
    universe}, \citet{peebles80a}
  \item
    {\it Formation and Evolution of Galaxies: Les Houches
    Lectures}, \citet{white94a}
\end{itemize}

\section{Order-of-magnitude Exercises}

\begin{enumerate}
\item At approximately what redshift does structure growth start to
    slow down for a Universe with $\Omega_m = 0.3$, $\Omega_\Lambda = 0.7$?
\end{enumerate}

\section{Analytic Exercises}

\begin{enumerate}
\item We can understand the shape of the linear power spectrum $P(k)$
once we understand how growth proceeds for $k$ modes inside and
outside the Hubble radius $r_{\rm Hubble} = c/H(t)$. Here we give the
picture in the ``synchronous gauge''; the heuristic narrative outside
the horizon depends on gauge, but the observables do not
(\citealt{ma95a}). The inflationary $P_{\rm inflation}(k)\propto k$ at
all scales (roughly). However, during the radiative-dominated era,
$P(k)$ is altered so that it turns over at small scales and becomes
$\propto k^{-3}$ at small scales. All of this happens when all scales
are still very much in the linear growth regime, and so the resulting
function is usually referred to as $P_{\rm linear}(k)$, the ``linear''
power spectrum.  The transfer function is defined as $T(k) = P_{\rm
linear}(k) / P_{\rm inflation}(k)$, where we remind ourselves that $k$
is expressed in comoving coordinates. During radiation domination,
inside the horizon the density only grows logarithmically (because the
Jeans scale is nearly the horizon size for a relativistic fluid) and
outside the Hubble radius the density grows as $\delta\propto
a^2$. During matter domination, at all scales $\delta\propto a$.
\begin{enumerate}
\item For a mode $k$ (expressed in comoving coordinates) that
enters the Hubble radius before matter-radiation equality, how does
the scale radius $a_{\rm in}$ at which it enters the Hubble radius
depend on $k$?

\begin{answer}[Author: Nicholas Faucher]
For any power law dependence of $a(t)= t^n$ on time, the Hubble radius
$r_{\rm Hubble} = c a/{\dot a} \propto a^{1/n}$ in physical
coordinates. In comoving coordinates, $r_{\rm Hubble, c} \propto
a^{1/n-1}.$ In the radiation dominated era where $a\propto t^{1/2}$,
therefore, $r_{\rm Hubble,c} \propto a$. Since $k \propto r^{-1}$,
then the scale radius at which mode $k$ enters the horizon scales with
$k$ as $a_{\rm in} \propto k^{-1}$.
\end{answer}

\item How does the growth factor experienced outside the horizon scale
with $k$, for scales that enter the horizon during the radiation
dominated era?

\begin{answer}[Author: Nicholas Faucher]
As noted above, the growth factor outside the horizon in the radiation
dominated era scales with $a^2$, so by the time they enter the
horizons the densities $\delta$ have grown an amount $\propto a_{\rm
in}^2 \propto k^{-2}$.
\end{answer}
\item Therefore, determine how the primordial $P(k) \propto k$ will
have been modified by the time the universe has reached
matter-radiation equality?

\begin{answer}
The power spectrum $P(k)\propto \delta^2$ so at scales below the
Hubble radius, the amount that the power spectrum on comoving
wavenumbers $k > 2\pi/r_{\rm Hubble, c}$ at matter-radiation equality
will have grown is $\propto k^{-4}$. At $k<2\pi/r_{\rm Hubble, c}$,
the primordial $P(k)$ will have grown in amplitude but not changed its
dependence on scale.

Therefore if the initial, primordial $P(k) \propto k$ at all scales,
then it will retain that shape at small $k$, but be altered to
$P(k)\propto k^{-3}$ at large $k$, with a broad turn-over region
around $k \sim 2\pi/r_{\rm Hubble, c}$, with $r_{\rm Hubble, c}$ being
the comoving Hubble radius at matter-radiation equality.

After matter-radiation equality, both large and small scales grow
$\propto a$, so the shape of $P(k)$ is ``frozen in'' and only the
amplitude grows, until nonlinear growth ensuse on small scales.
\end{answer}
\end{enumerate}
\item Starting from the continuity equation in Equation
   \ref{eq:homogeneous}, assuming a flat matter dominated universe
    ($\Omega_m = 1$), and keeping only first-order terms, derive
    Equation \ref{eq:continuity}.

%\begin{answer}
%\begin{eqnarray}
%\frac{{\rm D}\vec{v}}{{\rm D} t} =
%\left[ \frac{\dd{}}{\dd{t}} + \vec{v}_p \cdot \vec{\nabla} \right]
%\left[\rho_0 \left(1+\delta\right)\right] &=&
%- \rho_0 (1+\delta) \vec{\nabla}\cdot\vec{v}_0
%- \rho_0 (1+\delta) \vec{\nabla}\cdot\vec{v}_p \cr
%
%\frac{\dd{\rho_0}}{\dd{t}}
%\frac{\dd{}}{\dd{t}}\left(\rho_0 \delta\right)
%+ \vec{v}_p \cdot \vec{\nabla} \right]
%\left[\rho_0 \left(1+\delta\right)\right] &=&
%- \rho_0 (1+\delta) \vec{\nabla}\cdot\vec{v}_0
%- \rho_0 (1+\delta) \vec{\nabla}\cdot\vec{v}_p
%\end{eqnarray}
%\end{answer}

\item Starting from Equation \ref{eq:homogeneous}, and assuming a flat
    matter dominated universe ($\Omega_m = 1$), derive
    Equation \ref{eq:secondorder}.

\begin{answer}[Author: Kate Storey-Fisher]
Equations \ref{eq:homogeneous} are the equations of motion for a
pressureless, gravitating fluid (Euler's equation, the continuity
equation, and Poisson's equation).

We can perturb the density around the homogeneous density $\rho_0$.
If $\Omega_m = 1$, conservation of energy gives us $\rho_0
\propto a^{-3}$. We also perturb the other quantities, giving:
\begin{eqnarray}
\rho  &\rightarrow& (1+\delta)\rho_0 \\
\vec{v} &\rightarrow& \vec{v}_0 + \vec{v}_p \\
\phi  &\rightarrow& \phi_0 + \delta\phi
\end{eqnarray}

For Poisson's equation we find:
\begin{eqnarray}
\nabla^2\phi &=& 4\pi G \rho  \cr
\nabla^2\left(\phi_0 + \delta\phi\right) &=& 4\pi
G \rho_0\left(1+\delta\right)  \cr
\nabla^2\left(\delta\phi\right) &=& 4\pi G \rho_0 \delta
\end{eqnarray}

For Euler's equation we find:
\begin{eqnarray}
\frac{{\rm D}\vec{v}}{{\rm D} t} =
\left[ \frac{\dd{}}{\dd{t}} + \vec{v}_p \cdot \vec{\nabla} \right]
\left[\vec{v}_0 + \vec{v}_p\right] &=& - \vec{\nabla}\left(\phi_0
+ \delta\phi\right) \cr
\frac{\dd{\vec{v}_0}}{\dd{t}} + \vec{v}_p \cdot \vec{\nabla}\vec{v}_0
+ \frac{\dd{\vec{v}_p}}{\dd{t}} + \vec{v}_p \cdot \vec{\nabla}\vec{v}_p
&=& - \vec{\nabla}\phi_0 - \vec{\nabla}\left(\delta\phi_0\right)
\end{eqnarray}
The first terms on both sides cancel because they solve the
homogeneous equations (for which ${\rm D}/{\rm D}t
= \dd{}/\dd{t}$). The last term on the left hand side is
second-order. Rearranging, we are left with
\begin{eqnarray}
\frac{\dd{\vec{v}_p}}{\dd{t}}
&=& - \vec{v}_p \cdot \vec{\nabla}\vec{v}_0
- \vec{\nabla}\left(\delta\phi_0\right)
\end{eqnarray}
Remembering that $\vec{v}_0 = ({\dot a}/a)\vec{r} = H\vec{r}$, where
$\vec{r}$ is in physical units, we have
\begin{eqnarray}
\label{eq:dvdt}
\frac{\dd{\vec{v}_p}}{\dd{t}}
&=&
- H \vec{v}_p
- \vec{\nabla}\left(\delta\phi_0\right)
\end{eqnarray}
where the first term on the right-hand side is the Hubble drag term.

We now take the divergence of Equation \ref{eq:dvdt}, and get
\begin{eqnarray}
\nabla \cdot \frac{\mathrm{d}\vec{v}_p}{\mathrm{d} t} &=& -\vec{\nabla}^2(\delta\phi) - H(t)\nabla \cdot \vec{v}_p \\
 &=& -4\pi G \rho_0 \delta + H(t) \frac{\mathrm{d}\delta}{\mathrm{d} t}  \label{eq:4piG}
\end{eqnarray}
where in the second line we have substituted the continuity equation
and the Poisson equation.

Taking the time derivative of the continuity equation, we find:
\begin{equation}
\frac{\mathrm{d}^2\delta}{\mathrm{d} t^2}
= \frac{\mathrm{d}}{\mathrm{d}
t}\left(-\vec{\nabla} \cdot \vec{v}_p\right) \label{eq:d2delta}
\end{equation}

Because the spatial derivatives are in physical units, and using the
continuity equation again:
\begin{equation}
\frac{\mathrm{d}^2\delta}{\mathrm{d} t^2} =
- \frac{\mathrm{d}}{\mathrm{d}t} \left(\vec{\nabla} \cdot \vec{v}_p\right)
- = \vec{\nabla} \cdot \frac{\mathrm{d}\vec{v}_p}{\mathrm{d} t} - H(t) \frac{\mathrm{d}\delta}{\mathrm{d} t}
\end{equation}

And now substitute Equation \ref{eq:4piG} into the RHS of the above equation:
\begin{equation}
\frac{\mathrm{d}^2\delta}{\mathrm{d} t^2} = -\Bigg(-4\pi G \rho_0 \delta + H(t) \frac{\mathrm{d}\delta}{\mathrm{d} t}\Bigg) - H(t) \frac{\mathrm{d}\delta}{\mathrm{d} t}
\end{equation}
Rearranging,
\begin{equation}
\frac{\mathrm{d}^2\delta}{\mathrm{d} t^2} +
2H(t) \frac{\mathrm{d}\delta}{\mathrm{d} t} - 4\pi G \rho_0 \delta =
0,
\end{equation}
which is the equation for linear growth of the overdensity field.
\end{answer}

\item Show that Equation \ref{eq:lineargrowth} solves
Equation \ref{eq:secondorder}.
\item Consider a spherical region with mean overdensity $\bar\delta
>0$, within an expanding universe with no cosmological constant. As
 long as there is no {\it shell crossing} --- that is, material at one
 radius does not catch up to material at another radius --- the
 equations governing the radius of this sphere over time are
 \begin{equation}
\frac{\dd^2 R}{\dd t^2} = - \frac{GM(<r)}{R^2} = - \frac{4\pi
 G}{3} \bar\rho(1+\bar\delta) R
 \end{equation}
\begin{enumerate}
\item In terms of $\Omega_m$ at the present time, what is the
condition that the spherical region will collapse on itself?

\begin{answer}
This region will evolve the same way as a universe with
matter density $\Omega_m(1+\bar\delta)$. The condition for a closed
universe then implies $\Omega_m(1+\bar\delta)>1$ or
\begin{equation}
\bar\delta > \frac{1}{\Omega} -1.
\end{equation}
\end{answer}

\item Demonstrate that the solutions to the above equation can be
expressed as:
\begin{eqnarray}
\label{eq:sphericalcollapse}
\frac{R}{R_{\rm max}} &=& \frac{1}{2}\left(1 - \cos\eta\right), \cr
\frac{t}{t_{\rm max}} &=& \frac{1}{\pi}\left(\eta - \sin\eta\right)
\end{eqnarray}
where at time $t_{\rm max}$ the sphere reaches its maximum radius of
expansion $R_{\rm max}$, before collapsing.

\begin{answer}[Author: Gregory Beauregard]
We seek the solution to:
\begin{equation}\label{eq:orig}
  \frac{\mathrm d^2 R}{\mathrm dt^2}=-\frac{GM(<r)}{R^2}=-\frac{4\pi G}{3}\bar\rho(1+\bar\delta)R
\end{equation}
We wish to demonstrate that solutions to the above equation can be expressed as
\begin{align}
  \frac{R}{R_\text{max}}&=\frac{1}{2}(1-\cos\eta)\label{eq:r} \\
  \frac{t}{t_\text{max}}&=\frac{1}{\pi}(\eta-\sin\eta)\label{eq:t}.
\end{align}
We do some implicit differentiation with respect to $t$ with
Equations \ref{eq:r} and \ref{eq:t}.
\begin{align}
  \frac{\dot R}{R_\text{max}}&=\frac{1}{2}\dot\eta\sin\eta\label{eq:rd} \\
  \frac{\ddot R}{R_\text{max}}&=\frac{1}{2}(\dot\eta^2\cos\eta+\ddot\eta\sin\eta)\label{eq:rdd} \\
  \frac{1}{t_\text{max}}&=\frac{\dot\eta}{\pi}(1-\cos\eta)\label{eq:td} \\
  0&=\frac{1}{\pi}(\ddot\eta(1-\cos\eta)+\dot\eta^2\sin\eta)\label{eq:tdd}
\end{align}
Solving Equation \ref{eq:tdd} for $\ddot\eta$ and plugging into Equation \ref{eq:rdd} we get a nice simplification:
\begin{equation}
  \frac{\ddot R}{R_\text{max}}=-\frac{\dot\eta^2}{2}\label{eq:rdd-simp}
\end{equation}
From Equation \ref{eq:td} we get $\dot\eta$ as
\begin{equation}
  \dot\eta=\frac{\pi}{t_\text{max}}\frac{1}{1-\cos\eta}\label{eq:etad}.
\end{equation}
We can combine Equations \ref{eq:rdd-simp} and \ref{eq:etad} to get $\ddot R$, the lefthand side of Equation \ref{eq:orig}.
\begin{equation}
  \ddot R=-\frac{\pi^2 R_\text{max}}{2t_\text{max}^2}\frac{1}{(1-\cos\eta)^2}\label{eq:left}
\end{equation}
Computing the righthand side of Equation \ref{eq:orig}, $-GM/R^2$, with Equation \ref{eq:r} we have that
\begin{equation}
  -\frac{GM}{R^2}=-\frac{4GM}{R_\text{max}^2}\frac{1}{(1-\cos\eta)^2}\label{eq:right}.
\end{equation}
By comparing Equation \ref{eq:left} to Equation \ref{eq:right} we see
that Equations \ref{eq:r} and \ref{eq:t} give a solution to
Equation \ref{eq:orig} with
\begin{equation}
  GM=\frac{\pi^2}{8}\frac{R_\text{max}^3}{t_\text{max}^2}.
\end{equation}
\end{answer}

\item Show that at time $t_{\rm max}$, the density of the sphere
relative to the mean density of the universe will be $\rho_{\rm max}
/ \bar\rho(t_{\rm max}) = 9 \pi^2 / 16 \approx 5.5$.

\item The collapse of the sphere will proceed in reverse, and will
therefore take $t_{\rm max}$ to do so. However, upon full collapse
shell-crossing will occur, because the collisionless dark matter will
pass through the origin and oscillate around it. This process can be
modeled (\citealt{bertschinger85a, lithwick11a}) to derive the detailed
structure of the resulting halo mass profile, but the virial theorem
($U=-2K$) can tell us about its overall size. Show that the final
characteristic radius of the resulting {\it virialized} halo is
$R_{\rm vir} = R_{\rm max} / 2$.

\begin{answer}[Author:Nanoom Lee]
Using the virial theorem, energy conservation
can be written as
\begin{equation}
E(t_{\rm max}) = -\frac{GM^2}{R_\text{max}} = E(t_{\rm vir}) =
-\frac{GM^2}{R_\text{vir}} + K = -\frac{GM^2}{R_\text{vir}} +
\frac{GM^2}{2R_\text{vir}} = -\frac{GM^2}{2R_\text{vir}},
\end{equation}
which gives
\begin{equation}
R_\text{vir}=R_\text{max}/2.
\end{equation}
\end{answer}

\item Show that the mean overdensity within the resulting halo  is
$\delta_{\rm vir} = 18\pi^2 \approx 178$.
\item By linearizing the Equations \ref{eq:sphericalcollapse}, show
that the linearly extrapolated overdensity at the time of collapse is
$\delta_{\rm lin}(2 t_{\rm max}) \approx 1.686$.
\end{enumerate}
\item The Press-Schechter or excursion set estimate of the halo mass
function can be calculated from the statistics of Gaussian random
fields. We can ask what fraction of the volume in the nearly-uniform
early universe ends up in halos of a given mass.  Consider the density
field linearly-evolved to some redshift $z$.
\begin{enumerate}
\item If we smooth the density field on some characteristic scale $R$,
the smoothed density field will relate to the the statistics of halos
of what mass $M$?
\begin{answer}[Author: Trey Jensen]
    Given that we have a nearly uniform universe with density $\bar{\rho}$, we know that the scale will be directly related to the mass via
    \begin{equation}
        M=\bar{\rho} \frac{4}{3}\pi R^3.
    \end{equation}
\end{answer}
\item If the smoothing is performed as a top-hat function in
$k$-space, what does that smoothing corrrespond to in real space?
\begin{answer}[Author: Trey Jensen]
    The Fourier transform of a top-hat in three dimensions is a first order spherical Bessel function:
\begin{equation}
\tilde \delta = \frac{\sin k R}{kR}
\end{equation}
\end{answer}
\item In terms of the power spectrum, how does the variance
$\sigma^2(M)$ scale with $M$?
\begin{answer}[Author: Trey Jensen]
The variance as a function of the wavenumber $k$ is approximately
$\sigma^2(k) \propto k^3 P(k)$. Using $k=2\pi/R$ to associate $k$ and
$R$, and from the previous part knowing the relation of mass to
radius, then, we find:
\begin{equation}
    \sigma^2(k) \sim P(k)
    \left(\frac{32\pi^4\bar{\rho}}{3M}\right)
\end{equation}
\end{answer}
\item Assume that locations above some linearly-evolved
overdensity $\delta_c \sim 1.686$ on scale $R$ or larger have in fact
collapsed into halos of the corresponding mass $M$ or larger. What
fraction $F(>M)$ of the volume has done so (express in terms of $\delta_c$ and
$\sigma(M)$)?
\begin{answer}[Author: Trey Jensen]
    Because we have a Gaussian random field, and we know the standard
    deviation of density from above, then the fraction of volume above
    this critical density on scale $M$ is the probability of this
    Gaussian random field being above this value, that is, we simply
    integrate the the PDF, giving the complementary error function.
    which is the complementary error function. However, we also need
    to account for the regions which are below the critical overdensity on
    scale $M$, but above it on some larger scale. Since the $\delta$
    as a function of increasing smoothing wavenumber $k$ (decreasing
    mass) is a random walk, for all points that cross the critical
    overdensity at some wavenumber smaller than $k$ that are still above
    the critical overdensity at $k$, there is another point that takes the
    equal and opposite path after crossing the critical overdensity, and
    is below the critical overdensity at scale $k$. This leads to an
    extra factor of two so:
    \begin{equation}
        F(>M)
    = \frac{2}{\sqrt{2\pi}\sigma}\int^\infty_{\delta_c}\dd{M} \delta \exp\left(-\frac{\delta^2}{2\sigma^2}\right)
    \end{equation}
    We leave the expression in this form rather than in terms of the
    error function, because it makes the calculation below easier.
\end{answer}

\item Derive from $F(>M)$ the mass function of halos $\Phi(M)$.
\begin{answer}
    The mass function is simply the derivative of $F(>M)$,
    converted to a number density with the factor $\bar{\rho}/M$:
    \begin{equation}
    \Phi(M) =
        \frac{\bar{\rho}}{M} \frac{\dd{}}{\dd{M}} F(>M)
    \end{equation}
    If we rewrite $F(>M)$ with a change of variables $x=\delta/\sigma$:
    \begin{equation}
    F(>M) = \frac{2}{\sqrt{2\pi}} \int_{\delta_c/\sigma}^\infty \dd{x}
                          \exp\left(-\frac{x^2}{2}\right)
    \end{equation}
    then it is apparent that:
    \begin{equation}
    \frac{\partial F}{\partial M}
    = \frac{2}{\sqrt{2\pi}} \exp\left(-\frac{\delta_c^2}{2\sigma^2}\right)
    \frac{\partial}{\partial M}\left(\frac{\delta_c}{\sigma}\right).
    \end{equation}
    We can then convert this to a slightly different form:
    \begin{equation}
    \Phi(M) = \frac{\bar{\rho}}{M}
    \frac{1}{\sqrt{2\pi}} \frac{\delta_c}{\sigma^3}
    \exp\left(-\frac{\delta_c^2}{\sigma^2}\right)
    \left[ - \frac{\partial \sigma^2}{\partial M}\right]
    \end{equation}
    to match the text.
\end{answer}

\item Assume $P(k)\propto k^n$. Define the nonlinear mass $M_\ast$:
\begin{equation}
\sigma^2 = \delta_c^2 \left(\frac{M}{M_\ast}\right)^{-(n+3)/3}.
\end{equation}
Write $\Phi(M)$  in terms of $M_\ast$, $\bar\rho$, and $n$. What
happens as $n\rightarrow -3$, as it does at small scales?
\begin{answer}
First let us evaluate:
\begin{equation}
\frac{\dd \sigma^2}{\dd M}
= - \delta_c^2 \frac{1}{M_\ast} \frac{n+3}{3}
\left(\frac{M}{M_\ast}\right)^{-(n+6)/3}
\end{equation}
Then we can plug in
\begin{eqnarray}
\Phi(M) &=& \frac{\bar{\rho}}{M}
\frac{1}{\sqrt{2\pi}}
\frac{1}{M_\ast} \frac{n+3}{3}
\left(\frac{M}{M_\ast}\right)^{-(n+6)/3}
\frac{\delta_c^3}{\sigma^3}
\exp\left(-\frac{\delta_c^2}{\sigma^2}\right) \cr
&=& \frac{\bar{\rho}}{M}
\frac{1}{\sqrt{2\pi}}
\frac{1}{M_\ast} \frac{n+3}{3}
\left(\frac{M}{M_\ast}\right)^{-(n+6)/3}
\left(\frac{M}{M_\ast}\right)^{(n+3)/2}
\exp\left(-\frac{\delta_c^2}{\sigma^2}\right) \cr
&=& \frac{\bar{\rho}}{M}
\frac{1}{\sqrt{2\pi}}
\frac{1}{M_\ast} \frac{n+3}{3}
\left(\frac{M}{M_\ast}\right)^{(n-3)/6}
\exp\left(-\frac{\delta_c^2}{\sigma^2}\right) \cr
&=& \frac{\bar{\rho}}{M}
\frac{1}{\sqrt{2\pi}}
\frac{1}{M}
\frac{n+3}{3}
\left(\frac{M}{M_\ast}\right)^{(n+3)/6}
\exp\left[-\left(\frac{M}{M_\ast}\right)^{(n+3)/3}\right]
\end{eqnarray}
where the last term matches the corresponding equation in the text.
When $n\rightarrow -3$ from above, and we consider $M\ll M_\ast$, this
mass function becomes close to but slightly shallower then $M^{-2}$,
which would be the divergent function.

It is worth pausing here and asking what it would mean if $n<-3$ ---
would that lead to a divergent mass function? Obviously that cannot
reflect reality, but what happens to the excursion set argument?  What
happens is that $n<-3$ implies that the smallest scales do not
collapse first, because $k^3P(k)$ is not monotonically
increasing. This means that the hierarchical collapse ansatz  that
underlies the excursion set picture fails and it is not applicable in
this case.
\end{answer}

\end{enumerate}

\item Argue {\it qualitatively} why the excursion set approach should
lead to the prediction that dense regions on large scales should have
more high mass dark matter halos; this argument was formalized
originally by \citet{mo96a}.

\begin{answer}
The Press-Schechter ansatz can be expressed in terms of a random
walk. For a random location, consider the smoothed linear density
field around it, starting with very large smoothing and stepping to
smaller and smaller scales. We quantify the smoothing scale by $k$,
where the radius of the smoothing scale is $R=2\pi/k$. For the largest
scales ($k=0$), the overdensity is 0 (the mean). As $k$ increases, the
overdensity at that particular location goes up and down in a random
walk. The first smoothing scale $R=2 \pi/k$) at which the linear
density around that point exceeds $\sim$ 1.7---the first
``upcrossing''---corresponds to the mass of the halo that that
location is in. Imagine performing this random walk for all locations;
the result is an ensemble of different walks, and for those walks the
distribution of the masses associated with the ``first upcrossings''
is the prediction for the distribution of halo masses.

Now consider, instead of a {\it random} location, a location already
known to be an overdense region on some scale $R$. That fixes a
wavenumber $k= 2\pi/R$ and an overdensity $\delta$ at which the random
walk ``starts.'' The random walk proceeds to higher $k$.  But since it
started at some $delta>0$, its first upcrossing will happen sooner on
average, i.e. at smaller $k$. That means that on average these points
will be in larger mass galaxies. Thus, we see that overdense regions
should have halo mass functions that are shifted to higher masses.

Considering a location known to be an underdense region on some scale,
it should have its first upcrossing happen at a larger k, or smaller
mass. So the mass function will be shifted to lower masses in regions
that are underdense on large scales.

\citet{mo96a} take this argument farther (and more rigorously
mathematically) and calculate the relationship between $\delta_m$ and
the halo overdensity $\delta_h$ as a function of halo mass $M$---the
``bias'' of the halos.
\end{answer}

\end{enumerate}

\section{Numerics and Data Exercises}

\begin{enumerate}
\item Download and install CAMB, the standard code to calculate the
power spectrum. Plot the linear $P(k)$, for $\Omega_m= 0.1$, $0.3$ and
1 (assume $h=0.7$). Examine the dependence on baryon density by
doubling it from the standard value; the wiggles you see getting
stronger are due to the baryon acoustic oscillation.
\end{enumerate}

\bibliographystyle{apj}
\bibliography{exex}


\documentclass{article}

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

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

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

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

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

\begin{document}

\title{Bicycle Model}
\author{\Large Josh Bennett, jjbennet@andrew.cmu.edu}
\maketitle

\section{Derivation}

\begin{figure}[H]
    \label{fig:bicycle_model}
    \centering
        \includegraphics[width=0.95\textwidth]{bicycle_model_diagram.png}
    \caption{Bicycle model state variable diagram.}
\end{figure}

Some preliminary relationships:

State variables:

$$ z = \left \lbrack \begin{array}{c}  x \\ y \\ \psi \\ \delta_f \\ v_f \end{array} \right \rbrack $$

We will use $v_f$ as the state variable for velocity to avoid discontinuities.

$$ v_r = v_f \cos {( \delta_f) } $$
$$ \dot{\psi} = v_f \sin {( \delta_f) } $$

We will assume a front wheel drive vehicle with wheel torque $\tau$ and wheel radius $r$, generating a force of $\frac{\tau} r$ as an input. Assuming a mass $m$ and an inertia $I$ for the vehicle defined as the inertia at the wheel base, not the center of mass, we can derive the following equation for the acceleration of the front wheel:

$$ a_f = \frac{\tau}{r} \left ( \frac {1} {m \cos {( \delta_f) }} + \frac {\left((l_r+l_f\right)\sin {( \delta_f) } )^2} {I} \right ) $$

We will also assume that the steering angle is controlled by some steering rate input $w$

$$ \left \lbrack \arraycolsep=1.4pt\def\arraystretch{1.5} \begin{array}{c}
    \dot{x} \\
    \dot{y} \\
    \dot{\psi} \\
    \dot{\delta_f} \\
    \dot{v_f}
\end{array} \right \rbrack  = \left \lbrack \arraycolsep=1.4pt\def\arraystretch{1.5} \begin{array}{c}
    v_f \cos {( \delta_f) } \cos{( \psi )} \\
    v_f \cos {( \delta_f) } \sin{( \psi )} \\
    \frac {v_f \sin {( \delta_f) }} {l_r + l_f} \\
    0 \\
    0
\end{array} \right \rbrack + \left \lbrack \arraycolsep=1.4pt\def\arraystretch{1.5} \begin{array}{c}
    0 \\
    0 \\
    0 \\
    w \\
    a_f
\end{array} \right \rbrack $$

The linearized dynamics for this system are defined as:

$$ \nabla f(X)  = \left \lbrack \arraycolsep=1.4pt\def\arraystretch{1.5} \begin{array}{ccccc}
    0 & 0 & - v_f \cos {( \delta_f) } \sin{( \psi )} & -v_f \sin {( \delta_f) } \cos{( \psi )} & \cos {( \delta_f) } \cos{( \psi )}  \\
    0 & 0 & v_f \cos {( \delta_f) } \cos{( \psi )} & -v_f \sin {( \delta_f) } \sin{( \psi )} & \cos {( \delta_f) } \sin{( \psi )} \\
    0 & 0 & 0 & \frac {v_f \cos {( \delta_f) }} {l_r + l_f} & \frac {\sin {( \delta_f) }} {l_r + l_f} \\
    0 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 \\
\end{array} \right \rbrack + \left \lbrack \arraycolsep=1.4pt\def\arraystretch{1.5} \begin{array}{c}
    0 \\
    0 \\
    0 \\
    w \\
    a_f
\end{array} \right \rbrack $$

Alternatively, we can clamp the vehicle velocity and steering angle with a sigmoid function:

The sigmoid is defined as

$$ \sigma(z) = \frac 1 {1+e^{-z}} $$

The derivative of the sigmoid is

$$ \frac d {dz} \sigma(z) = \sigma(z)(1 - \sigma(z))$$

We will use the following constraints to clamp velocity and steering angle:

$$ \delta_{fapplied} = 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right )  $$

$$ v_{fapplied} = 1.5v_{fmax}  \left ( \sigma(v_f) - \frac 1 3 \right )  $$

Notice that we have clamped the vehicles reverse velocity. This results in the following dynamics:

$$ \left \lbrack \arraycolsep=1.4pt\def\arraystretch{1.5} \begin{array}{c}
    \dot{x} \\
    \dot{y} \\
    \dot{\psi} \\
    \dot{\delta_f} \\
    \dot{v_f}
\end{array} \right \rbrack  = \left \lbrack \arraycolsep=1.4pt\def\arraystretch{1.5} \begin{array}{c}
    1.5v_{fmax}  \left ( \sigma(v_f) - \frac 1 3 \right ) \cos {\left ( 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right ) \right) } \cos{( \psi )} \\
    1.5v_{fmax}  \left ( \sigma(v_f) - \frac 1 3 \right ) \cos {( 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right ) ) } \sin{( \psi )} \\
    \frac { 1.5v_{fmax}  \left ( \sigma(v_f) - \frac 1 3 \right ) \sin {( 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right ) ) }} {l_r + l_f} \\
    0 \\
    0
\end{array} \right \rbrack + \left \lbrack \arraycolsep=1.4pt\def\arraystretch{1.5} \begin{array}{c}
    0 \\
    0 \\
    0 \\
    w \\
    a_f
\end{array} \right \rbrack $$

The linearized dynamics for this system are defined as:

$$ \nabla f_{02}(X) = - 1.5v_{fmax}  \left ( \sigma(v_f) - \frac 1 3 \right ) \cos {\left ( 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right ) \right) } \sin{( \psi )} $$
$$ \nabla f_{03}(X) = - 1.5v_{fmax}  \left ( \sigma(v_f) - \frac 1 3 \right ) 2\delta_{fmax} \sigma(\delta_f) (1 - \sigma(\delta_f) ) \sin {\left ( 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right ) \right) } \cos{( \psi )} $$
$$ \nabla f_{04}(X) = 1.5v_{fmax}  \sigma(v_f) ( 1 - \sigma(v_f) ) \cos {\left ( 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right ) \right) } \cos{( \psi )} $$

$$ \nabla f_{12}(X) = 1.5v_{fmax}  \left ( \sigma(v_f) - \frac 1 3 \right ) \cos {\left ( 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right ) \right) } \cos{( \psi )} $$
$$ \nabla f_{13}(X) = - 1.5v_{fmax}  \left ( \sigma(v_f) - \frac 1 3 \right ) 2\delta_{fmax} \sigma(\delta_f) (1 - \sigma(\delta_f) ) \sin {\left ( 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right ) \right) } \sin{( \psi )} $$
$$ \nabla f_{14}(X) = 1.5v_{fmax}  \sigma(v_f) ( 1 - \sigma(v_f) ) \cos {\left ( 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right ) \right) } \sin{( \psi )} $$

$$ \nabla f_{23}(X) = \frac { 1.5v_{fmax}  \left ( \sigma(v_f) - \frac 1 3 \right ) 2\delta_{fmax} \sigma(\delta_f) (1 - \sigma(\delta_f) ) \cos {( 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right ) ) }} {l_r + l_f}  $$
$$ \nabla f_{24}(X) =  \frac { 1.5v_{fmax} \sigma(v_f) ( 1 - \sigma(v_f) ) \sin {( 2\delta_{fmax}  \left ( \sigma(\delta_f) - \frac 1 2 \right ) ) }} {l_r + l_f} $$

\end{document}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Written By Michael Brodskiy
% Class: Analytic Geometry & Calculus III (Math-292)
% Professor: V. Cherkassky
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[12pt]{article}
\usepackage{alphalph}
\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}
\usepackage{titling}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{amssymb}
\usepackage[super]{nth}
\usepackage{everysel}
\usepackage{ragged2e}
\usepackage{geometry}
\usepackage{fancyhdr}
\geometry{top=1.0in,bottom=1.0in,left=1.0in,right=1.0in}
\newcommand{\subtitle}[1]{%
  \posttitle{%
    \par\end{center}
    \begin{center}\large#1\end{center}
    \vskip0.5em}%

}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=blue,
citecolor=blue,
}

\urlstyle{same}

\title{Lecture X Notes}
\date{\today}
\author{Michael Brodskiy\\ \small Professor: V. Cherkassky}

% Mathematical Operations:

% Sum: $$\sum_{n=a}^{b} f(x) $$
% Integral: $$\int_{lower}^{upper} f(x) dx$$
% Limit: $$\lim_{x\to\infty} f(x)$$

\begin{document}

\maketitle

\section{Limits of Multivariable Functions $-$ 14.2}

Just like in Calculus I, there are three conditions for a function to be continuous:

\begin{enumerate}

  \item $f(a)$ exists

  \item $\lim_{x\to a} f(x) = f(a)$

  \item $\lim_{x\to a^-} f(x) =\lim_{x\to a^+} f(x)$

\end{enumerate}

In three dimensions, the same rules apply, in addition to a new one:

$$\lim_{(x,y)\to(a,b)}f(x,y)=L$$ if, for every number $\epsilon > 0$ there is a corresponding number $\partial > 0$ such that,\\ if $(x,y)\in D$ and $0 < \sqrt{(x-a)^2+(y-b)^2} < \partial$ then $|f(x,y) - L| < \epsilon$

\section{Partial Derivatives $-$ 14.3}

For the function, $z=f(x,y)$, the partial derivatives may be expressed through the use of the limit definition of a derivative, where:

$$f_x(x,y)=\lim_{\Delta x\to0} \frac{f(x+\Delta x,y)-f(x,y)}{\Delta x}$$
$$f_y(x,y)=\lim_{\Delta y\to0} \frac{f(x,y + \Delta y)-f(x,y)}{\Delta y}$$

Some common notations are:

$$f_x(x,y)=f_x=\frac{\partial f}{\partial x}=\frac{\partial}{\partial x}f(x,y)=\frac{\partial z}{\partial x} = f_1=D_1f=D_xf$$
$$f_y(x,y)=f_y=\frac{\partial f}{\partial y}=\frac{\partial}{\partial y}f(x,y)=\frac{\partial z}{\partial y} = f_2=D_2f=D_yf$$

\subsection{Finding the Partial Derivative}

To find the partial derivatives of the function $f(x,y)$, one would hold $y$ constant, while differentiating with respect to $x$ to find $\frac{\partial f}{\partial x}$, and hold $x$ constant, while differentiating with respect to $y$ to find $\frac{\partial f}{\partial y}$

\end{document}