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

\section{GW energy}

\marginpar{Monday\\ 2021-5-17, \\ compiled \\ \today}

Because of the equivalence principle, there can be no local definition of energy density or of a stress-energy tensor for \(g_{\mu \nu }\).

However, we can define the Landau-Lifshitz pseudotensor (which is actually a tensor density): from the gothic metric
%
\begin{align}
\mathfrak{g}^{\alpha \beta } = \sqrt{-g } g^{\alpha \beta }
\,
\end{align}
%
we define
%
\begin{align}
\Lambda^{\alpha \mu \beta \nu } = \mathfrak{g}^{\alpha \beta } \mathfrak{g}^{\mu \nu } - \mathfrak{g}^{\alpha \nu } \mathfrak{g}^{\beta \mu }
\,,
\end{align}
%
a four-tensor density which has the same symmetries as the Riemann tensor.
Also, we have the properties that
%
\begin{align}
\partial_{\mu } \partial_{\nu } \Lambda^{\alpha \mu \beta \nu } = 2 (-g) G^{\alpha \beta } + 16 \pi (-g) \tau^{\alpha \beta }_{LL}
\,,
\end{align}
%
where \(G^{\alpha \beta }\) is the Einstein tensor, while \(\tau_{LL}\) (defined to contain whatever remains) is called the Landau-Lifshitz tensor: this can also be expressed as
%
\begin{align}
\partial_{\mu } \partial_{\nu } \Lambda^{\alpha \mu \beta \nu } =
16 \pi (-g) \qty(T^{\alpha \beta } + \tau_{LL}^{\alpha \beta })
\,.
\end{align}

If we take a further derivative with respect to \(\alpha \), in a vacuum, we find
%
\begin{align}
\partial_{\alpha } \partial_{\mu } \partial_{\nu } \Lambda^{\alpha \mu \beta \nu } = \partial_{\alpha } \tau_{LL}^{\alpha \beta } = 0
\,,
\end{align}
%
where the last equality is due to the symmetries of \(\Lambda \). Therefore, the tensor \(\tau_{LL}\) is conserved, and we can try to interpret it as the ``energy of the gravitational field''.

In normal coordinates at any given point \(\tau_{LL}\) is identically zero.

A global concept of energy does not exist for certain spacetimes --- see ADM and the Hamiltonian formulation of GR.

However, asymptotically flat spacetimes have some nice properties.

If we foliate a spacetime \((M, g)\) into 3D spacelike hypersurfaces \(\Sigma \), we say it is asymptotically flat if the reduced metric \(\gamma_{ij} \to f_{ij}\) tends towards the Minkowski metric at radial infinity.

In this case, we can associate an energy to \(\Sigma \).
Using these concepts, there is hope to identify some quantity which represents GW energy.

We explore directions at infinity which are \textbf{asymptotically null}, and suppose that at \(\Sigma_{t_{1, 2}}\) we have stationary states, with dynamics in between.

Then, if there is a difference of energy \(\Delta E = E_2 - E_1 \), we expect there to be a flux of ``some \(\tau_{\mu \nu }\)'' from the surface.

We can work in linearized theory: \(g = f + h\).
The characteristics we expect a definition of energy to have are, at the very least
\begin{enumerate}
    \item quadratic in \(h\),
    \item generate curvature via a stress-energy tensor \(\tau_{\alpha \beta }\),
    \item gauge invariant under infinitesimal coordinate transformations.
\end{enumerate}

We start by specifying the \(LL\) tensor to the weak field case.
The metric reads \(g = \eta + h^{(1)} + h^{(2)} + \order{3}\), where by the indices in parentheses we mean orders in some expansion parameter.

The Ricci reads
%
\begin{align}
R_{\mu \nu } =
R_{\mu \nu }^{(0)} +
R_{\mu \nu }^{(1)} +
R_{\mu \nu }^{(2)} +
\order{3}
\,.
\end{align}

Now, \(R_{\mu \nu }^{(0)} = (\text{Ric}[\eta ])_{\mu \nu } \sim \eta \partial^2 \eta  = 0\), but if we had a non-flat background this would not hold.
On the other hand,
%
\begin{align}
R^{(1)}_{\mu \nu } = \qty(\text{Ric}^{(1)}[h^{1}])_{\mu \nu } \sim \eta \partial^2 h^{(1)}
\,,
\end{align}
%
where \(\text{Ric}^{(i)}\) is the Ricci operator expanded up to \(i\)-th order. This is relevant in the second-order term:
%
\begin{align}
R^{(2)}_{\mu \nu } =
\qty(\text{Ric}^{(1)} [ h^{(2)}])_{\mu \nu }
\qty(\text{Ric}^{(2)} [ h^{(1)}])_{\mu \nu }
\sim
\eta \partial^2 h^{(2)} + h^{(1)} \partial^2 h^{(1)}
\,.
\end{align}

Then, the EFE in vacuo read
%
\begin{align}
0 =
R^{(0)}_{\mu \nu } +
R^{(1)}_{\mu \nu } +
R^{(2)}_{\mu \nu } +  \order{3}
\,,
\end{align}
%
therefore to order 0 we have the \(\eta \) metric; to order \(1\) we can calculate \(h^{(1)}\), while to order \(2\) we can assume the \(h^{(1)}\) metric is already calculated and solve \(R^{(2)}_{\mu \nu } = 0\) for \(h^{2}\).

The second order equation reads
%
\begin{align}
G^{(1)}_{\mu \nu }[h^{(2)}] &= \qty(\text{Ric}^{(1)}[h^{2}] - \frac{1}{2} R^{(1)} [h^{2}]\eta )_{\mu \nu }  \\
&=\qty(- \text{Ric}^{(2)} [h^{1}] + \frac{1}{2} R^{(2)}[h^{1}] \eta )_{\mu \nu }   \\
&\overset{?}{=} 8 \pi \tau_{\mu \nu }
\,,
\end{align}
%
but can this actually be our GW stress-energy tensor? It is symmetric, it is quadratic in \(h\), and due to the Bianchi identities it is also conserved.
However, it is not gauge invariant, and it is not unique!

If \(h^{(1)}\) is \textbf{asymptotically flat}, then \(h \sim \order{1/r}\), \(\partial_{i} h \sim \order{1/r^2}\) and \(\partial_{i} \partial_{j} h \sim \order{1/r^3}\).

In this case, \(E = \int_{\Sigma } \dd[3]{x} \tau_{00} \) is both \textbf{gauge invariant} and \textbf{unique}: \(E[h_{\mu \nu } + 2 \partial_{(\mu } \xi_{\nu )}] = E[h_{\mu \nu }]\).

We can then write an energy flux in the form
%
\begin{align}
\Delta E = -\int_{S} \dd[2]{y} \tau_{\mu 0} n^\mu
\,,
\end{align}
%
across a surface \(S\) which determines the spatial boundary of \(\Sigma \) over time.

Weak-field GR can be interpreted as a field theory on \(\eta \) for the field \(h\).

Physically speaking, it is true that we can ``eliminate'' the gravitational field at a point, but here we are more interested in the following question:
can the GW in a neighborhood of that point contribute to the curvature via a gauge invariant tensor?

The issue comes down to: what is the distinction between ``waves'' and background?

One can prove that a suitable average of \(\text{Ric}^{(2)}[h^{(1)}]\) is actually gauge-invariant: this is the \textbf{Isaacson tensor},
%
\begin{align}
\tau_{\alpha \beta } = \frac{c^{4}}{32 \pi G} \expval{\partial_{\mu } h_{\alpha \beta } \partial_{\nu } h^{\alpha \beta }}
\,,
\end{align}
%
due to the fact that \(\text{Ric}^{(2)}[h] \sim h \partial \partial h + \partial h \partial h + \partial (h \partial h)\).

Let us take the derivative \(\partial_{\mu} \tau^{\mu \nu }\):
%
\begin{align}
\int_{V} \dd[3]{x} \qty(\partial_0 \tau^{00} + \partial_{i} \tau^{0i})
&= \dot{E} + \oint_{S} \dd[2]{y} \tau_{0i} n^i  \\
&= \dot{E} + r^2 \oint \dd[2]{y} \expval{\partial^{0} h_{ij} \partial_{r} h^{ij}}
\,,
\end{align}
%
which yields the quadrupole formula:
%
\begin{align}
\dv{E_{GW}}{t} &= \frac{c^3}{32 \pi G} r^2 \int \dd{\Omega } \expval{\partial_{t} h_{ij}^{TT} \partial_{t} h_{ij}^{TT}}  \\
&= \frac{G}{5 c^{5}}\expval{ \dot{\ddot{Q}}_{ij} \dot{\ddot{Q}}^{ij}}
\,.
\end{align}

