\documentclass[12pt]{article}

\usepackage{natbib,amsfonts,graphics,amsmath}
\usepackage{graphicx}

\include{newcommands}

\begin{document}

\title{Derivation of the nondimensional lee wave equations and perturbation expansions}

\author{Oliver Fringer and Eric Mayer}

\maketitle

\section{Dimensional analysis}

The form drag $F$ (per unit width) due to a hill of height $h_0$ in an infinitely
deep fluid is characterized by the dimensional quantities
$U$, $k$, $N$, and $h_0$.  Choosing $U$ and $N$ to nondimensionalize $k$ and $h_0$, the governing
nondimensional parameters are $J = N h_0/U$ and $\epsilon = k U/N$.  Since the units of the form drag
are length$^3$~time$^{-2}$, then a scale for $F$ in terms of $U$ and $N$ is $\rho_0 U^3 N^{-1}$. Therefore,
the form drag must satisfy
\[
\frac{F}{\rho_0 U^3 N^{-1}} = f(J, \epsilon)\,.
\]

\section{Nondimensional equations} \label{eq:equations}

Let $\ub_{\mbox{total}} = U {\bf e}_x + \ub$, $\rho_{\mbox{total}} = \rhobar(z) + \rho$, and
$p_{\mbox{total}} = \rho_0 \overline{p}(z) + \rho_0 p$ (the total notation is
to avoid carrying around the prime, but in a paper you should carry around the prime).
The steady momentum and density transport equations are given by
\begin{eqnarray}
U \D{u}{x} + \ub\cdot\nabla u &=& -\D{p}{x}\,,\\
U \D{w}{x} + \ub\cdot\nabla w &=& -\D{p}{z} - \frac{\rho}{\rho_0} g\,,\\
U \D{\rho}{x} + \ub\cdot\nabla\rho &=& \frac{\rho_0 N^2}{g} w\,,
\end{eqnarray}
where $N^2 = -g/\rho_0 \partial\rhobar/\partial z$, subject to continuity $\nabla\cdot\ub=0$ and
the kinematic bottom boundary condition
\[
U\D{h}{x} + u \D{h}{x} = w\,.
\]
Nondimensionalize with
\begin{eqnarray*}
u &=& u_0 u^*\,,\\
w &=& w_0 w^*\,,\\
\rho &=& R \rho^*\,,\\
p &=& P p^*\,,\\
x &=& k^{-1} x^*\,,\\
z &=& \delta z^*\,.
\end{eqnarray*}
Nondimensionalizing the kinematic bottom boundary condition gives
(after ignoring the $*$)
\[
k U h_0 \D{h}{x} + k u_0 h_0 \D{h}{x} = w_0 w\,.
\]
If we require a balance between the linear terms, this implies $w_0 = k h_0 U$, so that
\[
\D{h}{x} + F \D{h}{x} = w\,,
\]
where $F = u_0/U$ is a Froude number. Now, the vertical scale of the flow as given by $\delta$ is not the
same as the hill height $h_0$, since $\delta$ must be finite as $h_0\to 0$ (the linear limit). The
vertical scale is thus dictated by continuity, which requires
\[
k u_0 \D{u}{x} + \frac{w_0}{\delta} \D{w}{z} = 0\,,
\]
or, since this implies $k u_0 = w_0/\delta$, then we must have $\delta = w_0/(k u_0) = k h_0 U/(k u_0) = F^{-1} h_0$.
Nondimensionalizing the $u$-momentum equation,
\begin{eqnarray}
k u_0 U \D{u}{x} + k u_0^2\ub\cdot\nabla u  &=& -k P \D{p}{x}\,.
\end{eqnarray}
Since we require a leading-order balance between the pressure gradient and the linear momentum advection term,
we must have $P = u_0 U$, which gives
\begin{eqnarray}
\D{u}{x} + F \ub\cdot\nabla u &=& -\D{p}{x}\,.
\end{eqnarray}
The nondimensional density transport equation is given by
\[
k U R \D{\rho}{x} + k u_0 R \ub\cdot\nabla\rho = \frac{k \rho_0 h_0 N^2 U}{g} w\,.
\]
If we require a balance between the linear advection terms, then the scale for the density
perturbation is
\[
R = \frac{\rho_0 N^2 h_0}{g}\,,
\]
so that the nondimensional density equation is
\[
\D{\rho}{x} + F \ub\cdot\nabla\rho = w\,.
\]
Nondimensionalizing the vertical momentum equation, we have
\[
k^2 h_0 U^2 \D{w}{x} + k^2 h_0 u_0^2\ub\cdot\nabla w = -\frac{P}{\delta}\D{p}{z} - \frac{g R}{\rho_0} \rho\,.
\]
If we require a vertical hydrostatic balance to leading order, then we must have
\[
\frac{P}{\delta} = \frac{g R}{\rho_0}
  = N^2 h_0\,,
\]
and
\[
P = \delta N^2h_0
= \frac{N^2h_0^2}{F}
= \frac{N^2h_0^2U}{u_0}.
\]
%\[
%P = \frac{g R \delta}{\rho_0}
%  = \frac{g}{\rho_0} \frac{\rho_0 N^2 h_0}{g} \frac{h_0}{F}
%  = \frac{g}{\rho_0} \frac{\rho_0 N^2 h_0}{g} \frac{U}{N}
%  = U N h_0\,.
%\]
which gives
\[
\epsilon^2 \left(\D{w}{x} + F\ub\cdot\nabla w\right) = -\D{p}{z} - \rho\,,
\]
where
\[
\epsilon = \frac{k U}{N}
\]
is the nonhydrostatic parameter. Now, returning to the pressure, since from the vertical momentum equation we
require $P = N^2h_0^2U u_0^{-1}$ and from the horizontal momentum equation we require $P = u_0 U$, then equating the
two implies that $u_0 = N h_0$ and the Froude number is given by
\[
F = \frac{u_0}{U} = \frac{N h_0}{U} = J\,,
\]
where
\[
J = \frac{N h_0}{U}\,.
\]
Therefore, in terms of $J$, the governing nondimensional equations are given by
\begin{eqnarray*}
\D{u}{x} + J\ub\cdot\nabla u &=& -\D{p}{x}\,,\\
\epsilon^2 \left(\D{w}{x} + J\ub\cdot\nabla w\right) &=& -\D{p}{z} - \rho\,,\\
\D{\rho}{x} + J \ub\cdot\nabla\rho &=& w\,,
\end{eqnarray*}
subject to $\nabla\cdot\ub=0$ and the kinematic bottom boundary condition
\[
\left(1 + J \right)\D{h}{x} = w\,.
\]
These nondimensional equations are consistent with the original nondimensionalization which implied
that the problem is uniquely characterized by $\epsilon$ and $J$.
The relevant scales (nondimensionalized by $N$ and $U$) are given by
\begin{eqnarray*}
\frac{u_0}{U} &=& J\,,\\
\frac{w_0}{U} &=& \epsilon J\,,\\
\frac{gR}{\rho_0 U N} &=& J\,,\\
\frac{P}{U^2} &=& J\,,\\
\frac{\delta N}{U} &=& 1\,.
\end{eqnarray*}