Let us look at some dimensional analysis:
%
\begin{align}
[Q] &= a ML^2  \\
[\dot{\ddot{Q}}] &= a ML^2 T^{-3} \sim a \Omega^3 M L^2 = E^2 T^{-2}\\
[ \frac{G}{c^{5}}] &= T E^{-1}
\,.
\end{align}
%
The factor \(G / c^{5}\) is the inverse of a power: \(c^{5} / G \approx \SI{e52}{W}\), a very large power, and we are dividing by it.
This suggests a potential rewriting of the formula, which was an idea of Weber's:
%
\begin{align}
\dot{E} \sim \frac{G}{c^{5}} a^2 \Omega^{6} M^2 R^{4} = \dots
= a^2 \frac{c^{5}}{G} \qty( \frac{v}{c})^{6} \frac{GM}{c^2 R}
\,.
\end{align}

The power is therefore huge if \(v \sim c\) and \(R \sim R_S\)!

The above formula for \(\dot{E}\) is \emph{correct} for a leading-order description of a binary system, if we take \(a^2 = 32/5\), \(\Omega \) to be the orbital frequency, \(M\) to be \(\mu \) (the reduced mass), and \(R\) the orbital radius. So,
%
\begin{align}
\dot{E} = \frac{32}{5} \frac{G \mu^2}{c^{5}} R^{4} \Omega^3
\,.
\end{align}

Of course, \(\dot{E} _{\text{orbital energy}} = - \dot{E} _{\text{gw}}\).

\end{document}


\documentclass{article}
\usepackage[section]{placeins}
\usepackage{graphicx, wrapfig, amsmath, amssymb, physics, hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,
    urlcolor=cyan,
    }

\author{Yaghoub Shahmari}
\title{Report - Problem Set No 6}
\date{\today}
\graphicspath{ {../Figs/} }

\begin{document}
    \maketitle
    \section*{Problem 1}
    \textbf{Basic description:}

    In this problem, we're going to find the answer to the integral of a function.
    So we will follow the instructions introduced by the book.
    We will deploy both methods of the Monte Carlo algorithm for solving an integration.
    As the problem told us:

    $$f_{(x)} = \int e^{-x^2} \mathop{dx} \Rightarrow I = \int_0^2 e^{-x^2} \mathop{dx} = \frac{\sqrt{\pi}}{2} \mathrm{erf}_{(2)}$$

    We solved the integration for different amounts of samples for both methods
    and showed the benchmark result of each one in the notebook (Q1-1DInt.ipynb).
    We also showed the distribution of answers for both methods.
    And finally, we will show the answers, errors, and performance for each amount of samples.

    \textbf{The results:}

    \begin{figure}[!htb]
        \centering
        \includegraphics[scale = 0.25]{/Q1/IMCVilPlot}
        \label{fig:1.1}
        \includegraphics[scale = 0.25]{/Q1/SMCVilPlot}
        \label{fig:1.2}
        \caption{Distribution of answers for both methods.}
    \end{figure}

    \begin{figure}[!htb]
        \centering
        \includegraphics[scale = 0.42]{/Q1/MCAnswerPlot}
        \label{fig:1.3}
        \includegraphics[scale = 0.42]{/Q1/MCErrorPlot}
        \label{fig:1.4}
        \includegraphics[scale = 0.42]{/Q1/MCPerformPlot}
        \label{fig:1.5}
        \caption{Plot of answers, errors, and performance for both methods.}
    \end{figure}

    \pagebreak

    \section*{Problem 2}
    \textbf{Basic description:}

    In this problem, we want to find the center of mass of
    a sphere whit specific mass distribution.
    So we have to find the answer to a 2D integration.
    As we know:

    $$R_{CoM} = \frac{I}{M} \Rightarrow R_{CoM} = \frac{\int_{Sphere} z \rho dV}{\int_{Sphere} \rho dV},\ \rho = \rho_0 (3 + \frac{r}{R} \cos{\theta}) \Rightarrow$$
    $$ R_{CoM} = \frac{\int_0^R\int_0^\pi (3+\frac{r}{R}\cos{\theta})r^3\sin{\theta}\cos{\theta} d\theta dr}{\int_0^R\int_0^\pi (3+\frac{r}{R}\cos{\theta})r^2\sin{\theta} d\theta dr}$$

    That has the exact answer of $R_{CoM} = \frac{R}{15}$.
    We drew the distribution of a bunch of answers.
    Also, we calculated the values of errors.
    The final answer is $R_{CoM} = 0.0665806190158467$.
    All steps and values are available in the notebook.

    \textbf{The results:}

    \begin{figure}[!htb]
        \centering
        \includegraphics[scale = 0.25]{/Q2/IHistPlot}
        \label{fig:2.1}
        \includegraphics[scale = 0.25]{/Q2/MHistPlot}
        \label{fig:2.2}
        \caption{Distribution of answers of integration of I and M.}
    \end{figure}

    \pagebreak

    \section*{Problem 3}
    \textbf{Basic description:}

    In this problem, we want to create the Normal distribution
    by moving samples of the Uniform distribution in a span
    with various chances of movement and deploying the Metropolis algorithm.
    As we know the best distribution comes out with $a_r \approx 0.5$.
    So we draw a distribution with $a_r \approx 0.5$.
    Then, we will show the relation between $\Delta$ and $a_r$.
    And finally, we will show the Auto Correlation and Correlation length.
    The Correlation length will come out by finding the exponent of the Auto Correlation.

    \textbf{The results:}

    \begin{figure}[!htb]
        \centering
        \includegraphics[scale = 0.4]{/Q3/NormalHist}
        \label{fig:3.1}
        \caption{Metropolis Normal Distribution with $a_r \approx 0.5$.}
    \end{figure}

    \begin{figure}[!htb]
        \centering
        \includegraphics[scale = 0.4]{/Q3/AcceptanceRatio}
        \label{fig:3.2}
        \caption{Acceptance Ratio plot.}
    \end{figure}

    \begin{figure}[!htb]
        \centering
        \includegraphics[scale = 0.3]{/Q3/Autocorrelation1}
        \label{fig:3.3}
        \includegraphics[scale = 0.3]{/Q3/Autocorrelation2}
        \label{fig:3.4}
        \includegraphics[scale = 0.3]{/Q3/CorrelationLength}
        \label{fig:3.5}
        \caption{Auto correlation and Correlation Length Plot.}
    \end{figure}

    \pagebreak

    \centering
    \textbf{The whole data I gathered is in \href{https://github.com/shahmari/ComputationalPhysics-Fall2021/tree/main/ProblemSet7/Data}{this link}}

    Thanks for watching :)
\end{document}


\section{Matching Features}\label{sec:match-feat}

In order to support alphabet-based laws and definitions,
we introduce the notion of ``list variables'',
that match against zero or more variables satisfying some property.
These list-variables encode simple expressions that give
some flexibility in how they match.
We further classify as follows:
\begin{description}
  \item[Reserved:]  $O$, $M$, $S$
  \item[Generic:] $\lst v$, $\lst e$, \ldots (lowercase)
\end{description}
Here are some examples of laws that require this list-matching facility:
\begin{description}
%
\item[Sequential Composition]
$$
  P ; Q ~\defs~ \exists O_m \bullet P[O_m/O'] \land Q[O_m/O]
$$
Here the $O$ list-variable matches all the undecorated
observation variables., i.e. the alphabet, of the theory.
In practise we also need a side condition that says all the $O_m$
are fresh --- we don't want to rely on $P$ and $Q$ only having free variables
in that alphabet.
The idea is that \texttt{O}, \texttt{M} and \texttt{S} are reserved-variable root strings that
correspond to $O$, $M$ and $S$, respectively.
%
\item[Assignment]
$$
  x := e ~\defs~ ok \implies ok' \land x' = e
    \land S'\less x = S\less x
$$
List-variable $S$ refers to all the program or user variables,
those that appear explicitly in the programming notation (script) under study.
This are different from the model variables (often referred to as
``auxiliary''), denoted by $M$ that capture observable aspects
of system behaviour beyond what can be expressed with just the $S$
values. Examples of variables in $M$ include $ok$, $wait$, $tr$, etc.
The expression $S'\less x = S\less x$
denotes the conjunction of identities of the form $v'=v$
where $v \in S\setminus\setof x$.
If $x$ is an observation variable
then the above law only works for that variable,
and in fact could be expanded out (given $S$)
to an explicit law for that variable.
If $x$ is not an observation variable,
then it should be a ``variable-variable'',
and typically we cannot complete the match of $S\less x$
until
other context information tells us to which variables $x$ must match.
\par
We can have more than one subtracted variable:
$$
  x,y := e,f ~\defs~ ok \implies ok' \land x' = e \land y'=f
    \land S'\less{x,y} = S\less{x,y}
$$
\item[Simultaneous Assignment]
Way more than just two subtracted variables!
\begin{eqnarray*}
  \lefteqn{x_1,\ldots,x_n ::= e_1, \ldots , e_n}
\\ &=& \lst x := \lst e
\\ &\defs&
     ok \implies ok'
     \land x'_1 = e_1 \land \ldots \land x'_n = e_n
     \land S'\less{x_1,\ldots,x_n} = S\less{x_1,\ldots,x_n}
\\ &=& ok \implies ok'
    \land \lst x' = \lst e
    \land S'\less{\lst x} = S\less{\lst x}
\end{eqnarray*}
In the mathematical form, we use indices and ellipsis
to suggest that we have lists of variables and expressions
of the same length.
\item[Skip]
\begin{eqnarray*}
  \Skip &\defs& ok \implies ok' \land S'=S
\end{eqnarray*}
A simple form of a simple simultaneous assignment!
\end{description}

From the above examples,
a number of general observations can be made:
\begin{itemize}
  \item
    All list-variables match against lists of things (zero or more).
    This means they can only occur in certain places:
    \begin{itemize}
      \item quantifier binding variable lists
      \item replacement/target lists in substitutions
       \item in 2-place (atomic) predicates, provided both places
        are occupied by a single meta-variable.
    \end{itemize}
  \item
    A predicate involving two list-variables mandates that both
    match lists of the same size, and the predicate
    is interpreted as the \emph{conjunction} of instances of that predicate
    over corresponding pairs from the match-list.
    It can also match a single such predicate also using two list-variables.
  \item
    Some list-variables ($O$, $S$, $M$)
    denote specific sets of variables.
    The matching rules for these differ from those for regular variables,
    in that $O$ and $O'$ can only match themselves or their expansions,
    while $O_a$ and $O_b$ can match with a binding---subscript decorations
    are viewed as general patterns, and are not considered ``known''.
  \item
    Other list-variables  ($x_1$, $e_1$, \ldots)
    are local names used as general placeholder.
    These simply match all the variables/ expressions /whatever
    that occur in the relevant position.
  \item
    These list-variables won't only appear in match patterns,
    but could also appear in test/goal predicates,
    so we could imagine the following predicate fragment:
    $$
       \exists ok_m,S_m \bullet \ldots
    $$
    matching against a similar fragment from the definition of
    sequential composition:
    $$
      \exists O_n \bullet \ldots
    $$
    Here the match binding would include
    $O_n \mapsto \setof{ok_m} \cup S_m$.
  \item
    The reserved list-variables are \emph{precise},
    in the sense that on any given matching context,
    they match a known fixed collection of variables
    (so there shouldn't be a need in most cases to defer a match).
    An exception is in a generic theory that has no specific observation
    variables defined, when these list-variables can only match
    themselves, and $O$ being able to match $S,M$.
\end{itemize}


\vssub
\subsection{~Non-ice source term integration} \label{sub:source}
\vssub

The source terms not involving ice are accounted for by solving

%---------------------%
% Step : Source terms %
%---------------------%
% eq:step_source

\begin{equation}
\frac{\p N}{\p t} = \cS_{no~ice} \: . \label{eq:step_source}
\end{equation}

\noindent
As in \wam, a semi-implicit integration scheme is used. In this scheme the
discrete change of action density $\Delta N$ becomes \citep{art:WAM88}

% eq:implicit_st

\begin{equation}
\Delta N(k,\theta) = \frac{\cS(k,\theta)}{1- \epsilon D(k,\theta)\Delta t}
\: , \label{eq:implicit_st} \end{equation}

\noindent
where $D$ represents the diagonal terms of the derivative of $\cS$ with
respect to $N$ \citep[Eqs. 4.1 through 4.10]{art:WAM88}, and where $\epsilon$
defines the offset of the scheme. Originally, $\epsilon = 0.5$ was implemented
to obtain a second-order accurate scheme. Presently, $\epsilon = 1$ is used because it is more appropriate for the large time steps in the equilibrium range of
the spectrum \citep{pro:HA98,art:HA01} and it results in much smoother
integration of the spectrum. The change of $\epsilon$ has little impact on
mean wave parameters, but makes the dynamical time stepping as described below
more economical.

The semi-implicit scheme is applied in the framework of a dynamic
time-stepping scheme \citep{tol:JPO92}. In this scheme, integration over the
global time step $\Delta t_g$ can be performed in several dynamic time steps
$\Delta t_d$, depending on the net source term $\cS$, a maximum change of
action density $\Delta N_m$ and the remaining time in the interval $\Delta
t_g$. For the $n^{\rm th}$ dynamic time step in the integration over the
interval $\Delta t_g$, $\Delta t_d^n$ is calculated in three steps as

% ------ Dynamic s.t. int. scheme ------- %
% eq:st_d_1
% eq:st_d_2a
% eq:st_d_2b
% eq:st_d_3

\begin{equation}
\Delta t_d^n =
\min_{f<f_{hf}} \left [ \frac{\Delta N_m}{|\cS|}
\left ( 1 + \epsilon D \frac{\Delta N_m}{|\cS|} \right ) ^{-1}
\right ] \: , \label{eq:st_d_1}
\end{equation} \begin{equation}
\Delta t_d^n = \max \: \left [ \: \Delta t_d^n \: , \:
\Delta t_{d,\min} \right ] \: , \label{eq:st_d_2a}
\end{equation} \begin{equation}
\Delta t_d^n = \min \: \left [ \: \Delta t_d^n \: , \:
\Delta t_g - \sum_{i=1}^{n-1} \Delta t_d^i
 \: \right ] \: , \label{eq:st_d_2b}
\end{equation}

\noindent
where $\Delta t_{\min}$ is a user-defined minimum time step, which is added to
avoid excessively small time steps. The corresponding new spectrum $N^n$
becomes

\begin{equation}
N^n = \max\: \left [ \: 0 \: , \: N^{n-1} +
\left ( \frac{\cS \Delta t_d}{1 - \epsilon D \Delta t_d} \right )
\: \right ] \: . \label{eq:st_d_3}
\end{equation}

The maximum change of action density $\Delta N_m$ is determined from a
parametric change of action density $\Delta N_p$ and a filtered relative
change $\Delta N_r$

% eq:st_d_4
% eq:st_d_5
% eq:st_d_6
% eq:st_d_7

\begin{equation}
\Delta N_m (k,\theta) = \min \: \left [ \:
\Delta N_p (k,\theta) \: , \: \Delta N_r (k,\theta)
\: \right ] \: , \label{eq:st_d_4}
\end{equation} \begin{equation}
\Delta N_p (k,\theta) = X_p \: \frac{\alpha}{\pi} \:
\frac{(2\pi)^4}{g^2} \: \frac{1}{\sigma k^3}
\: , \label{eq:st_d_5}
\end{equation} \begin{equation}
\Delta N_r (k,\theta) = X_r \; \max \: \left [ \:
N(k,\theta) \: , \: N_f \: \right ] \: , \label{eq:st_d_6}
\end{equation} \begin{equation}
N_f = \max \: \left [ \: \Delta N_p (k_{\max},\theta) \: ,
\: X_f \: \max_{\forall k,\theta} \left \{ N(k,\theta) \right \}
\: \right ] \: , \label{eq:st_d_7} \end{equation}

\noindent
where $X_p$, $X_r$ and $X_f$ are user-defined constants (see
Table~\ref{tab:st_d_p}), $\alpha$ is a {\sc pm} spectrum energy level (set to $\alpha =
0.62\times 10^{-4}$) and $k_{\max}$ is the maximum discrete wavenumber. The
parametric spectral shape in (\ref{eq:st_d_5}) corresponds in deep water to
the well-known high-frequency shape of the one-dimensional frequency spectrum
$F(f) \propto f^{-5}$. The link between the filter level and the maximum
parametric change in (\ref{eq:st_d_7}) is used to assure that the dynamic time
step remains reasonably large in cases with extremely small wave energies. A
final safeguard for stability of integration is provided by limiting the
discrete change of action density to the maximum parametric change
(\ref{eq:st_d_5}) in conditions where Eq.~(\ref{eq:st_d_2a}) dictates $\Delta
t_d^n$. In this case Eq.~(\ref{eq:st_d_2a}) becomes a limiter as in the WAM
model. Impacts of limiters are discussed in detail in for instance
\cite{art:HJ99,art:HJ01}, \cite{art:HA01} and \cite{tol:GAOS02}.

% tab:st_d_p

\begin{table}
\begin{center} \begin{tabular}{|l|c|c|c|c|} \hline \hline
                 & $X_p$     & $X_r$             & $X_f$ &
$\Delta t_{d,\min}$      \\ \hline
\wam\ equivalent & $\frac{\pi}{24}10^{-3}\Delta t$
 & $\infty (\geq 1)$ & --    & $\Delta t_g$  \\
 suggested       & 0.1-0.2  & 0.1-0.2 & 0.05 & $\approx 0.1 \Delta t_g$ \\
default setting  &  0.15    &   0.10  & 0.05 & -- \\ \hline \hline
\end{tabular} \end{center}
\caption{User-defined parameters in the source term integration
 scheme}
\label{tab:st_d_p} \botline \end{table}

The dynamic time step is calculated for each grid point separately, adding
additional computational effort only for grid points in which the spectrum is
subject to rapid change. The source terms are re-calculated for every dynamic
time step.

It is possible to compile \ws\ without using a linear growth term. In such a
case, waves can only grow if some energy is present in the spectrum. In
small-scale applications with persistent low wind speeds, wave energy might
disappear completely from part of the model. To assure that wave growth can
occur when the wind increases, a so-called seeding option is available in \ws\
(selected during compilation). If the seeding option is selected, the energy
level at the seeding frequency $\sigma_{\rm seed} = \min(\sigma_{\max}, 2\pi
f_{hf})$ is required to at least contain a minimum action density

% ------ Spectral seeding ------- %
% eq:seed

\begin{eqnarray}
N_{\min}(k_{seed},\theta) & = &
        6.25 \times 10^{-4} \frac{1}{k_{\rm seed}^3 \: \sigma_{\rm seed}}
        \max \left [ \: 0. \: , \: \cos^2 ( \theta - \theta_w ) \right ]
                             \nonumber \\ & & \hspace{5mm}
        \min \left [ \: 1 \: , \: \max \left ( \: 0 \: , \:
        \frac{|u_{10}|}{X_{\rm seed} g \sigma_{\rm seed}^{-1}}-1
\: \right ) \: \right ] \: , \label{eq:seed} \end{eqnarray}

\noindent
where $g \sigma_{\rm seed}^{-1}$ approximates the equilibrium wind speed for
the highest discrete spectral frequency. This minimum action distribution is
aligned with the wind direction, goes to zero for low wind speeds, and is
proportional to the integration limiter (\ref{eq:st_d_5}) for large wind
speeds. $X_{\rm seed} \geq 1$ is a user-defined parameter to shift seeding to
higher frequencies. Seeding starts if the wind speed reaches $X_{\rm seed}$
times the equilibrium wind speed for the highest discrete frequency, and
reaches its full strength for twice as high wind speeds. The default model
settings include the seeding algorithm, with $X_{\rm seed} = 1$.

In model version 3.11, surf-zone physics parameterizations have been
introduced. Such physics, particularly depth-induced breaking, operate on much
smaller time scales than deep water and limited-depth physics outside the surf
zone. To assure reasonable behavior for larger time steps, an additional
optional limiter has been adopted from the SWAN model, which can be used instead of
modeling surf-breaking explicitly.  This limiter is similar to the Miche
style maximum wave height in the depth-limited wave breaking source term of
Eq.~(\ref{eq:BJ78_Miche}). In this limiter, the maximum wave energy $E_m$ is
computed as

% ------ Surf zone limiter ------ %
% eq:MLIM

\begin{equation}
E_m = \frac{1}{16} [ \gamma_{lim}  \tanh ( \bar{k} d ) / \bar{k} ] ^2
\:\:\: , \label{eq:MLIM}
\end{equation}

\noindent
where $\gamma_{lim}$ is a factor comparable to $\gamma_M$ in
Eq.~(\ref{eq:BJ78_Miche}), with the caveat that $\gamma_M$ is representative
for an individual wave, whereas $\gamma_{lim}$ is representative for the
significant wave height. For monochromatic waves, the original expression by
\cite{art:Miche44} would correspond to $\gamma_{lim} = 0.94$ and replacing
$H_s$ by the height $H$ of the waves. Here this idea is applied to random
waves.  In shallow water, this limits $H_s$ to be less than $\gamma_{lim} d$.
If the total spectral energy $E$ is larger than the maximum energy $E_m$, the
limiter is applied by simply rescaling the spectrum by the factor $E/E_m$,
loosely following the argumentation from \cite{art:EB96} and used
in \para\ref{sec:DB1}.

This limiter can be switched on or off in the
compilation of the model, and $\gamma_{lim}$ can be adjusted by the user. The
default is set to $\gamma_{lim} = 1.6$ because $H_{rms}$ values close to $d$
have indeed been recorded and thus taking a ratio $H_s/H_{rms}$ of 1.4, using
1.6 allows this large steepness to be exceeded by some margin.  Note that this
limiter should be used as a `safety valve' only, and hence that it should be
less strict than the breaking criterion in the surf-breaking or whitecapping
source terms, if these source terms are modeled explicitly.

Also, this limiter does not guarantee that all parts of the spectrum are
realistic. Indeed, the use of a mean wavenumber, as in the Komen et
al. dissipation, makes it possible to have unrealistically steep short waves
in the presence of swell. A future extension of this limiter could be to limit
the steepness with a partial spectral integration in frequencies, to make sure
that waves of all scales are indeed not too steep.

\vssub
\subsection{~Ice source terms integration} \label{sub:icesource}
\vssub

Because the attenuation and scattering in the ice can be very strong (although they are linear), it is convenient
to perform a separate integration of the ice terms $S_{\mathrm{ice}}=S_{\mathrm{id}}+S_{\mathrm{is}}$. This combines
a dissipation term
\begin{equation}
S_{\mathrm{id}}/\sigma  = \beta_{\mathrm{id}} N ,
\end{equation}
 and a scattering term
which is of the form
\begin{equation}
 \frac{S_{\mathrm{is}}(k,\theta)}{\sigma} =  \int_0^{2\pi}\beta_{\mathrm{is}} [N(k,\theta')-N(k,\theta)] d\theta'  ,
 \end{equation}
 in which the scattering coefficient $\beta_{\mathrm{is}}$ is a priori a function of the difference in direction between
 incident $\theta'$ and scattered $\theta$ directions, as well as the shape of ice floes. In general
  the directional spectrum $N(k,.)$ is a vector with {\F NTH} (number of directions) components,
and the source term is a vector of the same size  given by the matrix product $S/\sigma = M N(k,.)$ where
$M$ is a positive symmetric square {\F NTH} by {\F NTH} matrix with components given from the $\beta_{\mathrm{id}}$ values.
The matrix $M$ is easily diagonalized as
\begin{equation}
 M  =  V D V^T  ,
 \end{equation}
 where $D$ is a diagonal matrix containing all eigenvalues and $V$ is the array of eigenvectors,
 and $V^T$ is its transpose. As a result the split wave action equation for ice source terms
 \begin{equation}
\frac{\p}{\p t} \frac{N}{c_g}   = \frac{S_{\mathrm{id}}}{\sigma c_g} ,
 \end{equation}
 can be rewritten for the action $N_i$ of each eigenvector $V_i$ with eigenvalue $\lambda_i$ as
  \begin{equation}
\frac{\p}{\p t} \frac{N_i}{c_g}   = \frac{\beta_{\mathrm{id}} + \lambda_i}{\sigma c_g} N_i ,
 \end{equation}
 which has the following exact solution
   \begin{equation}
 {N_i}(t+\Delta t_g)   = N_i(t) \exp \left[ (\beta_{\mathrm{id}} + \lambda_i) +\Delta t_g\right].
 \end{equation}

 In all cases the eigenvector corresponding to an isotropic spectrum has an eigenvalue $\lambda=\beta_{\mathrm{id}}$.
 In the case of an isotropic back-scatter, the other eigenvalues are all equal to $(\beta_{\mathrm{id}} + \beta_{\mathrm{is}})$.
 This decomposition over the two eigenspaces simplifies the solution to
%---------------------%
% Step : Source terms %
%---------------------%
% eq:exact_st_ice
\begin{equation}
 N(t+\Delta t_g) = \exp(\beta_{\mathrm{id}} \Delta t_g) \overline{N}(t)  + \exp \left[\left(\beta_{\mathrm{id}} + \beta_{\mathrm{is}}\right) \Delta t_g\right] \left[N(t)-\overline{N}(t)\right]
, \label{eq:exact_st_ice} \end{equation}
where $\overline{N}$ is the average over all directions. As a result, for a spatially homogeneous field,
the spectrum exponentially tends to isotropy over a time scale $1/(\beta_{\mathrm{id}})$.


% ================================================================
%                          DOCUMENTO
% ================================================================

\documentclass{scrbook}

% ================================================================
%                          PACCHETTI
% ================================================================

% dare una spiegazione
\usepackage{tikz}
\usetikzlibrary{arrows}

% ??
\usepackage{amsmath,amssymb,amsthm,thmtools}

% glossario
\usepackage{makeidx}

% ??
\usepackage{mathtools} % per \MoveEqLeft

% QR-code
\usepackage{qrcode}

\usepackage{array} % per formattare le colonne di un tabular

% ================================================================
%                           ALIAS ?
% ================================================================

% sono presi da paolini
% https://github.com/paolini/AnalisiUno/blob/master/AnalisiUno.tex

\newcommand{\eps}{\varepsilon}
\renewcommand{\phi}{\varphi}
\newcommand{\loc}{\mathit{loc}}
\newcommand{\weakto}{\rightharpoonup}
\newcommand{\implied}{\Longleftarrow}
\let\subsetstrict\subset
\renewcommand{\subset}{\subseteq}
\renewcommand{\supset}{\supseteq}

% calligraphic letters
\newcommand{\A}{\mathcal A}
\newcommand{\B}{\mathcal B}
\newcommand{\C}{\mathcal C}
\newcommand{\D}{\mathcal D}
\newcommand{\E}{\mathcal E}
\newcommand{\F}{\mathcal F}
\newcommand{\FL}{\mathcal F\!\mathcal L}
\renewcommand{\H}{\mathcal H}
\newcommand{\K}{\mathcal K}
\renewcommand{\L}{\mathcal L}
\newcommand{\M}{\mathcal M}
\renewcommand{\P}{\mathcal P}
\renewcommand{\S}{\mathcal S}
\newcommand{\U}{\mathcal U} %% intorni

% blackboard letters
\newcommand{\CC}{\mathbb C}
\newcommand{\HH}{\mathbb H}
\newcommand{\KK}{\mathbb K}
\newcommand{\NN}{\mathbb N}
\newcommand{\QQ}{\mathbb Q}
\newcommand{\RR}{\mathbb R}
\newcommand{\TT}{\mathbb T}
\newcommand{\ZZ}{\mathbb Z}

\newcommand{\abs}[1]{{\left|#1\right|}}
\newcommand{\Abs}[1]{{\left\Vert #1\right\Vert}}
\newcommand{\enclose}[1]{{\left( #1 \right)}}
\newcommand{\Enclose}[1]{{\left[ #1 \right]}}
\newcommand{\ENCLOSE}[1]{{\left\{ #1 \right\}}}
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
\newcommand{\ceil}[1]{\left\lceil #1 \right\rceil}

\newcommand{\To}{\rightrightarrows}
\renewcommand{\vec}[1]{\boldsymbol #1}
\newcommand{\defeq}{:=}
\DeclareMathOperator{\divergence}{div}
\renewcommand{\div}{\divergence}
% \DeclareMathOperator{\ker}{ker}  %% already defined
\DeclareMathOperator{\Imaginarypart}{Im}
\renewcommand{\Im}{\Imaginarypart}
\DeclareMathOperator{\Realpart}{Re}
\renewcommand{\Re}{\Realpart}
%\DeclareMathOperator{\arg}{arg}
\DeclareMathOperator{\tg}{tg}
\DeclareMathOperator{\arctg}{arctg}
\DeclareMathOperator{\tgh}{tgh}
\DeclareMathOperator{\settsinh}{settsinh}
\DeclareMathOperator{\settcosh}{settcosh}
\DeclareMathOperator{\setttgh}{setttgh}
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\im}{im}
\DeclareMathOperator{\sgn}{sgn}
\DeclareMathOperator{\diag}{diag}

\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
postheadspace=1em,
qed=,
%shaded={rulecolor=blue!20,rulewidth=1pt,bgcolor=blue!5}
]{theorem_style}

\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
postheadspace=1em,
qed=,
%shaded={rulecolor=yellow!50,rulewidth=1pt,bgcolor=yellow!5}
]{axiom_style}

\numberwithin{equation}{chapter}
\declaretheorem[name=Teorema,numberwithin=chapter]{theorem}
\declaretheorem[name=Lemma,sibling=theorem]{lemma}
\declaretheorem[name=Proposizione,sibling=theorem]{proposition}
\declaretheorem[name=Corollario,sibling=theorem]{corollary}
\declaretheorem[name=Paradosso,sibling=theorem]{paradox}
\declaretheorem[style=axiom_style,name=Assioma,sibling=theorem]{axiom}
\declaretheorem[name=Definizione,sibling=theorem]{definition}
\declaretheorem[style=exercise_style,name=Esempio,sibling=theorem]{example}
\declaretheorem[style=exercise_style,name=Esercizio,sibling=theorem]{exercise}
\declaretheorem[style=exercise_style,name=Osservazione,sibling=theorem]{remark}

% ================================================================
%                           DOCUMENTO
% ================================================================

% inizio documento
\begin{document}

% definizione titolo
\title{Formule utili\\\mbox{}\\
\qrcode{https://github.com/i-friends/mah_tips}
}
\author{Luca Ciucci e chi altro si vuole aggiungere}
\maketitle% genera titolo

\section{Introduction}
Here is the text of your introduction.

\begin{equation}
\A\AA
    \label{simple_equation}
    \alpha = \sqrt{ \beta }
\end{equation}

\subsection{Subsection Heading Here}
Write your subsection text here.

\section{Conclusion}
Write your conclusion here.

\include{chapters/analisi}

\end{document}


\section{The high energy $\gamma$-nucleon and $\gamma$-nucleus
 interactions.}

\hspace{1.0em}We consider the following kinematic
variables for $\gamma$-nucleon
scattering: the Bjorken-$x$ variable defined as $x=Q^2/2m\nu$ with $Q^2$, $\nu$
and $m$ the photon virtuality, the photon energy and nucleon mass,
respectively.
The the squared total energy of the $\gamma$-nucleon system is given by
$s=Q^2(1-x)/x + m^2$. We restrict consideration to
 the range of small $x$-values and  $Q^2$ is much
less than $s$.

The Generalized Vector Dominance Model (GVDM) \cite{BSY78}
 assumes that the virtual photon
fluctuates into intermediate $q\bar{q}$-states $V$ of mass $M$ which
 subsequently may
interact with a nucleon $N$.
Thus the total photon-nucleon cross section
 can be expressed by a relation \cite{PRW95}:
\begin{equation}
\begin{array}{c}
\label{HEGI1}\sigma_{\gamma N}(s,Q^2)=4\pi\alpha_{em}\int_{M^2_0}^{M^2_{1}}
dM^2D(M^2)\times \\
\times (\frac{M^2}{M^2+Q^2})^2(1+\epsilon\frac{Q^2}{M^2})\sigma_{VN}(s,Q^2),
\end{array}
\end{equation}
where integration over $M^2$ should be performed between $M^2_0=4m^2_{\pi}$
 and $M^2=s$.
Here $\alpha_{em} = e^2/4\pi = 1/137$ and the density
 of $q\bar{q}$-system per
unit mass-squared is given by
\begin{equation}
\label{HEGI2}D(M^2)= \frac{R_{e^{+}e^{-}}(M^2)}{12\pi^2M^2},
\end{equation}
\begin{equation}
\label{HEGI3} R_{e^{+}e^{-}}(M^2)=\frac{\sigma_{e^{+}e^{-}\rightarrow
hadrons}(M^2)}{\sigma_{e^{+}e^{-}\rightarrow
\mu^{+}\mu^{-}}(M^2)}\approx 3\Sigma_{f}e^2_{f},
\end{equation}
where $e^2_{f}$ the squared charge of quark with flavor $f$.
$\epsilon$ is the
ratio between the fluxes of longitudinally
 and transversally polarized photons.

Similarly the
 inelastic cross section for the scattering of a $\gamma$ with virtuality
$Q^2$ and with  a nucleus $A$ at impact parameter $B$
and the $\gamma$-nucleon c.m.
energy squared $s$ is given by \cite{ERR97}:
\begin{equation}
\begin{array}{c}
\label{HEGI4}\sigma_{\gamma A}(s,Q^2,B)=4\pi\alpha_{em}\int_{M^2_0}^{M^2_{1}}
dM^2D(M^2)\times \\
\times (\frac{M^2}{M^2+Q^2})^2(1+\epsilon\frac{Q^2}{M^2})\sigma_{VA}(s,Q^2,B),
\end{array}
\end{equation}

To calculate $\gamma$-nucleon or $\gamma$-nucleus inelastic cross sections
we need model for the $M^2$-,
 $Q^2$- and $s$-dependence of the $\sigma_{VN}$ or $\sigma_{VA}$. For
 these we  apply the
Gribov-Regge approach, similarly as it was done for $h$-nucleon or $h$-nucleus
inelastic cross sections.

The
 effective cross section for the interaction of a $q\bar{q}$-system with
squared mass $M^2$ with nucleus for the coherence length
\begin{equation}
\label{HEGI5} d=\frac{2\nu}{M^2+Q^2}
\end{equation}
exceeding the average distance between two nucleons
can be written as follows
\begin{equation}
\begin{array}{c}
\label{HEGI6}\sigma_{V A}(s,Q^2,B)=\int \prod_{i=1}^{A}
d^3 r_i\rho_A({\bf r}_i)
\times \\
\times (1 - |\prod_{i=1}^{A}[1-u(s,Q^2,M^2, b^2_i)]|^2).
\end{array}
\end{equation}
Here the amplitude (eikonal)
$u(s,Q^2,M^2, b^2_i)$ for the interaction of
the hadronic fluctuation with $i$-th nucleon
is given by \cite{ERR97}
\begin{equation}
\begin{array}{c}
\label{HEGI7}u(s,Q^2,M^2,{\bf b}_i)=
\frac{\sigma_{VN}(s,Q^2,M^2)} {8 \pi \lambda(s,Q^2,M^2)} \times \\
\times (1-i \rho \exp{[-\frac{b^2}{4\lambda(s,Q^2,M^2)}]},
\end{array}
\end{equation}
where $\rho\approx 0$ is the ratio of real and imaginary parts of scattering
amplitude at $0$ angle.
The amplitude parameters: the effective $q\bar{q}$-nucleon cross section
\begin{equation}
\label{HEGI8} \sigma_{VN}(s,Q^2,M^2)=\frac{\tilde{\sigma}_{VN}(s,Q^2)}{M^2+Q^2+C^2},
\end{equation}
where $C^2=2$ \ GeV$^2$,
and
\begin{equation}
\label{HEGI9}\lambda(s,Q^2,M^2)=2+\frac{m^2_{\rho}}{M^2+Q^2} +
\alpha_{P}^{\prime}
\ln{(\frac{s}{M^2+Q^2})}.
\end{equation}
The values of $\tilde{\sigma}_{VN}(s,Q^2)$ are calculated in paper
\cite{ERR97}.
It was shown \cite{ERR97} that $Q^2$ dependence of $\sigma_{VN}(s,Q^2)$
is very week at $Q^2 < m^2_{rho} + C^2$, where $m_{\rho}$ is
$\rho$-meson mass, and we omitted this dependence. We also use
$\sigma_{VN}(s,Q^2)$ calculated  in \cite{ERR97} at $M^2=m^2_{rho}$.

 If coherence length is smaller that an internuclear distance integrated
over $B$ then cross section
$\sigma_{VA}=A\sigma_{VN}$.


\section{Closed-loop \tuner for asynchronous training}
\label{sec:async_app}
In Section~\ref{sec:async_tuner}, we briefly discuss the closed-loop momentum control mechanism in \asynctuner. In this section, after presenting more preliminaries on asynchrony, we show with details on the mechanism:
it measures the dynamics on a running system and controls momentum with a negative feedback loop.
\paragraph{Preliminaries}
Asynchrony is a popular parallelization technique \citep{recht2011hogwild} that avoids synchronization barriers.
When training on $M$ asynchronous workers, staleness (the number of model updates between a worker's read and write operations) is on average $\tau=M-1$,
i.e., the gradient in the SGD update is delayed by $\tau$ iterations as $\nabla f_{S_{t - \tau}}(x_{t - \tau} )$.
Asynchrony yields faster steps, but can
increase the number of iterations to achieve the same solution,
a tradeoff between hardware and statistical
efficiency~\citep{DBLP:journals/pvldb/ZhangR14}.
\citet{mitliagkas2016asynchrony} interpret asynchrony as added momentum dynamics.
Experiments in \citet{hadjis2016omnivore} support this finding, and demonstrate that reducing algorithmic momentum can compensate for asynchrony-induced momentum
and significantly reduce the number of iterations for convergence.
Motivated by that result, we use the model
in~\eqref{equ:exp_async_update_app}, where the total momentum, $\mu_T$, includes both asynchrony-induced and algorithmic  momentum, $\mu$, in~\eqref{eqn:momentum_gd}.
\begin{equation}
	\mathbb{E}[ x_{t+1} - x_t ]
	= \mu_T \mathbb{E}[x_t - x_{t-1}] - \alpha \mathbb{E}\nabla f(x_{t})
\label{equ:exp_async_update_app}
\end{equation}
We will use this expression to design an estimator for the value of total momentum, $\hat{\mu}_T$.
This estimator is a basic building block of \asynctuner, that {\em removes the need to manually compensate for the effects of asynchrony}.

\paragraph{Measuring the momentum dynamics}
\Asynctuner estimates total momentum $\mu_{T}$ on a running system and uses a negative feedback loop to adjust algorithmic momentum accordingly.
Equation~\eqref{equ:exp_async_update} gives an estimate of $\hat{\mu}_T$ on a system with staleness $\tau$, based on \eqref{equ:exp_async_update}.
\begin{align}
\hat{\mu}_T
					= \mathop{\mathsf{median}}\left(
							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau -1}} f(x_{t - \tau - 1} )}
							{x_{t - \tau-1} - x_{t - \tau-2}}
					\right)
\label{eqn:momentum_measurement}
\end{align}
We use $\tau$-stale model values to match the staleness of the gradient,  and perform all operations in an elementwise fashion.
This way we get a total momentum measurement from each variable;
the median combines them into a more robust estimate.

\paragraph{Closing the asynchrony loop}
Given a reliable measurement of $\mu_{T}$,
we can use it to adjust the value of algorithmic momentum so that the total momentum matches the \emph{target momentum} as decided by \tuner in Algorithm~\ref{alg:basic-algo}.
\Asynctuner in Algorithm~\ref{alg:async-algo} %(in Appendix~\ref{sec:async_yf})
uses a simple negative feedback loop to achieve the adjustment.
%Figure~\ref{fig:we-can-measure} demonstrates that under asynchrony the measured total momentum is strictly higher than the algorithmic momentum (middle plot), as expected from theory;
%closing the feedback loop (right plot) leads to total momentum matching the target momentum.
%Closing the loop, as we will see, improves performance significantly.
%Note for asynchronous-parallel training, as the estimates and parameter tuning is unstable in the beginning when there are only a small number of iterations, we use initial learning $\frac{1}{\tau + 1}$ instead of $1.0$ to prevent overflow in the beginning.

%\begin{algorithm}[H]
%	\caption{\Asynctuner}
%	\begin{algorithmic}[1]
%%	\State Input: $\mu\gets0$, $\alpha \gets \frac{1}{\tau + 1}$, $\gamma\gets0.01, \tau$ (staleness)
%	\State Input: $\mu\gets0$, $\alpha \gets 0.0001$, $\gamma\gets0.01, \tau$ (staleness)
%	\For { $t\gets1$ to $T$}
%	\State $x_t\!\gets\!x_{t - 1} + \mu (x_{t - 1} - x_{t - 2} ) - \alpha \nabla_{S_t} f(x_{t - \tau - 1} )$
%	\State $\mu^*,\alpha \gets \Call{\tuner}{\nabla_{S_t} f(x_{t - \tau - 1} ), \beta}$ %(get momentum from the dynamic range)
%	\State $\hat{\mu_T}
%					\gets \mathop{\mathsf{median}}\left(
%							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau-1}} f(x_{t - \tau - 1} )}
%							{x_{t - \tau-1} - x_{t - \tau-2}}
%					\right)$ \Comment{Measuring total momentum}
%	\State $\mu \leftarrow \mu + \gamma \cdot (\mu^* - \hat{\mu_T})$ \Comment{Closing the loop}
%	\EndFor
%\end{algorithmic}
%\label{alg:async-algo}
%\end{algorithm}

%In Section~\ref{sec:async_tuner}, we briefly discuss the mechanism of our designed \Asynctuner in asynchronous-parallel setting. In this appendix, we expand the details in total momentum estimator, $\hat{\mu_T}$, and present the full \Asynctuner in Algorithm~\ref{alg:async-algo} with extensive discussion.
%\paragraph{Measuring the momentum dynamics}
%Remember, we use the formula in~\eqref{equ:exp_async_update_app} to model the momentum dynamics in asynchronous-parallel systems
%\Asynctuner estimates total momentum $\mu_{T}$ on a running system and uses a negative feedback loop to adjust algorithmic momentum accordingly.
%\begin{equation}
%	\mathbb{E}[ x_{t+1} - x_t ]
%	= \mu_T \mathbb{E}[x_t - x_{t-1}] - \alpha \mathbb{E}\nabla f(x_{t})
%\label{equ:exp_async_update_app}
%\end{equation}
%Equation~\eqref{eqn:momentum_measurement_app} gives an estimate of $\hat{\mu_T}$ on a system with staleness $\tau$, based on \eqref{equ:exp_async_update_app}.
%\begin{align}
%\hat{\mu_T}
%					= \mathop{\mathsf{median}}\left(
%							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau -1}} f(x_{t - \tau - 1} )}
%							{x_{t - \tau-1} - x_{t - \tau-2}}
%					\right)
%\label{eqn:momentum_measurement_app}
%\end{align}
%We use $\tau$-stale model values to match the staleness of the gradient,  and perform all operations in an elementwise fashion.
%This way we get a total momentum measurement from each variable;
%the median combines them into a more robust estimate.
%
%%\label{subsec:closed_loop_YF}
%%\begin{figure}
%%\centering
%%\includegraphics[width=0.95\linewidth]{experiment_results/resnet/mom_dynamic_3_annotated.pdf}
%%	\caption{
%%	Momentum dynamics on CIFAR100 ResNet.
%%	Running \tuner, total momentum is equal to algorithmic momentum in a synchronous setting (left). Total momentum is greater than algorithmic momentum on 16 asynchronous workers, due to asynchrony-induced momentum (middle).
%%	Using the momentum feedback mechanism of \asynctuner, lowers algorithmic momentum and brings total momentum to match the target value on 16 asynchronous workers (right).
%%	Red dots are individual total momentum estimates, $\hat{\mu}_T$, at each iteration.
%%The solid red line is a running average of those estimates.
%%	}
%%	\label{fig:we-can-measure}
%%\end{figure}
%
%\paragraph{Closing the asynchrony loop}
%Given a reliable measurement of $\mu_{T}$,
%we can use it to adjust the value of algorithmic momentum so that the total momentum matches the \emph{target momentum} as decided by \tuner in Algorithm~\ref{alg:basic-algo}.
%\Asynctuner in Algorithm~\ref{alg:async-algo} %(in Appendix~\ref{sec:async_yf})
%uses a simple negative feedback loop to achieve the adjustment.
%%Figure~\ref{fig:we-can-measure} demonstrates that under asynchrony the measured total momentum is strictly higher than the algorithmic momentum (middle plot), as expected from theory;
%%closing the feedback loop (right plot) leads to total momentum matching the target momentum.
%%Closing the loop, as we will see, improves performance significantly.
%%%Note for asynchronous-parallel training, as the estimates and parameter tuning is unstable in the beginning when there are only a small number of iterations, we use initial learning $\frac{1}{\tau + 1}$ instead of $1.0$ to prevent overflow in the beginning.
%%
%%%\begin{algorithm}[H]
%%%	\caption{\Asynctuner}
%%%	\begin{algorithmic}[1]
%%%%	\State Input: $\mu\gets0$, $\alpha \gets \frac{1}{\tau + 1}$, $\gamma\gets0.01, \tau$ (staleness)
%%%	\State Input: $\mu\gets0$, $\alpha \gets 0.0001$, $\gamma\gets0.01, \tau$ (staleness)
%%%	\For { $t\gets1$ to $T$}
%%%	\State $x_t\!\gets\!x_{t - 1} + \mu (x_{t - 1} - x_{t - 2} ) - \alpha \nabla_{S_t} f(x_{t - \tau - 1} )$
%%%	\State $\mu^*,\alpha \gets \Call{\tuner}{\nabla_{S_t} f(x_{t - \tau - 1} ), \beta}$ %(get momentum from the dynamic range)
%%%	\State $\hat{\mu_T}
%%%					\gets \mathop{\mathsf{median}}\left(
%%%							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau-1}} f(x_{t - \tau - 1} )}
%%%							{x_{t - \tau-1} - x_{t - \tau-2}}
%%%					\right)$ \Comment{Measuring total momentum}
%%%	\State $\mu \leftarrow \mu + \gamma \cdot (\mu^* - \hat{\mu_T})$ \Comment{Closing the loop}
%%%	\EndFor
%%%\end{algorithmic}
%%%\label{alg:async-algo}
%%%\end{algorithm}
%%
%
%
%

\begin{algorithm}[h]
	\caption{\Asynctuner}
	\begin{algorithmic}[1]
%	\State Input: $\mu\gets0$, $\alpha \gets \frac{1}{\tau + 1}$, $\gamma\gets0.01, \tau$ (staleness)
	\State Input: $\mu\gets0$, $\alpha \gets 0.0001$, $\gamma\gets0.01, \tau$ (staleness)
	\For { $t\gets1$ to $T$}
	\State $x_t\!\gets\!x_{t - 1} + \mu (x_{t - 1} - x_{t - 2} ) - \alpha \nabla_{S_t} f(x_{t - \tau - 1} )$
	\State $\mu^*,\alpha \gets \Call{\tuner}{\nabla_{S_t} f(x_{t - \tau - 1} ), \beta}$ %(get momentum from the dynamic range)
	\State $\hat{\mu_T}
					\gets \mathop{\mathsf{median}}\left(
							\frac{x_{t - \tau} - x_{t - \tau-1} + \alpha \nabla_{S_{t-\tau-1}} f(x_{t - \tau - 1} )}
							{x_{t - \tau-1} - x_{t - \tau-2}}
					\right)$ \Comment{Measuring total momentum}
	\State $\mu \leftarrow \mu + \gamma \cdot (\mu^* - \hat{\mu_T})$ \Comment{Closing the loop}
	\EndFor
\end{algorithmic}
\label{alg:async-algo}
\end{algorithm}


%% LyX 2.0.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[twoside,english]{paper}
\usepackage{lmodern}
\renewcommand{\ttdefault}{lmodern}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=3cm,bmargin=2.5cm,lmargin=2cm,rmargin=2cm}
\usepackage{color}
\usepackage{babel}
\usepackage{float}
\usepackage{bm}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{esint}
\usepackage[unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=false]
 {hyperref}
\usepackage{breakurl}
\usepackage{mathrsfs}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{equation}{section}
\numberwithin{figure}{section}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{babel}

\@ifundefined{showcaptionsetup}{}{%
 \PassOptionsToPackage{caption=false}{subfig}}
\usepackage{subfig}
\makeatother

\begin{document}

\title{Computation of the charged current structure functions}

\maketitle

\section{The structure of the observables}

The structure in terms of PDFs of the charged current (CC) structure
functions is complicated by the mixing between down- and up-type
quarks provided by the CKM matrix. As a first step, we write the
$\mathcal{O}(\alpha_s)$ contribution to $F=F_2,F_L$ (we will consider
$F_3$ later) in a convenient way as:
\begin{equation}\label{compactNu}
F^{\nu} = \sum_{U=u,c,t}\sum_{D=d,s,b}|V_{UD}|^2\left[C_\pm\left(D +\overline{U}\right) +2 C_gg\right]
\end{equation}
and:
\begin{equation}\label{compactNub}
F^{\overline{\nu}} = \sum_{U=u,c,t}\sum_{D=d,s,b}|V_{UD}|^2\left[C_\pm\left(\overline{D} +U\right) +2 C_gg\right]
\end{equation}
where we have omitted the convolution symbol and an overall factor
$2x$. At this order we don't have to worry about whether $C_+$ or
$C_-$ has to be used because they coincide. However, in the following
it will appear naturally which one has be used and where. One can
combine the expressions above conveniently as:
\begin{equation}
F^{\pm} \equiv \frac{F^{\nu} \pm F^{\overline{\nu}}}2=\frac12
\sum_{U=u,c,t}\sum_{D=d,s,b}|V_{UD}|^2\left[C_\pm\left(D^\pm
    \pm U^\pm\right) + P^{\pm}4C_gg\right]
\end{equation}
where we have used the usual definition $q^{\pm} = q\pm\overline{q}$
and defined the projector:
\begin{equation}
P^\pm=\frac{1\pm1}2\,.
\end{equation}
It should be noted that the subscript $\pm$ to the quark coefficient
function $C_\pm$ because is now associated to each of $F^\pm$.

Now we need to express these observables in terms of PDFs in the
evolution basis. The starting point is the relation:
\begin{equation}\label{TranformationBella}
q_i^\pm = \sum_{j=1}^6M_{ij}d^\pm_j\,,
\end{equation}
where $d^\pm_j$ belong to the QCD evolution basis, that is:
$d^+_1=\Sigma$, $d^+_2=-T_3$, $d^+_3=T_8$, $d^+_4=T_{15}$, $d^+_5=T_{24}$, and
$d^+_6=T_{35}$ and $d^-_1=V$, $d^-_2=-V_3$, $d^-_3=V_8$, $d^-_4=V_{15}$,
$d^-_5=V_{24}$, and $d^-_6=V_{35}$.  Note that here we are using the more
``natural'' ordering for the distibutions $q_i=\{d,u,s,c,b,t\}$ rather
than that where $u$ comes before $d$; this is the reason of the minus
sign in front of $T_3$ and $V_3$. The trasformation matrix $M_{ij}$
can be written as:
\begin{equation}\label{TransDef}
\begin{array}{l}
\displaystyle M_{ij}=\theta_{ji}\frac{1-\delta_{ij}j}{j(j-1)}\quad j\geq 2\,,\\
\\
\displaystyle M_{i1} = \frac{1}{6}\,,
\end{array}
\end{equation}
with $\theta_{ji}=1$ for $j\geq i$ and zero otherwise. In addition,
one can show that $M_{ij}$ is such that:
\begin{equation}\label{eq:properties}
\sum_{j=1}^6M_{ij} = 0\,,\quad\mbox{and}\quad \sum_{i=1}^6M_{ij} = \delta_{1j}\,.
\end{equation}

Using eq.~(\ref{TranformationBella}) we can make the following
identifications:
\begin{equation}
D^{\pm} = q_{2j-1}^\pm\quad\mbox{and}\quad U^{\pm} =
q_{2j}^\pm\,,\quad j=1,2,3\,,
\end{equation}
so that we can write:
\begin{equation}
F^\pm=
\frac12\sum_{i=1}^3\sum_{j=1}^3|V_{2i,(2j-1)}|^2\left[C_\pm\left(q_{2j-1}^\pm
    \pm q_{2i}^\pm\right) + 4P^{\pm} C_g g\right]\,.
\end{equation}
Using the definition of $M_{ij}$ in eq.~(\ref{TransDef}), we can
rewrite $F^{\pm}$ in terms of PDFs in the evolution basis as:
\begin{equation}\label{eq:decompF2L}
F^\pm=
\sum_{i=1}^3\sum_{j=1}^3|V_{2i,(2j-1)}|^2 F_{ij}^\pm\,,
\end{equation}
with:
\begin{equation}\label{F2Ldef}
F_{ij}^\pm=
C_g 2P^\pm g
+
C_\pm^{\rm S} P^\pm \frac16 d_1^\pm
+ C_\pm\sum_{k=2}^6\frac{\theta_{k,2j-1}(1-\delta_{2j-1,k}k)\pm \theta_{k,2i}(1-\delta_{2i,k}k) }{2k(k-1)}d_k^\pm\,.
\end{equation}

Eq.~(\ref{F2Ldef}) is valid only for $F_2$ and $F_3$. In order to
obtain a similar equation also for $F_3$, one needs to change sign to
the antiquark distributions, $i.e.$
$\overline{q}_i\rightarrow - \overline{q}_i$. In the QCD evolution
basis, this has the consequence of exchanging the $T$-like
distributions with the $V$-like ones, that is to say
$d_k^+\leftrightarrow d_k^-$. It is the easy to see that:
\begin{equation}
F_3^\pm=
\sum_{i=1}^3\sum_{j=1}^3|V_{2i,(2j-1)}|^2 F_{3,ij}^\pm\,,
\end{equation}
with:
\begin{equation}\label{F3def}
F_{3,ij}^\pm=
C_g 2P^\pm g
+
C_\pm^{\rm S} P^\mp \frac16 d_1^\pm
+ C_\pm\sum_{k=2}^6\frac{\theta_{k,2j-1}(1-\delta_{2j-1,k}k)\mp \theta_{k,2i}(1-\delta_{2i,k}k) }{2k(k-1)}d_k^\pm\,.
\end{equation}

It is now useful to consider the inclusive structure functions and
exploit the unitarity of the CKM matrix elements $V_{UD}$:
\begin{equation}
\sum_{i=1}^3|V_{2i,(2j-1)}|^2 = \sum_{j=1}^3|V_{2i,(2j-1)}|^2 = 1\quad\Rightarrow\quad \sum_{i=1}^3\sum_{j=1}^3|V_{2i,(2j-1)}|^2 = 3\,.
\end{equation}
Summing over $i$ and $j$ in eq.~(\ref{eq:decompF2L}) and using
eq.~(\ref{F2Ldef}), one obtains:
\begin{equation}
F^\pm=
C_g 6P^\pm g
+
C_\pm^{\rm S} P^\pm \frac12 d_1^\pm
+ \frac12 C_\pm\sum_{k=2}^6 d_k^\pm\sum_{l=1}^6(\pm 1)^{l+1}M_{lk}\,.
\end{equation}
Considering separately $F^+$ and $F^-$ and using
eq.~(\ref{eq:properties}), one finds:
\begin{equation}
F^+= C_g 6g + C_+^{\rm S} \frac12 d_1^+
\end{equation}
and:
\begin{equation}
F^-= \frac12 C_-\sum_{k=2}^6\left[\frac{P^+}{k-1}-\frac{P^-}{k}\right]d_k^-\,,
\end{equation}
with the even/odd projectors defined as:
\begin{equation}
P_k^{\pm} = \frac{1\pm(-1)^k}{2}\,.
\end{equation}

It should be pointed out that such simple expressions (independent of
the CMK matrix elements) is achievable only if it is possible to
factorize the non-singlet coefficient functions as implicitly done in
eqs.~(\ref{F2Ldef}) and~(\ref{F3def}). In fact, this is possible only
in the ZM case in which the coefficient functions of each PDF
combination is the same.

For $F_3$ we find:
\begin{equation}
F_3^+= C_g 6g + C_-^{\rm S} \frac12 d_1^-
\end{equation}
and:
\begin{equation}
F_3^-= \frac12 C_+\sum_{k=2}^6\left[\frac{P_k^+}{k-1}-\frac{P_k^-}{k}\right]d_k^+\,.
\end{equation}

\end{document}