Contrary to what is stated in the literature, we can show that it is
in fact appropriate to refer to $J$ as an internal Froude number. If we define
$Fr_\delta = u_0/\sqrt{g' \delta}$, where $g'\delta =g (R/\rho_0) \delta = J U^2$, this gives
$Fr_{\delta} = J^{1/2}$. Therefore, $J^{1/2}$ can be thought of as
the ratio of the inertial to gravitational forces arising from the perturbed
flow above the hill. Although we would expect a larger $N$ to block the flow and
reduce the magnitude of the perturbation above the hill, the scaling shows that
$u_0 = J U$, implying that the perturbation velocity above the sill increases in step with
increasing $J$. However, the gravitational force resulting from the perturbation is
given by $\sqrt{g'\delta} = J^{1/2} U$, which grows more slowly than $u_0$ with
increasing $J$.

This identification of J as the internal froude number squared appears to have gone without notice in the 65 years of studying Long's model. However, an inquiry into the upper limit of this relationship recently emerged from consideration of blocked flow past a half cylinder (Winters and Armi, 2012). In the blocked regime, that is, for flow in which $J>1$, the lowest fluid elements upstream of the obstacle lack sufficient kinetic energy to overtop the obstacle, and thus form a pool of stagnant fluid at the obstacle's base. As a result, the obstacle takes on the apparent height to the unblocked flow of U/N, that is, exactly the height of the flow's kinetic hill-climbing capacity, giving $J_{unblocked}=1$. In this case, Winter's and Armi show that the internal froude number above the hill is exactly 1, and in analogy to hydraulic control of an unstratified river, the flow directly above the crest exhibits a transition from a supercritical upstream jet to subcritical (and unsteady) downstream lee wave. In other words, the relation between J and $Fr_{\delta}$ holds only up to J=$Fr_{\delta}^2$=1. Above this limit, $Fr_{\delta}^2$=1, and J informs the depth of the stagnant layer as well as the thickness and speed of the accelerated jet resulting from hydraulic control (Winters and Armi, 2012).

Winters an Armi's analysis highlights an essential difference between this problem and the single layer channel flow from which our standard understanding of the Froude number derives: here the ``depth'' of the fluid as it travels over subcritical bathymetry is oblivious to both the ocean's depth and the bathymetry's height, and is instead entirely specified according to the impinging flow's properties, namely U and N.

That J as a Froude number only holds up until the critical limit $J=1$ has prevented its general interpretation as a Froude number. Nonetheless, in the subcritical regime of interest here, $J^{1/2}=(Nh_0/U)^{1/2}=u_0/\sqrt{g'\delta}$ carries the true meaning of a Froude number, relating the speed with which the competing processes of advective non-linearities and gravity waves respond to the introduction of bathymetry into the flow. When J is small, waves accommodate the disturbance adiabatically, and carry it away from the site of generation, just as in an unstratified river flowing over a sub-critical sill. Likewise, when J is large, non-linear advective processes respond faster than gravity, often resulting in a local energy sink, in analogy to a hydraulic jump downstream of supercritical river flow.

(In the 2-D case, blocking is an adiabatic advective process while span wise vorticity generation and downslope winds are diabatic. In the 3-D case, horizontal splitting is an adiabatic advective response while vertical vorticity generation represents a nearly adiabatic advective non-linearity with the unique capacity to carry energy away from the site of generation.)

That the outer and inner variable representations of J should present velocity and gravity inversely highlights a unique element of this problem's physics. In the limit of subcritical bathymetry, for which the bottom boundary condition becomes linear,  there is no vertical scale imposed upon the potential energy of the flow from any boundary condition. Rather, the vertical scale of the wave must come from properties of the fluid itself, hence $\delta = U/N$.

%Understanding the kinetic energy in the wave is more nuanced. Beginning with the denominators in the relation $J^{1/2}=(Nh_0/U)^{1/2}=u_0/\sqrt{g'\delta}$, and multiplying $J=Nh_0/U$ by $U/U$ for dimensional consistency, we have $\sqrt{g'\delta}= U$, this expresses that the gravity wave response exists as a direct consequence of the background velocity. Indeed, in the frame of reference moving with the water, U is the magnitude of the group velocity of this wave (as both borne out in the math and evidenced by observation of the steady state hydrostatic wave standing motionless above a hill). Similarly, considering the numerators: $(Nh_0U)^{1/2}=u_0$, we see that perturbation velocity above the hill is a direct consequence of buoyancy's attempt to restore an element to its equilibrium position, where the maximum possible displacement is the height of the hill.

There are still two other candidates for the title Froude number of this flow. One of these we have termed $\epsilon$. It is perhaps closer to Froude's original use of the number in the study of a ship's hull length relative to the surface gravity wavelength. For our flow, as we will see below, it represents the partition of wave response between a propagating and an evanescent regime. It is a ratio of excitation rate to wave response rate. If the flow excited perturbations from stability faster than buoyancy can respond, the wave cannot propagate. It is like punching a speedbag faster than the bag can bounce back.

The other arises when one considers the reality of finite depth. In this case, the number $Fr=U/ND$ arises as a measure of the flow speed to the first mode internal gravity wave speed. Baines reserved the term Fr for this number.

Finally, we would be remiss in omitting an alternative interpretation of J that relates to its description of flow around the critical limit. NF2010 show that by making the hydrostatic approximation, J is equivalent to the steepness parameter from the internal tide problem, that is, it is a ratio of the slope of topography to the slope of the wave group velocity.

\subsection{Rotation and viscosity}
Including rotation and viscosity to the nondimensional equations requires only slight modification. Because rotational effects necessarily involve a span wise direction, we must now include an equation for the span wise momentum. Assume there is no background span wise velocity, redefine $\ub = u\hat{x} + v\hat{y} + w\hat{z}$ as the perturbation velocity vector, and the steady transport equations for momentum and density become
\begin{eqnarray*}
U \D{u}{x} + \ub\cdot\nabla u &=& -\D{p}{x} + fv + \nu \nabla^2 u\,,\\
U \D{v}{x} + \ub\cdot\nabla v &=& -\D{p}{y} - fu + \nu \nabla^2 v\,,\\
U \D{w}{x} + \ub\cdot\nabla w &=& -\D{p}{z} - \frac{\rho}{\rho_0} g + \nu \nabla^2 w\,,\\
U \D{\rho}{x} + \ub\cdot\nabla\rho &=& \frac{\rho_0 N^2}{g} w + \kappa \nabla^2 \rho\,,
\end{eqnarray*}
Nondimensionalizing as above, with the addition of $v = u_0v*$, the $u$-momentum equation becomes (after ignoring the *)
\begin{eqnarray*}
k u_0 U \D{u}{x} + k u_0^2\ub\cdot\nabla u  &=& -k P \D{p}{x} + fu_0v + \nu k^2 u_0 \nabla^2 u \,.
\end{eqnarray*}
Again, requiring a first order balance between linear advection and pressure gives
\begin{eqnarray*}
\D{u}{x} + J\ub\cdot\nabla u  &=& \D{p}{x} +Ro^{-1} \ v + Re^{-1}\nabla^2 u \,,
\end{eqnarray*}
where $Ro =  \frac{Uk}{f}$ and $Re = \frac{U}{\nu k}$.
Nondimensionalizing the $v$-momentum equations, we have
\begin{eqnarray*}
k u_0 U  \D{v}{x} +k u_0^2 \ub\cdot\nabla v &=& -k P\D{p}{y} - fu_0fu + \nu k^2 u_0 \nabla^2 v\,.
\end{eqnarray*}
Upon again requiring a balance of linear advection and pressure, this becomes
\begin{eqnarray*}
	\D{v}{x} + J\ub\cdot\nabla v  &=& \D{p}{y} - Ro^{-1} \ u + Re^{-1}\nabla^2 v \,.
\end{eqnarray*}
Nondimensionalizing the $w$-momentum equations with the scaling $w_0 = Uk h_0$ that we gleaned from the bottom boundary condition gives
\[
k^2 h_0 U^2 \D{w}{x} + k^2 h_0 u_0^2\ub\cdot\nabla w = -\frac{P}{\delta}\D{p}{z} - \frac{g R}{\rho_0} \rho + \frac{\nu U k h_0 }{\delta^2}\nabla^2 w\,.
\]
Requiring hydrostatic balance, as before, we have
\[
\epsilon^2 \left(\D{w}{x} + F\ub\cdot\nabla w\right) = -\D{p}{z} - \rho + \frac{\nu U k h_0 }{\delta^2 h_0 N^2}\nabla^2 w\,.
\]
And recalling $\delta = U/N$, this simplifies to
\[
\epsilon^2 \left(\D{w}{x} + F\ub\cdot\nabla w\right) = -\D{p}{z} - \rho + Re^{-1}\nabla^2 w\,.
\]
Lastly, the nondimensional density transport equation is
\[
k U R \D{\rho}{x} + k u_0 R \ub\cdot\nabla\rho = \frac{k \rho_0 h_0 N^2 U}{g} w + \kappa k^2 R \nabla^2 \rho\,.
\]
Requiring a balance between the linear advection terms, as before, results in
\[
\epsilon^2 \left(\D{w}{x} + F\ub\cdot\nabla w\right) = -\D{p}{z} - \rho + \frac{Pr}{Re}\nabla^2 \rho\,,
\]
where $Pr=\nu/\kappa$ is the Prandtl number.
\section{Linear, nonhydrostatic equations}
The governing equations in the linear limit $J\to 0$ are given by
\begin{eqnarray*}
\D{u}{x} &=& -\D{p}{x}\,,\\
\epsilon^2 \D{w}{x} &=& -\D{p}{z} - \rho\,,\\
\D{\rho}{x} &=& w\,.
\end{eqnarray*}
The governing equation for $w$ is then given by
\[
\ND{w}{z}{2} + \epsilon^2 \ND{w}{x}{2} + w = 0\,.
\]
Assume a sinusoidal topography such that $h(x) = \sin(x)$.

\subsection{Propagating solution}

When $\epsilon<1$, the hydrostatic solution is of the form
$w(x,z) = \cos(x + m z)$, which implies $m = (1-\epsilon^2)^{1/2}$.  Substitution into
the governing linear equations gives
\begin{eqnarray*}
u(x,z) &=& -m \cos(x + m z)\,,\\
w(x,z) &=& \cos(x + m z)\,,\\
\rho(x,z) &=& \sin(x + m z)\,,\\
p(x,z) &=& m \cos(x + m z)\,.
\end{eqnarray*}
The dimensional form drag (per unit width) over one wavelength is given by (here, $*$ implies dimensional
quantities)
\[
F^* = \int_{0}^{2\pi/k^*} p^*(x^*,z^*=0)\D{h^*}{x^*}\, dx^*\,.
\]
Nondimensionalizing gives
\[
\frac{F^*}{\rho_0 U^3 N^{-1}} = J^2 \int_{0}^{2\pi} p(x,z=0)\D{h}{x}\, dx\,.
\]
Substitution of $p$ and $h$ then gives
\[
\frac{F^*}{\rho_0 U^3 N^{-1}} = \pi J^2\left(1 - \epsilon^2\right)^{1/2}\,.
\]

\subsection{Evanescent solution}

When $\epsilon>1$, the nonhydrostatic solution is of the form
$w(x,z) = \cos(x)\exp(-m z)$, which implies $m = (\epsilon^2-1)^{1/2}$.  Substitution into
the governing linear equations gives
\begin{eqnarray*}
u(x,z) &=& m \sin(x) \exp(-m z)\,,\\
w(x,z) &=& \cos(x) \exp(-m z)\,,\\
\rho(x,z) &=& \sin(x) \exp(-m z)\,,\\
p(x,z) &=& -m \sin(x) \exp(-m z)\,.
\end{eqnarray*}
Since $p$ and $w$ are $\pi/2$ out of phase, the form drag is identically zero.

\subsection{Long's Model}

Long 1953 recast the equations in terms of $\delta$ where $\delta(x,z) = z(x)-z_0$ is the displacement of the streamline found at $(x,z)$ from its upstream height $z_0$. Note that by definition, $\delta$ is a transcendental equation in $z$. In taking the linear limit, we essentially say that this difference is everywhere very small with respect to the length scale of the restoring force.

Long's Model (Long 1953)
\[
\nabla^2\delta + \frac{N^2}{U^2}\delta = 0.
\]
Upon taking the hydrostatic approximation, this simplifies further to
\[
\partial_z^2\delta +  \frac{N^2}{U^2}\delta = 0,
\]
where the subscript z represents differentiation with respect to z.
Assuming sinusoidal topography of the form $h(x) = h_0 cos(kx)$, the kinematic boundary condition now reads
\[
\delta(x,h(x)) = h(x) = h_0 cos(kx).
\]

Long's model is a linear helmholz equation with

\subsection{Perturbation expansion}

We are now in a position to consider a perturbation solution to Long's equation, as in Smith 1977. We can postulate a perturbation expansion of $\delta$ in powers of J as
\[
\delta(x,z) = \delta_0+ J\delta _1 +  J^2 \delta_2+ O(J^3).
\]
And we can write the bottom boundary condition as a Taylor expansion around $x=0$ (employing the scaling $h(x)\propto h_0$ and $\partial_z \propto N/U$)
\[
\delta(x,h(x)) = \delta(x,0) + h \partial_z \delta |_0 +  h^2 \partial_z^2 \delta |_0 + O(J^3) = h(x).
\]
The 0th order solution comes rapidly upon plugging the perturbation expansion into the boundary condition
\begin{eqnarray*}
	\delta &=& \delta_0 + O(J) \\
	\delta(x,0) + O(J) &=& h(x)\\
	\implies \delta_0|_0 &=& h_0cos(kx)
\end{eqnarray*}
And, unsurprisingly, upon appeal to Long's Model, the 0th order propagating solution for $\delta$ emerges as
\[
\delta = h_0cos(kx+lz)  + O(J),
\]
Where
\[
l =(\frac{N^2}{U^2}-k^2)^{1/2} = \frac{N}{U}(1-\epsilon^2)^{1/2}
\]
for the nonhydrostatic propagating solution, and simply
\[l=\frac{N}{U} \]
in the hydrostatic approximation.

If $\epsilon>1$, the solution is instead evanescent, giving
\[
\delta = h_0cos(kx)exp(-lz)  + O(J).
\]
For the sake of brevity, I will omit the higher order evanescent solutions in what follows.

By similar steps, Smith arrived at the 1st order solution
\begin{eqnarray*}
	\delta &=& \delta_0 + J\delta_1 + O(J^2) \\
	\delta(x,0) + h \partial_z \delta |_0 +  O(J^2) &=& h(x)\\
	\delta_0|_0 + J\delta_1|_0+  h \partial_z \delta_0 |_0  +O(J^2)&=& h(x)\\
	and \   \delta_0|_0 &=& h(x) \\
	\implies h \partial_z \delta_0 |_0 &=& -J\delta_1|_0\\
	h_0 cos(kx) \partial_z(h_(cos(kx+lz))|_0&=& -J\delta_1|_0\\
	 -J h_0 cos(kx)sin(kx) &=& -J\delta_1|_0\\
	  -J h_0 \frac{1}{2}sin(2kx) &=& -J\delta_1|_0\\
	\implies \delta_1|_0 &=& \frac{h_0}{2}sin(2kx)
\end{eqnarray*}
And, on appeal to Long's Model, we have
\[
\delta(x,z) = h_0cos(kx+lz) + \frac{J h_0}{2}sin(2kx+lz) + O(J^2)
\]
With a little more paper and time, it can be shown by identical steps that the 2nd order solution is
\[
\delta(x,z) = h_0cos(kx+lz) + \frac{J h_0}{2}sin(2kx+lz) + \frac{J ^2h_0}{2}cos(kx+lz) + O(J^3)
\]
So far, all of these solutions are evaluated at the displaced streamline height $z$, rather than the undisturbed height of the streamline far upstream, $z_0$. The two are related via
\[
\delta(x,z) = \delta(x,z_0+\eta(x,z_0)) = \eta(x,z_0)
\]
We can now use $\eta(x,z_0)$ to write $\delta(x,z)$ as a Taylor expansion around $z_0$, and after some effort, arrive at the 2nd order solution for $\eta(x,z_0)$:
\begin{eqnarray*}
\eta(x,z_0) &=& h_0cos(kx+lz_0)\\
 &+&\frac{1}{2}Jh_0(sin(2kx+lz_0)_ - sin(2kx + 2lz_0))\\
 &+&\frac{1}{2}J^2h_0[cos(kx+lz_0)+cos(kx+lz_0)cos(2kx+lz_0)\\
 &-&sin(kx+lz_0)sin(2kx+lz_0)+sin(kx+lz_0)sin(2kx+2lz_0)\\
 &-&3cos^3(kx+lz_0)]\\
 &+& O(J^3h_0)
\end{eqnarray*}
Note that this is an extension of Smith 1977, in which the solution is given only to $O(Jh_0)$.

Plots of these solutions for J=0.3 are given below, as well as those of the velocity fields $u$ and $w$ that these displacements entail. Note the steepening of the streamlines increases with the order of the solution.

\begin{figure}
	\centering
	\includegraphics[width=1\textwidth]{delta_solutions.eps}
	\caption{0th, 1st, and 2nd order solutions for $\delta(x,z)$ with $J=0.3$.}
\end{figure}

\begin{figure}
	\centering
	\includegraphics[width=1\textwidth]{eta_solutions.eps}
	\caption{0th, 1st, and 2nd order solutions for $\eta(x,z_0)$ with $J=0.3$.}
\end{figure}

\begin{figure}
	\centering
	\includegraphics[width=1\textwidth]{u_solutions.eps}
	\caption{0th, 1st, and 2nd order solutions for $u(x,z_0)$ with $J=0.3$.}
\end{figure}

\begin{figure}
	\centering
	\includegraphics[width=1\textwidth]{w_solutions.eps}
	\caption{0th, 1st, and 2nd order solutions for $w(x,z_0)$ with $J=0.3$.}
\end{figure}

\begin{figure}
	\centering
	\includegraphics[width=1\textwidth]{vel_via_diff.eps}
	\caption{2nd order solutions for velocity calculated by numerical differentiation of $\eta_2$.}
\end{figure}

\subsection{Instability}

These if taken to large enough order, these perturbation expansions are asymptotically exact so long as $J<1$. However, before $J$ gets to unity, these solutions suggest that two forms of instability will arise, invalidating the underlying hypothesis of Long's model.

Firstly, as $J$ increases, the streamlines steepen, and at some value of $J<1$, become locally vertical. Vertical streamlines imply wave breaking (Long 1953, Miles 1969) which results in heavy water pooling in valleys and reduced wave amplitude (Kimura and Manins 1980). The condition of vertical streamlines can be expressed mathematically as $\partial_z \delta = 1$.

Below, I include a plot of the maximum value of $\partial_z \delta$ as a function of J for each order solution. As Smith reported in 1977, the 1st order accurate solution for $\delta$ predicts that wave breaking will commence at $J=0.75$. With our next order solution, this threshold drops to $J=0.65$. Of course, neither solutions are suitable for analysis of such nonlinear flow; in order to limit the error in a $J=0.65$ solution to less than $5\%$, we would need a 6th order accurate expansion ($0.65^7 = 0.049$).

A second measure of instability derives from consideration of turbulent energetics, and is quantified by the  a condition on $Ri = N^2/(\partial_z u)^2$, where $Ri$ is the Richardson number and is a ratio of the  contributions of buoyancy flux and shear production  to the turbulent kinetic energy equation. If $Ri>1/4$, buoyancy will not allow the energy cascade to perpetuate, and the flow stabilizes. However, if $Ri<1/4$, vertical shear wins and the flow collapses into turbulence (Miles 1961, Baines 1995).

Note that from our scaling above, we have $u_0 = JU$, $\partial_z = N/U$, and together $(\partial_z u)^2 \propto N^2J^2$ and $Ri \propto J^{-2}$. Thus we expect the flow to go unstable at least by $J=2$. To get at this more quantitatively, however, consider the vertical gradient of our perturbation solutions for $u$, plotted as a function of J below. I find (numerically), that in the $O(J^6)$ solution (recall, it is a square of the gradient of $u$, which we have solved to $O(J^2)$), Ri falls below 1/4 for $J>0.69$. Furthermore, because of the higher order of this solution, the error in this estimate is much more acceptable than for the vertical streamlines ($0.69^7=0.0745$).

\begin{figure}
	\centering
	\includegraphics[width=1\textwidth]{max_slopes.eps}
	\caption{Maximum slope in $\delta$ as a function of J.}
\end{figure}

\begin{figure}
	\centering
	\includegraphics[width=1\textwidth]{max_shearsq.eps}
	\caption{Maximum slope in $(\partial_z u)^2$ as a function of J.}
\end{figure}

\subsection{Momentum and Energy fluxes}
The generation of a lee wave represents a transfer of momentum and energy from the mean flow into the perturbation flow. This transfer initiates at the bottom boundary, where it is felt as a form drag. The fluxes then radiate upwards with the wave, to infinity as far as this problem is concerned.

The horizontal force of the topography on the mean flow from the pressure gradient at the surface is
\[
F_D =  \int \D{P}{x} h(x) dx = -\int P(x) \D{h}{x} dx.
\]
Using the work energy theorem, the energy expended in flowing over the topography is then
\[
E_D = -\int u(x)P(x) \D{h}{x} dx.
\]
Away from the hill, the wave momentum flux is
\[
F_w(x,z_0) = -\rho u(z,x_0)w(x,z_0),
\]
and the wave energy flux is
\[
E_w(x,z_0) = P(x,z_0)w(x,z_0).
\]
For our inviscid and irrotational problem, there is no energy lost or converted to inertial oscillations while fluxing through the domain, and $E_D = E_w$.

To evaluate these fluxes, it will be helpful to have a clear relation between the pressure field and $\eta(x,z_0)$.

\subsection{Fourier synthesis}

\begin{figure}
	\centering
	\includegraphics[width=1\textwidth]{witch_bathymetry.eps}
	\caption{Recreating the Witch of Agnesi using Fourier synthesis.}
\end{figure}

\begin{figure}
	\centering
	\includegraphics[width=1\textwidth]{witch_eta.eps}
	\caption{Streamlines above a Witch of Agnesi found via Fourier synthesis.}
\end{figure}

\end{document}

w = cos(x)exp(-m z)
wx = -sin(x)exp(-m z)
ux = -wz = m cos(x) exp(-m z)
u = m sin(x) exp(-m z)

rhox = w = cos(x)exp(-m z)
rho = sin(x)exp(-m z)

e2 wx = -pz - rho
pz = -e2 wx - rho = e2 sin(x) exp(-m z) - sin(x) exp(-m z) = m^2 sin(x) exp(-m z)
p = (-1/m) m^2 sin(x) exp(-m z) = -m sin(x) exp(-m z)


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{listings}
\usepackage[dvipsnames]{xcolor}
\lstset{
    language=[LaTeX]Tex,
    showspaces=true,
    keywordstyle=[1]\color{Red},
    keywordstyle=[2]\color{Orange},
    keywordstyle=[3]\color{Sepia},
    keywordstyle=[4]\color{PineGreen},
    keywordstyle=[5]\color{Blue},
    keywords=[1]{P,JacobiP,cos,cos@,Cos},
    keywords=[2]{alpha,Alpha},
    keywords=[3]{beta,Beta},
    keywords=[4]{n},
    keywords=[5]{a,Theta,CapitalTheta},
    xleftmargin=.1\textwidth,
    xrightmargin=.1\textwidth
}

\begin{document}
\begin{center}
    \Large
    \LaTeX-Equation 2 CAS\\[12pt]
    \large Examples
\end{center}

\section{The Jacobi Polynomial}
Let us take a look to the Jacobi polynomial (\href{http://dlmf.nist.gov/18.3\#T1.t1.r2}{\textcolor{blue}{\underline{DLMF-Link}}}). We want to translate the general expression (section \ref{sec:generic}) to a CAS (section \ref{sec:cas}) representation. For instance we have the following term:
\begin{equation}\label{eq:jacP}
    P_n^{(\alpha, \beta)}(\cos(a \Theta))
\end{equation}

\subsection{Generic \LaTeX}\label{sec:generic}
\begin{lstlisting}[mathescape]
P_n^{(\alpha,\beta)}(\cos(a\Theta))
\end{lstlisting}

\subsection{Semantic \LaTeX}\label{sec:semantic}
\begin{lstlisting}[mathescape]
\JacobiP{\alpha}{\beta}{n}@{\cos@{a\Theta}}
\end{lstlisting}

\subsection{Computer Algebra Systems (CAS)}\label{sec:cas}
From now on, be aware of the spaces between the symbols. For instance, a space between $a$ and $\Theta$ is needed to show $a$ and $\Theta$ are different variables. Otherwise Maple (for example) would think $aTheta$ is one new variable.
\subsubsection{Maple}\label{subsec:maple}
\begin{lstlisting}[mathescape]
JacobiP(n,alpha,beta,cos(a Theta))
\end{lstlisting}

\subsubsection{Mathematica}\label{subsec:mathematica}
\begin{lstlisting}[mathescape]
JacobiP[n,\[Alpha],\[Beta],Cos[a \[CapitalTheta]]]
\end{lstlisting}
\end{document}


\section{Partial Dependence Plots}

\begin{frame}[c]
\Huge{\centerline{Partial Dependence Plots}}
\end{frame}
%----------------------------------------------------------------------------------------

\begin{frame}\frametitle{Review of Marginal Expectation}
	\begin{itemize}
		\item Recall that in a $P$-dimensional feature space, we can consider a single feature $X_j \in \mathcal{P}$ and its complement set $\mathcal{P}_{(-j)}$ (where $\{X_j\} \cup \mathcal{P}_{(-j)} = \mathcal{P}$).
		\item To describe the partial dependence $g(\mathbf{X})$ on $X_j$, we go through the following enumerated explanation:
		\begin{enumerate}
			\item Expected value is $\mathbb{E}[g\mathbf(X)] = \displaystyle\sum_{i = 0}^{N-1}g(x^{(i)})p(x^{(i)})$.
			\item  Let $g(\mathbf{X}) = g(X_j, X_{(-j)})$ and set $X_j = [x_{j}^{0}, \dots, x_{j}^{P-1}]^T)$.
			\item Then the marginal expectation over $X_{(-j)}$ is $\mathbb{E}_{X_{(-j)}}\left[g(X_j, X_{(-j)})\right] =  \displaystyle\sum_{i = 0}^{N-1} g(X_j, X_{(-j)}) p(x^{(i)})$.
			\item Given that  $\displaystyle\sum_{i = 0}^{N-1} p(x^{(i)}) = 1$, and equal probabilities, $p(x^{(i)}) = \frac{1}{N}$.
			\item Thus $\mathbb{E}_{X_{(-j)}}\left[g(X_j, X_{(-j)})\right] = \displaystyle\frac{1}{N}\sum_{i = 0}^{N-1}g(x_j, \mathbf{x}_{(-j)}^{(i)})$.
		\end{enumerate}
	\end{itemize}
\end{frame}

%----------------------------------------------------------------------------------------

\begin{frame}\frametitle{Partial Dependence Plots (Cont.)}
	\begin{itemize}
	\item The partial dependence of a given feature $X_j$ is the average of the response function $g$, where all the components of $X_j$ are set to $x_j$ $(X_j= [x_j^{(0)}, \dots, x_j^{(N-1)}]^T)$, and all other feature vectors of the complement set $\mathbf{x}_{(-j)}^{(i)}$ are left as the original dataset specified.
	\item Thus, the \textit{one-dimensional partial dependence} of a function $g$ on  $X_j$ is the marginal expectation:
			\begin{equation}\label{eq:pd1}
			\begin{aligned}
				\text{PD}(X_j, g) &= \mathbb{E}_{X_{(-j)}}\left[g(X_j, X_{(-j)})\right]\\
			&= \frac{1}{N}\sum_{i = 0}^{N-1}g(x_j, \mathbf{x}_{(-j)}^{(i)})
		\end{aligned}
		\end{equation}
	\end{itemize}
\end{frame}

%----------------------------------------------------------------------------------------

\begin{frame}\frametitle{Partial Dependence Plots (Cont.)}
	\begin{itemize}
		\item Partial dependence plots show the partial dependence as a function of \textit{specific values} of our feature subset.
		\item The plots show how machine-learned response functions change based on the values of an input feature of interest, while taking nonlinearity into consideration and averaging out the effects of all other input features.
		\item Partial dependence plots enable increased transparency in $g$ and enable the ability to validate and debug $g$ by comparing a feature's average predictions across its domain to known standards and reasonable expectations.
	\end{itemize}
\end{frame}

%----------------------------------------------------------------------------------------

\begin{frame}
\frametitle{Conceptual Example}
\begin{figure}
\includegraphics[scale=0.25]{images/pdp_image.png}
\caption{We want to predict whether someone will default on their monthly utility bill. The image shows one feature that we fixed ($Rent=2000$), keeping the rest unchanged, to see its impact on the dataset's average default rate.}
\end{figure}
\end{frame}


\documentclass[letterpaper]{article}

\usepackage{fullpage}
\usepackage{nopageno}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[utf8]{inputenc}
\allowdisplaybreaks

\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}

\begin{document}
\title{Notes}
\date{October 3, 2014}
\maketitle
if $\liminf x_n=L$ then there exists $\{x_{n_k}\}$ such that $\lim x_{n_k}=L$

$l=\liminf x_n=\lim(inf\{\underbrace{x_{n_1},x_{n_2},x_{n_3},\dots}_{c_n}\}$

why not just let $c_n$ be the subseuence? because $c_n$ may not be equal to any of the $x_k$ in the sequence

$c_n=\inf\{x_{n_1},x_{n_2},\dots\}$ give $\varepsilon=2^{-n}$ there exists $x_{n_k}\in\{x_{n_1},x_{n+1},x_{n+2},\dots\}$ such that $\left\lvert c_n-x_{n_k}\right\rvert<2^{-n}$ by def of infinum

we has a sequence $\{c_n\}$ given $\varepsilon>0$ there exists $N$ such that $\left\lvert c_n-L\right\rvert<\varepsilon$ if $n\ge N$. we approximate each $c_n$ by some $x_{n_k}$ from the oricinal sequence sutch that ....

\section*{convergence test for series}
first we talk about series with positive terms $\sum\limits_{k=1}^\infty{a_k}$, $s_n=\sum\limits_{k=1}^n{a_k}$. So if $s_n$ is bounded about then the series is convergent. and if not, it is divergent.

geometric series $\sum\limits_{n=0}^\infty{r^n}$ is convergent if $\left\lvert r\right\rvert<1$. $s_n=\sum\limits_{k=0}n{r^k}=1+r+r^2+\dots+r^n, rs_n=r+r^2+r^3+\dots, sn-rSn=1-r^{n+1}$

$s_n=\frac{1-r^{n+1}}{1-r}\to\frac{1}{1-r}$

\section*{comparison test}
if $\forall n, |a_n|\le b_n$
\begin{itemize}
\item
  if $\sum\limits_{n=1}^\infty{b_n}$ is convergent then $\sum\limits_{n=1}^\infty{a_n}$ is convergent,
  \item
  if $\sum\limits{a_n}$ is divergent, so is $\sum\limits{b_n}$.
\end{itemize}
\section*{3.2.b}
show that if $\left(|a_n|\right)_{n=1}^\infty$ is summable then so is $\left(a_n\right)_{n=1}^\infty$.
\begin{align*}
  \sum\limits_{k=n+1}^m{|a_k|}&<\varepsilon\text{ for all }N\le n\le m \text{ because is is summable}\\
  \left\lvert\sum\limits_{k=n+1}^m{a_k}\right\rvert&\le\sum\limits_{k=n+1}^m{|a_k|}<\varepsilon
\end{align*}
so then $\sum\limits{a_k}$ is also cauchy and summable

\section*{cauchy-schwartz inequality}
$\sum\limits_{k=1}^n{a_kb_k}\le \left(\sum\limits_{k=1}^n{a_k^2}\right)^{1/2}\left(\sum\limits_{k=1}^n{b_k^2}\right)^{1/2}$

\section*{3.2.f}

\section*{leibniz test for alternating series}
if $\{a_n\}$ is a monotone decreasing sequence of positive terms with the $\lim a_n=0$ then $\sum\limits_{n=1}^\infty{(-1)^na_n}$ is convergent

\section*{note!} a sequence my have the property $\lim |a_n-a_{n+!}|=0$ but not be cauchy
\section*{3.2.h}
Show that if $\sum\limits_{n=1}^\infty{a_n}$ and $\sum\limits_{n=1}^\infty{b_n}$ are series with $b_n\ge 0$ such that $\limsup\limits_{n\to\infty}<\infty$ and $\sum\limits_{n=1}^\infty{b_n}<\infty$, then the series $\sum\limits_{n=1}^\infty{a_n}$ converges.

\begin{align*}
  \left\lvert\left(\sup\limits_{k\ge n}\frac{|a_k|}{b_k}\right)-L\right\rvert<\varepsilon\\
  \left(\sup\limits_{k\ge n}\frac{|a_k|}{b_k}\right)<L+\varepsilon\\
  \frac{|a_k|}{b_k}<L\varepsilon\\
  |a_k|<(L+\varepsilon) b_k\\
\end{align*}
\section*{3.2.j}
$\liminf\frac{a_n+1}{a_n}\le\liminf{a_n^{\frac{1}{n}}}\le\limsup a_n^{\frac{1}{n}}\le \limsup\frac{a_n+1}{a_n}$.
\subsection*{step 1}
if $x\ge r$ for all $r>b$ then $x$ is a lower bound for the set $\{r\in \mathbb{R}:r>b\}$, $x\le\inf\{r\in\mathbb{R}:r>b\}=b$

we will show that if $\limsup \frac{a_n}{b_n}<r$ then $\limsup a_n^{\frac{1}{n}}\le r$ and then apply step one.

let $r>\limsup \frac{a_{n+1}}{a_n}$ then $\exists N$ such that $r>\frac{a_{n+!}}{a_n}\forall n\ge N$
\begin{align*}
  a_{N+1}<ra_N\\
  a_{N+2}<ra_{N+1}\le r^2a_{N}\\
  a_{N+K}<r^{k}a_N\\
  a_{N+k}^{\frac{1}{N+k}}<(r^ka_N)^{\frac{1}{N+k}}
\end{align*}
\section*{quiz from 10/1/2014}
$L_k\to L$ then $\{x_n\}$ such that $\forall k, \exists$ a subsequence of $\{x_n\}$ converging to $L_k$. prove that $\{x_n\}$ has a subsequence converging to $L$.

given $\varepsilon>0\exists N_0$ such that $\left\lvert L_k-L\right\rvert<\varepsilon$ if $k\ge N_0$

$\left\lvert x_{N_k}-L\right\rvert\le\left\lvert x_{N_k}-L_k\right\rvert+\left\lvert L_k-L\right\rvert<2\varepsilon$

\section*{example}
let $A,B\subseteq \mathbb{R}$, prove that $\sup A\le\inf B$, if $\forall a\in A, b\in B, a\leb$
\end{document}


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

\section*{9 October 2019}

Clarification from last lecture.
Dithering is caused by the fact that any single pixel in an X-ray CCD may be arbitrarily noisy, and if the telescope only looks at an astronomical object from a certain viewpoint without rotation a certain region of the object will always be imaged by the same pixel, therefore the errors between images will be correlated.
So, we move our telescope around in order to have a certain region of the astronomical object be imaged by several uncorrelated pixels.

Normal distribution: the pdf is
%
\begin{equation}
  \mathcal N (x; \mu, \sigma^2) = \frac{1}{\sqrt{2 \pi \sigma^2}} \exp(\frac{-(x-\mu)^2}{2\sigma^2} ) \,.
\end{equation}

Poisson distribution: the probability of getting \(m\) events if they happen independently at a rate \(\lambda\) is
%
\begin{equation}
\mathbb{P} (m ; \lambda) = \frac{e^{-\lambda} \lambda^m}{m!} \,,
\end{equation}
%
and it is easy to prove that for a Poisson distribution \(\mu = \sigma^2 = \lambda\).

If the rate is, say, a temporal rate like \([\alpha] = \SI{}{\hertz}\) then we substitute \(\lambda = \alpha t_{\text{obs}}\).

We discuss detectors: semiconductors, NP junctions.

We define the signal-to-noise ratio:

\begin{equation}
	\text{SNR} = \frac{S}{\sqrt{S + B}}
	= \frac{S_{\text{ph}} t A W_b}{\sqrt{\qty(S_{\text{ph}} + B_\text{sky})tAW_b + Dt + R^2_N } }\,,
\end{equation}
%
where $S= S_{\text{ph}} tAW_b$ is the (constant) signal photon count: \(t\) is the observation time, \(A\) is the telescope area, \(W_b\) is the bandwidth, and \(S_{\text{ph}}\) is the source photon intensity.

We must also account for the background $B$: it is caused by dark counts whose rate is \(D\), by background photons whose intensity is \(B_{\text{sky}}\), and by readout noise \(R_N^2\).

We can define the detection threshold\dots
This will be talked about next lecture.

\end{document}


% declare document class and geometry
\documentclass[12pt]{article} % use larger type; default would be 10pt
\usepackage[margin=1in]{geometry} % handle page geometry

% import packages and commands
\input{../header2.tex}

\title{Phys 220A -- Classical Mechanics -- HW03}
\author{UCLA, Fall 2014}
\date{\formatdate{23}{10}{2014}} % Activate to display a given date or no date (if empty),
         % otherwise the current date is printed

\begin{document}
\maketitle

\section*{Problem 1 (15 pts)}
\textit{
In this problem you will show that for small times in a one dimensional system the solution of the Euler-Lagrange equations minimizes the action. Consider an action of the form
\begin{eqn}
S[x] = \int_0^T \dif{t} \left( \frac{1}{2} m \dot{x}^2 - V(x) \right).
\end{eqn}
}

\begin{enumproblem}

% part A
\item \textit{
Show that for a variation $\delta x (0) = \delta x(T) = 0$ that the variation in the action is
\begin{eqn}
\Delta S = - \int_0^T \dif{t} \left( m \ddot{x} + \pd{V}{x} \right) \delta x + \bigO(\delta x^2).
\end{eqn}
}

% part B
\item \textit{
Show that for an $x(t)$ which satisfies the Euler-Lagrange equations the second variation has the form
\begin{eqn}
\delta S = \frac{1}{2} \int_0^T \dif{t} \left( m(\delta \dot{x})^2 - g(t) \delta x^2 \right) + \bigO(\delta x^3)
\end{eqn}
and show that
\begin{eqn}
g(t) = \eval[3]{ \pd[2]{V}{x} }_{x = x(t)}.
\end{eqn}
}

% part C
\item \textit{
Using the boundary condition $\delta x(0) = \delta x(T) = 0$ and estimating the value of $g(t)$ show that one can choose a time $T$ small enough that the order $\delta x^2$ term in the variation of $S$ is always positive.
}

\end{enumproblem}

\section*{Problem 2 (15 pts)}
\textbf{
Note: A variant of this problem appeared in the 2013 comprehensive exam.
}

\textit{
A mass $m_1$ is moving (without friction) on a desk in the presence of constant gravitational fields. It is attached by a massless rope through a hole in the desk to a second mass $m_2$, the first mass rotates on the desk (see figure 1).
}

\begin{enumproblem}

% part A
\item \textit{
Find the constraints and the Lagrangian for this system.
}

% part B
\item \textit{
Calculate the equations of motion.
}

% part C
\item \textit{
Find conserved quantities of the system to reduce the equations of motion to a single differential equation of first order.
}

% part D
\item \textit{
Find the initial conditions for which the mass $m_1$ moves on a circle, calculate the tension in the string for this solution.
}

\end{enumproblem}

\section*{Problem 3 (15 pts)}
\textit{
A mass $m_1$ is moving frictionless on a ramp with angle $\alpha$ with base accelerates with constant acceleration $x_0(t) = \frac{1}{2} a t^2$. (See Figure 2.)
}

\begin{enumproblem}

% part A
\item \textit{
Set up the constraints and the Lagrangian.
}

% part B
\item \textit{
Find generalized coordinates and solve the Euler Lagrangian equations
}

% part C
\item \textit{
What is the condition that the mass leaves the ramp?
}

\end{enumproblem}

\section*{Problem 4 (20 pts)}
\textit{
A particle of mass $m_1$ is constrained to move on a circle $x^2 + y^2 = r_1^2$, a second particle of mass $m_2$ is constrained to move on a second circle $(x - a)^2 + y^2 = r_2^2$. The two masses are connected by a (massless) spring with constant $k$ (i.e. there is a potential which takes the form $V = \frac{1}{2} k d^2$ where $d$ is the euclidean distance between the masses.
}

\begin{enumproblem}

% part A
\item \textit{
Identify the two generalized coordinates and express the Lagrangian in terms of these.
}

% part B
\item \textit{
Write down the equations of motion following from the Lagrangian
}

% part C
\item \textit{
For which value of $a$ is there an additional conserved quantity ?
}

% part D
\item \textit{
For the special case in (c) reduce the equation of motion to a first order equation.
}

\end{enumproblem}

\end{document}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                      %
% GLE - Graphics Layout Engine <http://www.gle-graphics.org/>          %
%                                                                      %
% Modified BSD License                                                 %
%                                                                      %
% Copyright (C) 2009 GLE.                                              %
%                                                                      %
% Redistribution and use in source and binary forms, with or without   %
% modification, are permitted provided that the following conditions   %
% are met:                                                             %
%                                                                      %
%    1. Redistributions of source code must retain the above copyright %
% notice, this list of conditions and the following disclaimer.        %
%                                                                      %
%    2. Redistributions in binary form must reproduce the above        %
% copyright notice, this list of conditions and the following          %
% disclaimer in the documentation and/or other materials provided with %
% the distribution.                                                    %
%                                                                      %
%    3. The name of the author may not be used to endorse or promote   %
% products derived from this software without specific prior written   %
% permission.                                                          %
%                                                                      %
% THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR   %
% IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED       %
% WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE   %
% ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY       %
% DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL   %
% DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE    %
% GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS        %
% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER %
% IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR      %
% OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN  %
% IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                        %
%                                                                      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\chapter {GLE Utilities}
\label{util:chap}
\section{Fitls}
\index{Fitls}
The FITLS utility allows an equation with $n$ unknown constants to
be fitted to experimental data.

For example to fit a simple least squares regression line to a set of
points you would give FITLS the equation: \verb# a*x+b#

FITLS would then solve the equation to find the {\em best} values for
the constants $a$ and $b$.

FITLS can work with non linear equations, it will ask for initial
values for the parameters so that a solution around those initial
guesses will be found.

FITLS writes out a GLE file containing commands to draw the data
points and the equation it has fitted to them.

Here is a sample FITLS session:
\begin{verbatim}
$ fitls
Input data file (x and y columns optional) [test.dat,1,2] ? fitls.dat
Loading data from file, fitls.dat,  xcolumn=1, ycolumn=2
Valid operators: +, -, *, /, ^ (power)
Valid functions:
        abs(), atn(), cos(), exp(), fix(), int()
        log(), log10(), not(), rnd(), sgn(), sin()
        sqr(), sqrt(), tan()

 Enter a function of 'x' using constants 'a'...'z'
 e.g.    a + b*x   (standard linear least squares fit)
         sin(x)*a+b
         a + b*x + c*x^2 + d*x^3
         log(a*x)+(b+x)*c+a

Equation ? sin(a*x)*b+c*x^2+d

Output file name to write gle file [fitls.gle] ?
Precision of fit required, [1e-4] ?
Initial value for constant a [1.0] ?
Initial value for constant b [1.0] ?
Initial value for constant c [1.0] ?
Initial value for constant d [1.0] ?
0 evaluations, 1 1 1 1 , fit = 1355.36
20 evaluations, 1.97005 1 1 1 , fit = 1281.95
40 evaluations, 1.97005 10.228 0.151285 1 , fit = 54.7694
60 evaluations, 2.01053 10.228 0.151285 1.06365 , fit = 54.1771
.
.
.
440 evaluations, -0.640525 -2.81525 0.13997 1.13871 , fit = 0.940192
460 evaluations, -0.638055 -2.82934 0.140971 1.10502 , fit = 0.93842
480 evaluations, -0.63808 -2.82357 0.140993 1.10452 , fit = 0.938389
a = -0.638262 b = -2.81719 c = 0.140722 d = 1.11256

10 Iterations, sum of squares divided by n = 0.938389
y = sin(-0.638262*x)*-2.81719+0.140722*x^2+1.11256
\end{verbatim}
\vspace*{1.0cm}
\psgraphin{utilities/fig/fitls}{8.0}{5.0}{\sf fitls}


\documentclass{article}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\usepackage{mathtools, physics, xcolor}
\usepackage{hyperref}

\newcommand{\sor}{\mathbf{R}}
\DeclareMathOperator{\aut}{Aut}
\DeclareMathOperator{\card}{card}

\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\numberwithin{thm}{section}

\theoremstyle{plain}
\newtheorem{prop}{Proposition}
\numberwithin{prop}{section}

\theoremstyle{definition}
\newtheorem{defn}{Definition}
\numberwithin{defn}{section}

\theoremstyle{remark}
\newtheorem*{rem}{Remark}

\newtheorem*{cor}{Corollary}

\numberwithin{equation}{section}

\title{Group Theory}
\author{Amey Joshi}
\date{24-Dec-2020}
\begin{document}
\maketitle
\section{Basic definitions}\label{s1}
\begin{defn}\label{s1d1}
A group is a set $G$ and a binary operation $\cdot$ defined on it with the
following properties:
\begin{enumerate}
\item For all $a, b \in G$, $a \cdot b \in G$;
\item For all $a, b, c \in G$, $a \cdot (b \cdot c)= (a \cdot b) \cdot c$;
\item There exists an element $e \in G$ such that for all $a \in G$, $a \cdot e
= e \cdot a = a$. It is called the identity element.
\item For all $a \in G$ there exists an element $x_1$ such that $a \cdot x_1 =
e$ and an element $x_2$ such that $x_2 \cdot a = e$. The elements $x_1$ and
$x_2$ are called the right and left inverse of $a$.
\end{enumerate}
\end{defn}
\begin{rem}
We frequently abbreviate $a \cdot b$ as $ab$.
\end{rem}

A few propositions follow immediately.
\begin{prop}\label{s1p1}
Identity element is unique.
\end{prop}
\begin{proof}
Let, if possible, there be two identity elements $e_1$ and $e_2$. Since $e_1$
is an identity $a e_1 = a$ for all $a \in G$. Choose $a = e_2$ so that $e_2
e_1 = e_2$. But $e_2$ is also an identity so that $e_1 = e_2$.
\end{proof}

\begin{prop}\label{s1p2}
The right and left inverse of an element are identical.
\end{prop}
\begin{proof}
Let is possible there be elements $x, y \in G$ such that $xa = e$ and $ay = e$.
Then $(xa)y = ey \Rightarrow x(ay) = y \Rightarrow xe = y \Rightarrow x = y$.
\end{proof}

\begin{rem}
We no longer have to differentiate between the right and the left inverse of
an element and call it just the inverse.
\end{rem}

\begin{prop}\label{s1p3}
The inverse of an element is unique.
\end{prop}
\begin{proof}
Let if possible there be elements $x, y \in G$ such that $ax = e$ and $ay = e$.
Then $y(ax) = ye \Rightarrow (ya)x = y \Rightarrow ex = y \Rightarrow x = y$.
\end{proof}

\begin{rem}
The unique inverse of an element $a$ is denoted by $a^{-1}$.
\end{rem}

\begin{prop}\label{s1p4}
If $x, y \in G$ then $(xy)^{-1} = y^{-1}x^{-1}$.
\end{prop}
\begin{proof}
It is easy to check that $y^{-1}x^{-1}$ is an inverse of $xy$. From proposition
\ref{s1p3} it is the only inverse.
\end{proof}

\begin{prop}\label{s1p5}
For all $x \in G$, $(x^{-1})^{-1} = x$.
\end{prop}
\begin{proof}
Follows from the fact that $xx^{-1} = e$ and the uniqueness of inverse of
$x^{-1}$.
\end{proof}

\begin{defn}\label{s1d2}
A group $G$ is called abelian if $xy = yx$ for all $x, y \in G$.
\end{defn}

\section{Conjugate elements}\label{s2}
\begin{defn}\label{s2d1}
Elements $a$ and $b$ of a group $G$ are said to be conjugate to each other
if there exists an element $c \in G$ such that $a = cbc^{-1}$.
\end{defn}

If $a$ is conjugate to $b$ it is written as $a \sim b$. Clearly, conjugacy is
a binary relation on $G$. Here are a few examples of conjugate elements.

\begin{enumerate}
\item
Let $a$ denote a rotation of a rigid body by an angle $\phi$ about the $x$-axis
and $b$ be the rotation by an angle $\phi$ about the $y$ axis. Then,
\begin{eqnarray}
a &=& \begin{pmatrix}1 & 0 & 0 \\ 0 & \cos\phi & \sin\phi \\
0 & -\sin\phi & \cos\phi\end{pmatrix} \label{s2e1} \\
b &=& \begin{pmatrix} \cos\phi & 0 & \sin\phi \\ 0 & 1 & 0 \\
-\sin\phi  & 0 & \cos\phi\end{pmatrix} \label{s2e2}
\end{eqnarray}
Choose
\begin{equation}\label{s2e3}
c = \begin{pmatrix}0 & 1 & 0 \\ -1 & 0 & 0 \\ 0 & 0 & 1\end{pmatrix}
\end{equation}
so that
\begin{equation}\label{s2e4}
c^{-1} = \begin{pmatrix}0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{pmatrix}.
\end{equation}
We can readily confirm that $cac^{-1} = b$. The matrix $c$ is just the
rotation around the $z$-axis by $\pi/2$. Therefore the operation $cbc^{-1}$
means
\begin{enumerate}
\item Apply $c^{-1}$, that is, rotate around the $z$ axis by $-\pi/2$. This
brings the $y$ axis to the where the $x$ axis was prior to rotation;
\item Apply $b$, that is, rotate around the `rotated $y$ axis' by $\phi$;
\item Apply $c$, that is, rotate around the $z$ axis by $\pi/2$. This restores
the $x$ and $y$ axes to their original positions.
\end{enumerate}

\item Consider the elements of the symmetric group $S_3$ which involve
transposing two elements. They are written in Cayley's two line notation as
\begin{eqnarray}
x &=& \begin{pmatrix}1 & 2 & 3 \\ 1 & 3 & 2 \end{pmatrix} \label{s2e5} \\
y &=& \begin{pmatrix}1 & 2 & 3 \\ 3 & 2 & 1 \end{pmatrix} \label{s2e6} \\
z &=& \begin{pmatrix}1 & 2 & 3 \\ 2 & 1 & 3 \end{pmatrix} \label{s2e7}
\end{eqnarray}
It is easy to check that the elements $x, y, z$ are their own inverses. This
is not a surprising observation because carrying out the same transposition
twice gives the original arrangement. It is easy to confirm that $zxz^{-1} = y$.
\end{enumerate}

In some sense, conjugate elements are `similar' to each other. The matrices
$a$ and $b$ in equations \eqref{s2e1} and \eqref{s2e2} are both rotations
by the same angle but about different axes. This notion of similarity is
captured in
\begin{prop}\label{s2p1}
Conjugacy is an equivalence relation.
\end{prop}
\begin{proof}
Choose $c = a, b = a$ in the equation $a = cbc^{-1}$ to show that $a \sim a$.
If $a = cbc^{-1}$ then $c^{-1}a = bc^{-1} \Rightarrow c^{-1}ac = b$ so that
$b \sim a$. Finally, let $a \sim b$ and $b \sim c$. Thus, there exist $x, y
\in G$ such that $a = xbx^{-1}$ and $b = ycy^{-1}$ so that $a = xycy^{-1}x^{-1}
= (xy)c(xy)^{-1}$. Thus, $a \sim c$.
\end{proof}

Therefore, the conjugacy relation partitions the groups into equivalence
classes. The members of the equivalence classes are indeed `similar' to each
other in the sense illustrated by the two examples above.

\section{Subgroups}\label{s3}
\begin{defn}\label{s3d1}
A subset $H$ of a group $G$ is called a subgroup if $H$ is a group under
the same binary operation.
\end{defn}

\begin{rem}
A subgroup must contain the identity element.
\end{rem}

\begin{rem}
$H = G$ and $H = \{e\}$ are called trivial subgroups of $G$.
\end{rem}

\begin{prop}\label{s3p1}
$H$ is a subgroup of a group $G$ if and only if for all $h_1, h_2 \in H$,
$h_1^{-1}h_2 \in H$.
\end{prop}
\begin{proof}
The `only if' part follows immediately from the closure and inverse properties
of $H$.

Let $H \subset G$ such that for all $h_1, h_2 \in H$, $h_1^{-1}h_2 \in H$.
Choose $h_2 = h_1$ to conclude that $e \in H$. Choose $h_2 = e$ to conclude
that $h_1^{-1} \in H$. Since $h_1^{-1} \in H$, $(h_1^{-1})^{-1}h_2 = h_1h_2
\in H$. Associatity of the binary operation is valid for all elements of $G$
and therefore is valid for $H \in G$.
\end{proof}

A subgroup $H$ of a group $G$ is a set from which one cannot escape by carrying
out group operations among its elements. The only way to move out of $H$ is
by operating an $h \in H$ with a $g \in G$ such that $g \notin H$.

\begin{defn}\label{s3d2}
Given a subgroup $H$ of a group $G$, the left coset of an element $a \in G$
is the set $aH = \{ah | h \in H\}$.
\end{defn}

\begin{prop}\label{s3p2}
$\card{aH} = \card{H}$.
\end{prop}
\begin{proof}
If $ah_i = ah_j$ then $a^{-1}ah_i = a^{-1}ah_j \Rightarrow h_i = h_j$. Thus
all elements of $aH$ are distinct.
\end{proof}

\begin{prop}\label{s3p3}
$a \in aH$. If $b \in aH$ then $aH = bH$.
\end{prop}
\begin{proof}
Since $H$ is a subgroup, $e \in H$. Therefore, the set $aH$ contains $ae = a$.

Let $b \in aH$. Therefore, there exists $h \in H$ such that $b = ah$. Therefore
any element of $bH$ is of the form $bh^\prime = ahh^\prime$. Thus $bH \subset
aH$. Since $b = ah$, $a = bh^\prime$ and any element of $aH$ can be written
as $ah = bh^\prime h$, which is an element of $bH$. Thus $aH \subset bH$.
\end{proof}

Given a subgroup $H$ of $G$, the left cosets of $H$ partition the set $G$.
Therefore, the relation $a R b$ if $b \in aH$ is an equivalence relation. We
can prove this fact independently of proposition \ref{s3p2}.

\begin{prop}\label{s3p4}
Let $H$ be a subgroup of a group $G$ and $aH$ be one of its left cosets. Define
a relation $R$ on $G$ as $a R b$ if $b \in aH$. Then $R$ is an equivalence
relation.
\end{prop}
\begin{proof}
Since $H$ is a subgroup of $G$, $e \in H$ and hence $a \in aH$. We showed
in the proof of proposition \ref{s3p2} that if $b \in aH$ then $a \in bH$.
Finally, assume $a \in bH$ and $b \in cH$. Then $a = bh_1$ and $b = ch_2$
so that $a = c(h_1h_2)$. Thus $a \in cH$.
\end{proof}

\begin{prop}\label{s3p5}
Left coset $aH$ of a subgroup $H$ of a group $G$ is not a subgroup of $G$
unless $a = e$.
\end{prop}
\begin{proof}
If $a \ne e$ then $e \notin aH$.
\end{proof}

\begin{rem}
Note that $a \notin H$ when we talk about the coset $aH$. Therefore, $a^{-1}$
too is not a member of $H$. For if it did then $a$ too would be a member of
the subgroup $H$.

Therefore, we are guaranteed not to have $e$ in the set $aH$.
\end{rem}

Since all left cosets of a subgroup $H$ of a group $G$ have the same cardinality
and since they partition $G$, we have
\begin{thm}\label{s3t1}
$\card H | \card G$.
\end{thm}

\begin{defn}\label{s3d3}
Given a subgroup $H$ of a group $G$, the right coset of an element $a \in G$
is the set $Ha = \{ha | h \in H\}$.
\end{defn}

Right cosets have properties similar to that of left cosets. In particular,
they obey propositions analogous to \ref{s3p2}, \ref{s3p3}, \ref{s3p4} and
\ref{s3p5}.

Although cosets of a subgroup are not themselves subgroups, the set
\begin{equation}\label{s3e1}
H_a = \{aha^{-1} | h \in H\}
\end{equation}
for a fixed element $a \in G$ is indeed a group. We prove it as
\begin{prop}\label{s3p6}
$H_a$ is a subgroup of $G$.
\end{prop}
\begin{proof}
Consider two elements $x_1 = ah_1a^{-1}$ and $x_2 = ah_2a^{-1}$. Then $x_1^{-1}
x_2 = ah_1^{-1}a^{-1}ah_2 a^{-1} = a(h_1^{-1}h_2) a^{-1}$. From proposition
\ref{s3p1}, $h_1^{-1}h_2 \in H$ so that $x_1^{-1}x_2 \in H_a$.
\end{proof}

We also have
\begin{prop}\label{s3e7}
If $a \in H$, $H_a = H$.
\end{prop}
\begin{proof}
From the closure properties of $H$ it is clear that $H_a \subset H$. Let $x$
be an element of $H$ and $y = axa^{-1} \in H$. But $y$ is also a member of
$H_a$ so that $H \subset H_a$.
\end{proof}

\begin{rem}
The set $H_a$ contains elements conjugate to elements of $H$. We observed
previously that conjugate elements are `similar' in some sense. Therefore, it
should be no surprise that the `similar elements' also form a subgroup.
\end{rem}

\begin{defn}\label{s3d4}
If $H = H_a$ for all $a \in G$ then $H$ us called an invariant subgroup of $G$.
\end{defn}

\begin{rem}
Invariant subgroup is also called a normal subgroup. An invariant subgroup
remains unchanged under the conjugacy operation.
\end{rem}

\begin{prop}\label{s3e8}
If $H$ is an invariant subgroup of $G$ then $aH = Ha$ for all $a \in G$.
\end{prop}
\begin{proof}
$aha^{-1}$ must be equal to an element $h^\prime$ of $H$. Therefore, $ah =
h^\prime a$. Since this is true for all $h \in H$, $aH = Ha$.
\end{proof}

If $H$ is an invariant subgroup of $G$ then we can define the product of its
cosets as
\begin{equation}\label{s3e2}
aHbH  = \{ahbh^\prime | h, h^\prime \in H\}.
\end{equation}

\begin{prop}\label{s3e9}
The set of all cosets of an invariant group is closed under coset composition
defined by equation \eqref{s3e2}.
\end{prop}
\begin{proof}
$ahbh^\prime = a(hb)h^\prime$. Since $H$ is an invariant subgroup $bH = Hb$.
Therefore, we can write $hb = bh^{\prime\prime}$ and hence $ahbh^\prime =
ab(h^{\prime\prime}h^\prime)$, which is a member of $abH$.
\end{proof}

If $H$ is an invariant subgroup then the set $G/H$ of its cosets with a
composition law defined by equation \eqref{s3e2} forms a group. It is called
the factor group. Its closure is proved in proposition \eqref{s3e9}. The set
$eH = H$ is its identity. The set $a^{-1}H$ is the inverse of $aH$ and the
associativity of coset composition follows immediately from the associativity
of the elements of $G$.

\begin{defn}\label{s3d5}
The set $G/H$ of all cosets of an invariant subgroup $H$ of a group $G$ is
called the factor group.
\end{defn}

\begin{defn}\label{s3d6}
$G$ is called a simple group if it has no nontrivial invariant subgroups.
\end{defn}

\begin{defn}\label{s3d7}
$G$ is called a semisimple group if it has no nontrivial abelian invariant
subgroups.
\end{defn}

From their definitions it is clear that
\begin{prop}\label{s3p10}
If $G$ is simple then it is semisimple.
\end{prop}

\begin{rem}
The converse need not be true.
\end{rem}

\section{Some important groups}\label{s4}
In this section we list a few groups that are of importance in physics.
\begin{enumerate}
\item $O(n)$, the set of all orthogonal $n \times n$ matrices. Recall that an
$n \times n$ matrix $M$ is orthogonal if $MM^T = M^T M = I_n$.
\item $SO(n)$, a subgroup of $O(n)$ of matrices whose determinant is $1$.
\item $U(n)$, the set of all unitary matrices. $M$ is a unitary matrix if
$MM^\dagger = M^\dagger M = I_n$.
\item $SU(n)$, a subgroup of $U(n)$ of matrices whose determinant is $1$.
\item $GL(n, \sor)$, the set of all invertible, real $n \times n$ matrices.
\item $SL(n, \sor)$ is a subgroup of $GL(n, \sor)$ of matrices with determinant
equal to $1$.
\item A $(2n) \times (2n)$ matrix $M$ is called a symplectic matrix if
\begin{equation}\label{s4e1}
M^T\Omega M = \Omega,
\end{equation}
where
\begin{equation}\label{s4e2}
\Omega = \begin{pmatrix}0 & I_n \\ -I_n & 0 \end{pmatrix}.
\end{equation}
The set of all symplectic matrices also forms a group. It is called $Sp(2n,
\sor)$.
\end{enumerate}

\section{Commutator subgroup}\label{s5}
\begin{defn}\label{s5d1}
A function $q: G \times G \rightarrow G$ defined as
\[
q(a, b) = aba^{-1}b^{-1}
\]
is called the commutator of $a$ and $b$.
\end{defn}

\begin{prop}\label{s5p1}
If $G$ is abelian then $q(a, b) = e$ for all $a, b \in G$.
\end{prop}
\begin{proof}
Since $G$ is abelian, $aba^{-1}b^{-1} = abb^{-1}a^{-1} = e$.
\end{proof}

\begin{prop}\label{s5p2}
The commutator function has the following properties:
\begin{itemize}
\item $q(a, b)^{-1} = q(b, a)$.
\item $cq(a, b)c^{-1} = q(cac^{-1}, cbc^{-1})$.
\end{itemize}
\end{prop}
\begin{proof}
$q(a, b)q(b, a) = aba^{-1}b^{-1}bab^{-1}a^{-1} = e$ implies that $q(b, a)$
is an inverse of $q(a, b)$. From proposition \eqref{s1p3} it is the only
inverse.

The second property follows from
\begin{eqnarray*}
cq(a, b)c^{-1} &=& caba^{-1}b^{-1}c^{-1} \\
 &=& (cac^{-1})(cbc^{-1})(ca^{-1}c^{-1})(cb^{-1}c^{-1}) \\
 &=& (cac^{-1})(cbc^{-1})(cac^{-1})^{-1}(cbc^{-1})^{-1} \\
 &=& q(cac^{-1}, cbc^{-1}).
\end{eqnarray*}
\end{proof}

\begin{defn}\label{s5d2}
$Q(G, G) = \{\prod_{i=0}^nq(a_i, b_i) | a_i, b_i \in G, i \in \mathbf{N}\}$.
\end{defn}

\begin{rem}
$Q(G, G)$ is the set of arbitrary products of commutators of $G$.
\end{rem}
\begin{rem}
$Q(G,G) \subset G$.
\end{rem}

\begin{prop}\label{s5p3}
$Q(G, G)$ is an invariant subgroup of $G$.
\end{prop}
\begin{proof}
Let $x, y \in Q(G, G)$. Then $x = q(a, b)$ and $y = q(c, d)$ for some $a, b,
c, d \in G$. Consider $q(a, b)^{-1}q(c, d) = q(b, a)q(c, d) \in Q(G, G)$, by
definition. Therefore, by proposition \ref{s3p1}, $Q(G, G)$ is a subgroup of
$G$.

Let $c \in G$. Now $cq(a, b)c^{-1} = q(cac^{-1}, cbc^{-1}) \in Q(G, G)$.
Therefore, $Q(G, G)_c = Q(G, G)$. Since $c$ was an arbitrary element of $G$,
$Q(G, G)_c = Q(G, G)$ for all $c \in G$. This makes is an invariant subgroup.
\end{proof}

\begin{prop}\label{s5p4}
The factor group $G/Q(G, G)$ is abelian.
\end{prop}
\begin{proof}
Recall that $G/Q(G, G)$ is a set of all cosets of $Q(G, G)$ with the coset
composition law defined in equation \eqref{s3e2}. By definition of $Q(G, G)$,
$x^{-1}y^{-1}xyQ(G, G) = Q(G, G)$. Therefore, $y^{-1}xyQ(G, G) = xQ(G, G)$ and
hence $xyQ(G, G) = yxQ(G, G)$ or $xQ(G, G) yQ(G, G) = yQ(G, G) xQ(G, G)$.
\end{proof}

\begin{prop}\label{s5p5}
Let $H$ be an invariant subgroup of $G$. $G/H$ is abelian if and only if $H
\supset Q(G, G)$.
\end{prop}
\begin{proof}
Let $G/H$ be abelian. Therefore, $abH = baH$ for all $a, b \in G$. In other
words, $H = b^{-1}a^{-1}baH$ or that $b^{-1}a^{-1}ba = q(b^{-1}, a^{-1}) \in
H$ for all $a, b \in G$. Therefore, $Q(G, G) \subset H$.

Now consider a normal subgroup $H \supset Q(G, G)$ and its coset $abH$.
Since $H \supset Q(G, G)$, $x = b^{-1}a^{-1}ba \in H$. Therefore, $abxH = abH$,
or $abb^{-1}a^{-1}ba H = abH$ or $baH = abH$.
\end{proof}

A statement equivalent to proposition \eqref{s5p5} is
\begin{prop}\label{s5p6}
$Q(G, G)$ is the smallest subgroup of $G$ such that its factor group is
abelian.
\end{prop}

Let $G_0 = G$ and $G_1 = Q(G, G) = Q(G_1, G_1)$. Then we saw that $G_1$ is an
invariant subgroup of $G_0$. In some sense $G_1$ is smaller than $G_0$. We can
define a sequence of groups
\begin{equation}\label{s5e1}
G_j = \begin{cases}
G & \text{ if } j = 0 \\
Q(G_{j-1}, G_{j-1}) & \text{ if } j \ge 1.
\end{cases}
\end{equation}
Clearly, each $G_{j}$ is an invariant subgroup of $G_{j-1}$ and is in some
sense smaller than $G_{j-1}$.

\begin{defn}\label{s5d3}
A group $G$ is solvable if $G_j = {e}$ for a finite $j \in \mathbf{N}$, where
$G_j$ is defined by equation \eqref{s5e1}.
\end{defn}

If $G$ is abelian then $G_1 = Q(G, G) = \{e\}$. Therefore, an abelian group
is (trivially) solvable. Solvability in thus a generalisation of commutativity.

Recall definitions \ref{s3d6} of a simple group. From definition \ref{s5d3}
it immediately follows that
\begin{prop}\label{s5e7}
A solvable group is not simple.
\end{prop}
An equivalent, contrapositive statement is
\begin{prop}\label{s5e8}
A simple group is not solvable.
\end{prop}

\section{Mappings between groups}\label{s6}
\begin{defn}\label{s6d1}
A homomorphism from a group $G$ to a group $G^\prime$ is a mapping $\phi: G
\mapsto G^\prime$ such that $\phi(a)\phi(b) = \phi(ab)$ for all $a, b \in G$.
\end{defn}
\begin{rem}
A homomorphism, as its name suggests, indicates that $G$ and $G^\prime$ have
similar structure. The elements $a, b, ab$ of $G$ correspond to the elements
$\phi(a), \phi(b), \phi(a)\phi(b) = \phi(ab)$ of $G^\prime$.
\end{rem}

\begin{prop}\label{s6p1}
If $\phi: G \mapsto G^\prime$ is a homomorphism then $\phi(e)$ is an identity
of $G^\prime$.
\end{prop}
\begin{proof}
$\phi(a)\phi(e) = \phi(ae) = \phi(a)$ for all $a \in G$.
\end{proof}

Similarly, one can show that
\begin{prop}\label{s6p2}
If $\phi: G \mapsto G^\prime$ is a homomorphism then $\phi(a^{-1}) =
(\phi(a)^{-1})$ for all $a \in G$.
\end{prop}
\begin{proof}
Put $b = a^{-1}$ in the definition \ref{s6d1} to conclude that $\phi(a)
\phi(a^{-1}) = \phi(aa^{-1}) = \phi(e)$. From the previous proposition we
know that $\phi(e)$ is the identity of $G^\prime$.
\end{proof}

\begin{prop}\label{s6p3}
If $\phi: G \mapsto G^\prime$ is a homomorphism then $\phi(G) \subset G^\prime$.
\end{prop}
\begin{proof}
Choose $b = e$ in the definition \ref{s6d1} to conclude that $\phi(a) \in
G^\prime$ for all $a \in G$.
\end{proof}

In fact, we can also show that
\begin{prop}\label{s6p4}
If $\phi: G \mapsto G^\prime$ is a homomorphism then $\phi(G)$ is a subgroup
of $G^\prime$.
\end{prop}
\begin{proof}
Let $y_1 = \phi(x_1)$ and $y_2 = \phi(x_2)$. From proposition \ref{s6p2}
$y_1^{-1} = \phi(x_1^{-1})$ so that $y^{-1}_1y_2 = \phi(x_1^{-1})\phi(x_2)
= \phi(x_1^{-1}x_2) \in \phi(G)$.
\end{proof}

\begin{defn}\label{s6d2}
If $\phi: G \mapsto G^\prime$ is a homomorphism then $\ker(\phi) = \{a \in G
| \phi(a) = e^\prime\}$ where $e^\prime$ is the identity of $G^\prime$, is
called the kernel of $\phi$.
\end{defn}

\begin{prop}\label{s6p5}
If $\phi: G \mapsto G^\prime$ is a homomorphism then $\ker(\phi)$ is a subgroup
of $G$.
\end{prop}
\begin{proof}
Let $a, b \in \ker(\phi)$ then $\phi(a) = \phi(b) = e^\prime$. Now,
$(\phi(a))^{-1} = (e^\prime)^{-1} \Rightarrow \phi(a^{-1}) = e^\prime$
so that $a^{-1} \in \ker(\phi)$. Therefore $\phi(a^{-1})\phi(b) = e^\prime
e^\prime = e^\prime \Rightarrow \phi(a^{-1}b) = e^\prime \Rightarrow a^{-1}b
\in \ker(\phi)$ making $\ker(\phi)$ is subgroup of $G$.
\end{proof}

\begin{prop}\label{s6p6}
If $\phi: G \mapsto G^\prime$ is a homomorphism then $\ker(\phi)$ is an
invariant subgroup of $G$.
\end{prop}
\begin{proof}
Let $a \in G$ then, using definition \ref{s3d1} $\ker(\phi)_a = \{a^{-1}ha|
h \in \ker(\phi)\}$. Now $\phi(a^{-1}ha) = e^\prime$ for all $a \in G$.
Therefore $\ker(\phi)_a = \ker(\phi)$ for all $a \in G$.
\end{proof}

\begin{defn}\label{s6d3}
A homomorphism $\phi: G \mapsto G^\prime$ is an isomorphism if $\phi$ is
bijective.
\end{defn}

\begin{prop}\label{s6p7}
If $\phi:G \mapsto G^\prime$ is a homomorphism then $G/\ker(\phi)$ is
isomorphic to $\phi(G)$.
\end{prop}
\begin{proof}
$G/\ker(\phi) = \{a\ker(\phi)| a \in G\}$. Define a mapping $\psi:G/\ker(\phi)
\mapsto \phi(G)$ such that $\psi(a\ker(\phi)) = \phi(a)$. Now $\psi(a\ker(\phi)
b\ker(\phi)) = \psi(ab\ker(\phi)) = \phi(ab) =
\psi(a\ker(\phi))\psi(b\ker(\phi)) $ so that $\psi$ is indeed a homomorphism.

Let $g^\prime \in \phi(G)$. Therefore, there exists $g \in G$ such that
$\phi(g) = g^\prime$. Therefore $\psi(g\ker(\phi)) = g^\prime$. Thus, $\psi$
is surjective.

Let, if possible, $\psi(a\ker(\phi)) = \psi(b\ker(\phi)) = g^\prime$. Therefore
there exists $x, y \in \ker(\phi)$ such that $\phi(ax) = \phi(by)$, or $\phi(a)
= (\phi(x))^{-1}\phi(b)\phi(y) = \phi(b)$, because $x$ and $y$ belong to
$\ker(\phi)$ and therefore map to $e^\prime$, the identity in $G^\prime$. This
shows that $\psi$ is injective.
\end{proof}

\begin{defn}\label{s6d4}
An automorphism on a group $G$ is an isomorphism $G \mapsto G$.
\end{defn}

\section{Direct and semidirect products}\label{s7}
\begin{defn}\label{s7d1}
The direct product $G_1 \times G_2$ of two groups $G_1$ and $G_2$ is the set
$\{(g_1, g_2) | g_1 \in G_1, g_2 \in G_2\}$ with the binary operation
\[
(a_1, a_2)(b_1, b_2) = (a_1b_1, a_2b_2).
\]
\end{defn}
\begin{rem}
Note that $a_1, b_1 \in G_1$ so that $a_1b_1$ is a well-defined operation.
Same holds good for $a_2b_2$.
\end{rem}

\begin{rem}
The difference between direct product and direct sum is explained in
\href{https://math.stackexchange.com/questions/2412232/direct-product-vs-direct-sum-of-infinite-dimensional-vector-spaces}{Wikipedia} article.
\end{rem}

It is easy to confirm that
\begin{thm}\label{s7t1}
$G_1 \times G_2$ is a group.
\end{thm}
\begin{proof}
The operation is clearly closed. $(e_1, e_2)$ is the identity, $(a^{-1}_1,
b_1^{-1})$ is the inverse of $(a, b)$ and the associativity of the binary
operation follows from the associativity of components.
\end{proof}

\begin{defn}\label{s7d2}
Let $N$ and $H$ be two groups, $\aut{N}$ be the set of all automorphisms on $N$
and let $\varphi : H \rightarrow \aut{N}$ be a homomorphism. Then a semidirect
product of $N$ and $H$ with respect to $\varphi$, denoted $N \rtimes_\varphi H$,
is defined the set $N \times H$ with a binary operation $\ast$ defined as
\[
(n_1, h_1)\ast(n_2, h_2) = (n_1 + \varphi(h_1)(n_2), h_1 \cdot h_2),
\]
where $+$ is the group operation of $N$ and $\cdot$ that of $H$.
\end{defn}

\begin{prop}\label{s7t2}
$(N \rtimes_\varphi H, \ast)$ is a group.
\end{prop}
\begin{proof}
Closure of $\ast$ follows from the definition.

Let $e_N$ and $e_H$ be identities of $N$ and $H$. Therefore, $(e_N, e_H)\ast
(n, h) = (e_N + \varphi(e_H)(n), e_H \cdot h)$. Since $\varphi$ is a
homomorphism $\varphi(e_H) = I$, where $I$ is the identity isomorphism, so that
$(e_N, e_H)\ast(n, h) = (e_N + I(n), h) = (n, h)$. Similarly $(n, h)\ast
(e_N, e_H) = (n + \varphi(h)(e_N), e_H \cdot h) = (n + e_N, h) = (n, h)$. Thus,
$(e_N, e_H)$ is an identity.

Consider
\[
(n, h) \ast (\varphi(h^{-1})(n^{-1}), h^{-1}) =
(n + \varphi(h)\varphi(h^{-1})(n^{-1}), h\cdot h^{-1})
\]
Since $\varphi$ is a homomorphism, $\varphi(h)\varphi(h^{-1}) = \varphi(hh^{-1})
 = \varphi(e_H) = I$ so that,
\[
(n, h) \ast (\varphi(h^{-1})(n^{-1}), h^{-1}) =
(n + I(n^{-1}), e_H) = (n + n^{-1}, e_H) = (e_N, e_H)
\]
Similarly, $(\varphi(h^{-1})(n^{-1}), h^{-1}) \ast (n, h) = (e_N, e_H)$. Thus
$(\varphi(h^{-1})(n^{-1}), h^{-1})$ is an inverse.

Lastly
\begin{eqnarray*}
(n_1, h_1) \ast ((n_2, h_2) \ast (n_3, h_3)) &=&
(n_1, h_1) \ast (n_2 + \varphi(h_2)(n_3), h_2 \cdot h_3) \\
 &=& (n_1 + \varphi(h_1)(n_2 + \varphi(h_2)(n_3)), h_1 \cdot (h_2 \cdot h_3)) \\
 &=& (n_1 + \varphi(h_1)(n_2) + \varphi(h_1)\varphi(h_2)(n_3), (h_1 \cdot h_2)
 \cdot h_3) \\
 &=& (n_1 + \varphi(h_1)(n_2) + \varphi(h_1h_2)(n_3), (h_1 \cdot h_2) \cdot h_3) \\
 &=& (n_1 + \varphi(h_1) + n_2, h_1 \cdot h_2) \ast (n_3, h_3) \\
 &=& ((n_1, h_1) \ast ((n_2, h_2)) \ast (n_3, h_3)
\end{eqnarray*}
Thus $\ast$ is an associative operation.
\end{proof}

If $\varphi$ in definition \ref{s7d2} is an identity then
\begin{equation}\label{s7e1}
(n_1, h_1) \ast (n_2, h_2) = (n_1 + n_2, h_1h_2).
\end{equation}
Thus, the semidirect product becomes the direct product. We also observe that
\begin{enumerate}
\item $\{e_N\} \rtimes_\varphi H$ is a subgroup of $N \rtimes_{\varphi} H$ and
it is isomorphic to $H$.
\item $N \rtimes_\varphi \{e_H\}$ is a subgroup of $N \rtimes_{\varphi} H$ and
it is isomorphic to $N$.
\end{enumerate}

\begin{prop}\label{s7p1}
$N \rtimes_\varphi \{e_H\}$ is an invariant subgroup of $N \rtimes_\varphi H$.
\end{prop}
\begin{proof}
Let $(n, e_H)$ be an element of $N \rtimes_\varphi \{e_H\}$ and $(m, h)$ be
an element of $N \rtimes_\varphi H$.
\[
(m,h)\ast(n,e_H)\ast(m,h)^{-1} = (m + \varphi(e_H)(n), h e_H)\ast(m, h)^{-1}.
\]
Since $\varphi(e_H)$ is an identity mapping,
\[
(m,h)\ast(n,e_H)\ast(m,h)^{-1} = (m + n, h)\ast(m, h)^{-1}.
\]
Since $(m, h)^{-1} = (\varphi(h^{-1})(m^{-1}), h^{-1})$
\begin{eqnarray*}
(m,h)\ast(n,e_H)\ast(m,h)^{-1} &=& (m + n, h)\ast
(\varphi(h^{-1})(m^{-1}), h^{-1}) \\
 &=& (m + n + \varphi(h)(\varphi(h^{-1})(m^{-1})), hh^{-1})
\end{eqnarray*}
Since $\varphi$ is an automorphism $\varphi(h^{-1}) = \varphi^{-1}(h)$ so that
\[
(m,h)\ast(n,e_H)\ast(m,h)^{-1} = (m + n + m^{-1}, e_H) = (n, e_H).
\]
\end{proof}

\nocite{*}
\bibliographystyle{plain}
\bibliography{gt}
\end{document}


\documentclass[notitlepage]{simple}

\author{Matt McCarthy}
\title{Finding Trigonometric Identities using DeMoivre's Theorem}
\date{April 2016}

\begin{document}

\maketitle

\begin{problem*}
	For $x,r\in\RR$ find
	\[
		\sum_{k=0}^n r^k\cos kx \text{ and } \sum_{k=0}^n r^k\sin kx.
	\]
	Then, assuming $|r|<1$ take their limits as $n\rightarrow\infty$.
\end{problem*}

\section{Background}

Before beginning, we need to mention DeMoivre's theorem.
\begin{thm}
	\[
		\cos kx + i\sin kx = \paren{\cos x+i\sin x}^k
	\]
\end{thm}
\begin{proof}
	We know by Euler's formula that
	\[
		\paren{\cos x+i\sin x}^k = e^{ikx} = \cos kx +i\sin kx.
	\]
\end{proof}

Another thing to know is that for $z=a+bi\in\CC$, the \textit{conjugate} of $z$, denoted $\overline{z}$, is $\overline{z}=a-bi$.
Furthermore, $z\cdot\overline{z}=a^2+b^2$.

Lastly, we need that
\[
	\sum_{k=0}^n z^k = \frac{1-z^{k+1}}{1-z}.
\]

\section{Solution}

Consider the following.
\begin{align*}
	\sum_{k=0}^n r^k\cos kx + i\sum_{k=0}^n r^k\sin kx =& \sum_{k=0}^n r^k \paren{\cos kx + i\sin kx}\\
	=& \sum_{k=0}^n r^k \paren{\cos x + i\sin x}^k\\
	=& \frac{1-r^{n+1}\paren{\cos x + i\sin x}^{n+1}}{1-r\cos x -ir\sin x}\\
	=& \frac{1-r^{n+1}\cos((n+1)x) -ir^{n+1}\sin((n+1)x)}{(1-r\cos x) -ir\sin x}\cdot\frac{(1-r\cos x)+ir\sin x}{(1-r\cos x) +ir\sin x}\\
	=& \frac{1-r\cos x-r^{n+1}\cos((n+1)x)+r^{n+2}\cos x\cos((n+1)x)+r^{n+2}\sin x\sin((n+1)x)}{1-2r\cos x +r^2\cos^2 x+r^2\sin^2 x}\\
	&+i\frac{r\sin x -r^{n+1}\sin((n+1)x)-r^{n+2}\cos((n+1)x)\sin x +r^{n+2}\cos x\sin((n+1)x)}{1-2r\cos x +r^2\cos^2 x+r^2\sin^2 x}
\end{align*}

By matching real parts and imaginary parts we get
\begin{align*}
	\sum_{k=0}^n r^k\cos kx &= \frac{1-r\cos x-r^{n+1}\cos((n+1)x)+r^{n+2}\cos x\cos((n+1)x)+r^{n+2}\sin x\sin((n+1)x)}{1-2r\cos x +r^2}\\
	\sum_{k=0}^n r^k\sin kx &= \frac{r\sin x -r^{n+1}\sin((n+1)x)-r^{n+2}\cos((n+1)x)\sin x +r^{n+2}\cos x\sin((n+1)x)}{1-2r\cos x +r^2}.
\end{align*}

If we suppose $|r|<1$ and let $n\rightarrow\infty$ we get that
\begin{align*}
	\sum_{k=0}^\infty r^k\cos kx &= \frac{1-r\cos x}{1-2r\cos x +r^2}\\
	\sum_{k=0}^\infty r^k\sin kx &= \frac{r\sin x}{1-2r\cos x +r^2}.
\end{align*}

\end{document}


\chapter{\proj 1D Data}
\label{ch_1d}
\markright{1D Data}

\section{1D Tools}
\subsection{Conversion: im1d\_convert}
\index{im1d\_convert}
Program {\em im1d\_convert} converts a 1D signal from one data format
to another one.
Currently supported signal formats are the ascii format, the FITS format,
  and Excel format. Suffixes for these formats are
respectively ``.dat'', ``.fits'',
  and ``.csv"''. The ``-s'' option allows the user to
suppress a given number
  of lines at the beginning of the file. This option has an effect only
  for ascii and Excel input formats. The ascii format consists of a series of
  numbers separated by a space, a tab, or a new line.
{\bf
\begin{center}
     USAGE: im1d\_convert [-s NbrLines] file\_name\_in file\_name\_out
\end{center}}
\subsubsection*{Examples:}
\begin{itemize}
\item im1d\_convert sig.dat image.fits \\
Converts an ascii file to FITS format.
\item im1d\_convert -s 2 sig.dat image.fits  \\
Ditto, but the first lines are not taken into account.
\end{itemize}

\subsection{Statistical information: im1d\_info}
\index{im1d\_info}

{\em im1d\_info} gives information about a signal:
\begin{itemize}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item the number of pixels
\item the minimum, the maximum
\item the arithmetic mean: $  {\bar x} = \frac{1}{N}\sum_k x_k$
\item the standard deviation: $\sigma = \frac{1}{N} \sum_k (x_k - {\bar x})^2 = \sqrt{{\bar {x^2}} - {\bar x}^2}$
\item the flux: $F  = \sum_k x_k$
\item the energy: $E = \sum_k x_k^2$
\item the skewness:
$
S  =   \frac{1}{N \sigma^3}\sum_k (x_k - {\bar x})^3
        =   \frac{1}{\sigma^3} ({\Bar {x^3}} - 3 {\bar x}{\Bar {x^2}} + 2{\bar x}^3)
$ \\
\item the kurtosis:
$
C  =   \frac{1}{N \sigma^4}\sum_k (x_k - {\bar x})^4 - 3
   =  \frac{1}{\sigma^4} ({\Bar {x^4}} - 4 {\bar x}{\Bar {x^3}} + 6 {\Bar {x^2}}{\bar x}^2 - 3 {\bar x}^4) - 3
$ \\
\item Measure of dependence: calculate the autoregressive model
which fits the data, for all orders between $1$ and $M$, and select the
AR model which minimizes the following equation:
\begin{eqnarray*}
J(p) = \log \sigma_{A(p)}^2 + {\cal P}(A(p))
\end{eqnarray*}
where $\sigma_{A}$ is the prediction error, and
${\cal P}$ is a penalty function, which increases with the AR order.
Examples of penalty functions are:
\begin{itemize}
\item AIC: $AIC = \log \sigma_{A_j}^2 + \frac{2 A_j}{N}$
\item AICC: $AICC = \log \sigma_{A_j}^2 + \frac{N +  A_j}{N - A_j - 2}$
\item SIC: $SIC = \log \sigma_{A_j}^2 + \frac{ A_j\log N }{N}$
\end{itemize}
\end{itemize}
When the ``-a'' option is set, then the  autocorrelation function $\rho(h)$
is also calculated:
\begin{eqnarray}
\rho(h) = \frac{\gamma(h)}{\gamma(0)}
\end{eqnarray}
 where $\gamma(h)$ is the autocovariance function defined by:
 \begin{eqnarray}
 \gamma(h)= \frac{1}{N} \sum_k (x_{k+h} - {\bar x})(x_k - {\bar x})
 \end{eqnarray}

The command line is:
{\bf
\begin{center}
     USAGE: im1d\_info file\_name\_in
\end{center}
}
where options are:
\begin{itemize}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item {\bf[-a Nbr\_of\_Lags]} \\
 Calculate the autocorrelation function (AF) with a given number of lags.
The output AF is saved in a file of name ``autocor''.
Default number of lags is 10.
\item {\bf[-O Estimation\_AR\_Order\_Method]}
\begin{enumerate}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item AIC
\item AICC
\item BIC
\end{enumerate}
Default is BIC method.
\item {\bf[-M MaxAROrder]} \\
Maximum AR model order. Default is 10.
\end{itemize}
\subsubsection*{Examples:}
\begin{itemize}
\itemsep=0.1truecm
\item im1d\_info data.dat  \\
Gives information about the data.
\item im1d\_info -a 10 data.dat \\
Ditto, but calculates also autocorrelation function with 10 lags.
\end{itemize}

\subsection{Tendency estimation: im1d\_tend}
\index{im1d\_tend}
If the signal exhibits a tendency, it may be convenient to remove it
before starting the analysis. A well-known fitting
method is the polynomial one.
A polynomial of order $p$ is fitted around each pixel
in a window of size $T$ ($p$ equals 2 in this program).
In order to have smooth tendency estimation,
it is recommended to weight the pixels with weights from 1 to zero for pixels
in the middle to the border of the window.
{\bf
\begin{center}
 USAGE: im1d\_tend option in\_data out\_tend out\_signal\_no\_tend
\end{center}}
where options are:
\begin{itemize}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item {\bf [-T WindowSize\_for\_tendency\_estimation]} \\
Default is 100.
\item {\bf [-f FirstPixels]}
Default is the input signal size. If this option is set, the tendency is
estimated only on the first {\em FirstPixels} pixels.
\end{itemize}
\subsubsection*{Examples:}
\begin{itemize}
\item im1d\_tend sig.dat tend.dat sig\_out \\
Remove the tendency in the input data with all default options.
\item im1d\_tend -T 200 sig.dat tend.dat sig\_out   \\
Ditto, but increase the window size.
\end{itemize}
\begin{figure}[htb]
\centerline{
\vbox{
\psfig{figure=fig_ar_tend.ps,bbllx=2cm,bblly=12.5cm,bburx=20cm,bbury=25.5cm,width=13.5cm,height=10cm,clip=}
}}
\caption{Top, input signal containing an AR(4) signal and a tendency. Middle,
estimated tendency. Bottom, difference between the two previous signals.}
\label{fig_artend}
\end{figure}
Figure~\ref{fig_artend} shows the results when applying the {\em tend\_est}
program (with a window size equal to 400)
to a time series containing a tendency and an AR(4).

\section{Wavelet Transform}
\subsection{Multiresolution transform: mr1d\_trans}
\label{sect_mr1dtrans}
\index{mr1d\_trans}

Program {\em mr1d\_trans} applies a one-dimensional multiresolution
transform to a signal. The ouput file contains an image, in which
each row is a band of the multiresolution transform. Morlet, Mexican hat,
and French hat wavelet transforms are non-dyadic (the resolution is
not decreased by a factor two between two scales),
and 12 voices (fixed value) are calculated (instead of one for the
dyadic case) when the resolution is divided by two. Then the number of
rows in the output image will be equal to 12*{\em number\_of\_scales}.
The Morlet wavelet is complex, so the wavelet transform is complex too.
Using this transform, the first 12*{\em number\_of\_scales}  lines represent
the real part of the transform, and the 12*{\em number\_of\_scales} last lines
the imaginary part. Four transforms are non-redundant: the bi-orthogonal,
the lifting scheme, and the wavelet packet methods (transforms 16 and 17).
In this case, the output is not an
image but a signal (i.e.\ 1D rather than 2D),
which has the same size as the original one.
Position and length of a given band in the output signal can be found by
reading the file created using the ``-w'' option. For the lifting scheme
based method, the type of lifting can be changed using the ``-l'' option,
and for the (bi-) orthogonal and packet one, the filter can be changed
by the ``-f'' option.

19 transforms are available, which are grouped into 5 classes
\begin{itemize}
\item{Class 1:} no decimation (transforms 1 to 7 and 11 to 14).
\item{Class 2:} pyramidal transform (transforms 8 to 10).
\item{Class 3:} orthogonal transform (15 and 16).
\item{Class 4:} Wavelet packets (17 and 18).
\item{Class 5:} Wavelet packets via the \`a trous algorithm  (19).
\end{itemize}
Depending on the class, the transform does not contain the
same number of pixels, and the data representation differs.
By default, the number of scales is calculated from
the length of the signal.
{\bf
\begin{center}
 USAGE: mr1d\_trans option signal\_in image\_out
\end{center}}
where options are:
\begin{itemize}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item {\bf [-t type\_of\_multiresolution\_transform]}
\begin{enumerate}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item Linear wavelet transform: \`a trous algorithm
\item B$_1$-spline wavelet transform: \`a trous algorithm
\item B$_3$-spline wavelet transform: \`a trous algorithm
\item Derivative of a B$_3$-spline: \`a trous algorithm
\item Undecimated Haar wavelet transform: \`a trous algorithm
\item Morphological median transform
\item Undecimated (bi-) orthogonal wavelet transform
\item Pyramidal linear wavelet transform
\item Pyramidal B$_3$-spline wavelet transform
\item Pyramidal median transform
\item Morlet's wavelet transform \\
Continuous wavelet transform with a complex wavelet
which can be decomposed into two parts, one for
the real part, and the other for the imaginary part:
\begin{eqnarray*}
\psi_r(x) & = & \frac{1}{\sqrt{2 \pi}\sigma}  e^{-\frac{x^2}{2\sigma^2}} \cos(2\pi\nu_0 \frac{x}{\sigma}) \nonumber \\
\psi_i(x) & = & \frac{1}{\sqrt{2 \pi}\sigma}  e^{-\frac{x^2}{2\sigma^2}} \sin(2\pi\nu_0 \frac{x}{\sigma})
\end{eqnarray*}
First scale $\sigma_0$ is chosen equal to $2 \nu_0$ and $\nu_0 = 0.8$,
using 12 voices per octave.
\item Mexican hat wavelet transform \\
Continuous wavelet transform with the Mexican hat wavelet.
This is the second derivative of a Gaussian
\begin{eqnarray}
\psi(x) = (1 - \frac{x^2}{\sigma^2}) e^{-\frac{ x^2}{2\sigma^2}}
\end{eqnarray}
First scale $\sigma_0$ is chosen equal to $\frac{1}{\sqrt{3}}$, using 12 voices per octave.
\item French hat wavelet transform \\
Continuous wavelet transform with the French  hat wavelet
\begin{eqnarray}
\psi(x) =  \left \{
\begin{array}{ll}
     0  & \mbox{ if }  \mid \frac{x}{\sigma} \mid > 1 \\
     -1 & \mbox{ if } \mid  \frac{x}{\sigma} \mid \in [\frac{1}{3},1]  \\
     2  & \mbox{ if } \mid  \frac{x}{\sigma} \mid < \frac{1}{3}
\end{array}
\right.
\end{eqnarray}
First scale $\sigma_0$ equal to $0.66$, and 12 voices per octave.
\item Gaussian derivative wavelet transform \\
 Continuous wavelet transform. The wavelet is the first
derivative of a Gaussian
 \begin{eqnarray}
 \psi(x) =  - x e^{-\frac{1}{2}x^2}
 \end{eqnarray}
 First scale $\sigma_0$ equal to $\frac{1}{\sqrt{3}}$, and 12 voices per octave.
\item (bi-) orthogonal transform.
\item (bi-) orthogonal transform via lifting scheme.
\item Wavelet packets.
\item Wavelet packets via lifting scheme.
\item Wavelet packets using the \`a trous algorithm.
\end{enumerate}
\item {\bf [-n number\_of\_scales]} \\
Number of scales used in the multiresolution transform.
\item {\bf [-r]} \\
Rebin all scales to the input signal size
(for pyramidal transforms only).
\item {\bf [-k]} \\
Set to 0 pixels contaminated by the border problem.
\item {\bf [-T type\_of\_filters]}
{\small
\begin{enumerate}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item Antonini 7/9 filters.
\item Daubechies filter 4.
\item Biorthogonal 2/6 Haar filters.
\item Biorthogonal 2/10 Haar filters.
\item Odegard 7/9 filters.
\item User's filters.
\end{enumerate}}
Default is Antonini 7/9 filters. \\
 This option is only available if the chosen transform method is
 the (bi-) orthogonal transform (-t option in [7,15,17]).
\item {\bf [-L]} \\
Use an $L_2$ normalization. Default is $L_1$.
\item {\bf [-l type\_of\_lifting\_transform]}
{\small
\begin{enumerate}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item Lifting scheme: CDF WT.
\item Lifting scheme: median prediction.
\item Lifting scheme: integer Haar WT.
\item Lifting scheme: integer CDF WT.
\item Lifting scheme: integer (4,2) interpolating transform.
\item Lifting scheme:  Antonini 7/9 filters.
\item Lifting scheme: integer Antonini 7/9 filters.
\end{enumerate}}
 Default is Lifting scheme: integer Haar WT. \\
 This option is only available if the chosen transform method is
 the lifing scheme (-t 24).
\item {\bf [-w InfoFileName]} \\
Write in a file the size and the starting index of each band.
This file contains a 2D float array (Array[2, NbrBand+3]).
\begin{verbatim}
        info[0,0] = transform number
        info[1,0] = number of scales
        info[0,1] = transform class number (5 classes)
        info[1,1] = number of bands
                  it is not equal to the number of scales
                  for wavelet packets transform.
        info[0,2] = number of pixels
        info[1,2] = lifting scheme type
        info[0,3] = type of filter
        info[1,3] = type of normalization
        for i=4 to Number_of_bands + 3
        info[0,i] = number of pixels in the band i
        info[1,i] = position number of the pixel of the band
\end{verbatim}
If a user filter file is given (i.e. -T 6,filename), with a filename
of $L$ characters, $L$ lines are added to the array:
\begin{verbatim}
        info[1,Number_of_bands + 4] = number of characters of the filter file name
        for i=Number_of_bands+4 to  Number_of_bands+4+L-1
	info[0,i] = ascii number of the ith character.
\end{verbatim}

\end{itemize}
\subsubsection*{Examples:}
\baselineskip=0.4truecm
\begin{itemize}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item mr1d\_trans -n 7 -t 3 sig.fits image.fits \\
\`A trous algorithm with 7 scales.
\item mr1d\_trans -n 7 -T 5 -t 15 sig.fits image.fits  \\
Bi-orthogonal wavelet transform (Odegard 7/9 filters).
\item mr1d\_trans -n 7 -T 5 -t 15 -w info.fits sig.fits image.fits  \\
Ditto, but an information file is written. This information
is necessary for reconstruction.
\item mr1d\_trans -n 7 -T 5 -t 15 -w info.fits sig.fits image.fits  \\
Ditto, but an information file is written. This information
is necessary for reconstruction.
\item mr1d\_trans -n 7 -T 6,dau4 -t 15 -w info.fits sig.fits image.fits  \\
Ditto, but the filters defined in the file ``dau4.wvf'' are used instead
of the Odegard filters.
\end{itemize}

\subsection{Reconstruction: mr1d\_recons}
\index{mr1d\_recons}
Program {\em mr1d\_recons} reconstructs a signal from its transform.
To be able to reconstruct it, the program needs the information file
which has been created by the ``-w'' option during the transformation.
{\bf
\begin{center}
 USAGE: mr1d\_recons TransformFileName\_in InfoFileName\_in  signal\_out
\end{center}}
\subsubsection*{Examples:}
\begin{itemize}
\item mr1d\_trans -n 7 -t 3 -w info sig.fits image.fits \\
      mr1d\_recons image.fits info sig\_rec.fits \\
\`A trous algorithm with 7 scales, and reconstruction.
\item mr1d\_trans -n 7 -T 4 -t 15 -w info sig.fits image.fits  \\
mr1d\_recons image.fits info sig\_rec.fits \\
Bi-orthogonal wavelet transform (Odegard 7/9 filters), and reconstruction.
\end{itemize}

Reconstruction is not implemented for transforms 10, 11, and 13.
For pyramidal transforms,
the reconstruction cannot be performed by {\em mr1d\_recons} if
the rebin option ``-r'' was set.

\section{Filtering: mr1d\_filter}
\index{mr1d\_filter}
Program {\em mr1d\_filter} filters a signal using different methods.
{\bf
\begin{center}
 USAGE: mr1d\_filter option signal\_in signal\_out
\end{center}}
where options are:
\begin{itemize}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item {\bf [-f type\_of\_filtering]}
\begin{enumerate}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item  Multiresolution Hard K-Sigma Thresholding
\item Multiresolution Soft K-Sigma Thresholding
\item Iterative Multiresolution Thresholding
\item Universal Hard Thesholding
\item Universal Soft Thesholding
\item SURE Hard Thesholding
\item SURE Soft Thesholding
\item MULTI-SURE Hard Thesholding
\item MULTI-SURE Soft Thesholding
\item Median Absolute Deviation (MAD) Hard Thesholding
\item Median Absolute Deviation (MAD) Soft Thesholding
\item Total Variation + Wavelet Constraint
\end{enumerate}
Default is Multiresolution Hard K-Sigma Thresholding.
\item {\bf [-t type\_of\_multiresolution\_transform]}
\begin{enumerate}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item Linear wavelet transform: \`a trous algorithm
\item B$_1$-spline wavelet transform: \`a trous algorithm
\item B$_3$-spline wavelet transform: \`a trous algorithm
\item Derivative of a B$_3$-spline: \`a trous algorithm
\item Undecimated Haar wavelet transform: \`a trous algorithm
\item morphological median transform
\item Undecimated (bi-) orthogonal wavelet transform
\item pyramidal linear wavelet transform
\item pyramidal B$_3$-spline wavelet transform
\item pyramidal median transform
\end{enumerate}
Default is 3.
\item {\bf [-T type\_of\_filters]}
{\small
\begin{enumerate}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item Antonini 7/9 filters.
\item Daubechies filter 4.
\item Biorthogonal 2/6 Haar filters.
\item Biorthogonal 2/10 Haar filters.
\item Odegard 7/9 filters.
\item User's filters.
\end{enumerate}}
Default is Antonini 7/9 filters. \\
This option is only available if the chosen transform method is
the (bi-) orthogonal transform (-t 7).
\item {\bf [-m type\_of\_noise]}
{\small
\begin{enumerate}
\itemsep=0.1truecm
\baselineskip=0.4truecm
\item Gaussian Noise
\item Poisson Noise
\item Poisson Noise + Gaussian Noise
\item Multiplicative Noise
\item Non-stationary additive noise
\item Non-stationary multiplicative noise
\item Undefined stationary noise
\item Undefined noise
\item Stationary correlated noise
\item Poisson noise with few events
\end{enumerate}
}
Default is Gaussian noise.
\item {\bf [-g sigma]}
\item {\bf [-c gain,sigma,mean]}
\item {\bf [-E Epsilon]} \\
Epsilon = precision for computing thresholds
(only used in case of poisson noise with few events).
Default is $1e-03$.
\item {\bf [-n number\_of\_scales]}
\item {\bf [-s NSigma]}
\item {\bf [-i number\_of\_iterations]}
\item {\bf [-e epsilon]}  \\
Convergence parameter. Default is $1e-4$.
\item {\bf [-K]}  \\
Suppress the last scale. Default is no.
\item {\bf [-p]}  \\
Detect only positive structure. Default is no.
\item {\bf [-k]}  \\
Suppress isolated pixels in the support. Default is no.
\item {\bf [-S SizeBlock]} \\
Size of the  blocks used for local variance estimation. Default is 7.
\item {\bf [-N NiterSigmaClip]} \\
Iteration number used for local variance estimation. Default is 1.
\item {\bf [-F first\_detection\_scale]} \\
If this option is set, all wavelet coefficients detected at scales lower
than {\em first\_detection\_scale} are considered as significant.
\item {\bf [-G RegulParam]} \\
Regularization parameter for filtering methods 11 and 12. default is 0.01.
\item {\bf [-v]}  \\
Verbose. Default is no.
\end{itemize}

\subsubsection*{Examples:}
\begin{itemize}
\item mr1d\_filter sig.fits filter\_sig.fits \\
Filtering using the \`a trous algorithm, and a Gaussian noise model.
\item mr1d\_filter -m 2 sig.fits filter\_sig.fits   \\
Ditto, but assuming Poisson noise.
\end{itemize}

\section{Band Detection: mr1d\_detect}
\index{mr1d\_detect}

Program {\em mr1d\_detect} detects emission or absorption bands in
a spectrum \cite{starck:sta97}. The output is an image, in which each row
contains a detected band. By default, {\em mr1d\_detect} detects
both emission and absorption bands. The program gives better results
if we detect only emission (``-e" option) bands, or only absorption bands
(``-a" option). This is due to the fact that  positivity and negativity
constraints can be introduced in the iterative reconstruction for,
respectively,
emission and absorption band detection. If the user wants to
detect both kinds of band at the same time, he/she should
use the multiresolution
median transform (``-M" option) which gives in this case better results
than the wavelet transform.
{\bf
\begin{center}
 USAGE: mr1d\_detect option signal\_in tab\_band\_out
\end{center}}
where options are:
\begin{itemize}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item {\bf [-n number\_of\_scales]}
\item {\bf [-s NSigma]}
\item {\bf [-m type\_of\_noise]}
{\small
\begin{enumerate}
\baselineskip=0.4truecm
\itemsep=0.1truecm
\item Gaussian Noise
\item Poisson Noise
\item Poisson Noise + Gaussian Noise
\item Multiplicative Noise
\item Non-stationary additive noise
\item Non-stationary multiplicative noise
\item Undefined stationary noise
\item Undefined noise
\end{enumerate}
}
Description in section~\ref{sect_filter}. Default is Gaussian noise.
\item {\bf [-g sigma]}
\item {\bf [-c gain,sigma,mean]}
\item {\bf [-a]} \\
Detection of Absorption lines only. Default is not to do this.
\item {\bf [-e]} \\
Detection of Emission lines only. Default is not to do this.
\item {\bf [-f FirstScale]} \\
First scale. Default is 1. All bands detected at the scale smaller than
{\em FirstScale} are not reconstructed.
\item {\bf [-l LastScale]} \\
Last scale. Default is number\_of\_scales -- 2.
All bands detected at the scale higher than {\em LastScale} are not reconstructed.
\item {\bf [-i IterNumber]} \\
Number of iterations for the reconstruction. Default is 20.
 \item {\bf [-M]} \\
Use the multiresolution median transform
instead of the \`a trous algorithm. If this option is set, the reconstruction
is not iterative, and the previous option (``-i") is not active.
\item {\bf [-A ]} \\
Detect only negative multiresolution coefficients. Default is no.
\item {\bf [-E ]} \\
Detect only positive multiresolution coefficients. Default is no.
\item {\bf [-w ]} \\
Write two other files:
\begin{itemize}
\item tabadd.fits: sum of the reconstructed objects. All detected bands are co-added.
\item tabseg.fits: segmented wavelet transform.
\end{itemize}
\item {\bf [-v ]} \\
Verbose. Default is no.
\end{itemize}

\subsubsection*{Examples:}
\begin{itemize}
\item mr1d\_detect -a -A sig.fits band\_sig.fits \\
Detection using the \`a trous algorithm, and a Gaussian noise model.
The detection is performed from the positive wavelet coefficients, and
only emission bands are reconstructed.
\item mr1d\_detect -m 2 -a -A -s 5 sig.fits band\_sig.fits   \\
Ditto, but assuming Poisson noise and a five sigma detection.
\end{itemize}

\begin{figure}[htb]
\centerline{
\vbox{
\hbox{
\psfig{figure=ch4_sig10_wid02.ps,bbllx=1.5cm,bblly=19cm,bburx=20cm,bbury=25.5cm,height=5cm,width=16cm,clip=}}
\hbox{
\psfig{figure=ch4_extr_simu3.ps,bbllx=1.5cm,bblly=13cm,bburx=20cm,bbury=25.5cm,height=10cm,width=16cm,clip=}}
}}
\caption{Simulation: top, simulated spectrum,
middle, reconstructed simulated band (full line) and original band (dashed line). Bottom,
simulated spectrum minus the reconstructed band.}
\label{fig_detect_spect}
\end{figure}

A simulated spectrum was created containing a smooth continuum
with superimposed, variable Gaussian noise and an emission band at $3.50\mu$m
with a maximum of five times the local noise standard
deviation and a width of
FWHM = $0.01 \mu$m (see Figure~\ref{fig_detect_spect} top).
Figure~\ref{fig_detect_spect}
(middle) shows the comparison of the
reconstructed emission band with the original Gaussian.
Figure~\ref{fig_detect_spect} (bottom) shows the  difference between
the simulated spectrum and the reconstructed band.

\section{Modulus Maxima Representation}
\subsection{Modulus maxima detection: mr1d\_max}
\index{mr1d\_max}
Program {\em mr1d\_max} detects the modulus maxima using the dyadic
  \`a trous algorithm  with the wavelet function equal to the derivative
of a B-spline (transform number 4 in {\em mr1d\_trans}).
{\bf
\begin{center}
 USAGE: mr1d\_max option signal\_in  output
\end{center}}
where options are:
\begin{itemize}
\item {\bf [-n number\_of\_scales]}
\item {\bf [-v ]} \\
Verbose. Default is no.
\end{itemize}
\subsubsection*{Example:}
\begin{itemize}
\item mr1d\_max sig.fits band\_sig.fits   \\
Modulus maxima detection.
\end{itemize}

\subsection{Reconstruction: mr1d\_maxrecons}
\index{mr1d\_maxrecons}
Program {\em mr1d\_maxrecons} reconstructs a signal from its modulus maxima.
{\bf
\begin{center}
 USAGE: mr1d\_maxrecons option tab\_band\_in signal\_out
\end{center}}
where options are:
\begin{itemize}
 \item {\bf [-i number\_of\_iterations]}  \\
Maximum number of iterations for the reconstruction. Default is 10.
\item {\bf [-v ]} \\
Verbose. Default is no.
\end{itemize}
\subsubsection*{Example:}
\begin{itemize}
\item mr1d\_max sig.fits band\_sig.fits   \\
      mr1d\_maxrecons band\_sig.fits sig\_rec.fits \\
Modulus maxima detection, and reconstruction from the maxima.
\end{itemize}