% Some notes / rules:
% - Things marked \apw{} are APW's requests for Katie
% - Things marked \todo{} can be addressed by anyone

\documentclass[twocolumn]{aastex631}

% Packages
\usepackage{microtype}  % ALWAYS!
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{multirow}

\definecolor{pink}{RGB}{232,132,161}
\newcommand{\kc}[1]{\textcolor{pink}{\textbf{#1}} }

\newcommand{\mlg}{\ensuremath{M_{\rm LG}}}
\newcommand{\mmto}{\ensuremath{M_{\rm M31}}}
\newcommand{\mmw}{\ensuremath{M_{\rm MW}}}
\newcommand{\vtan}{\ensuremath{v_\textrm{tan}}}
\newcommand{\vrad}{\ensuremath{v_\textrm{rad}}}
\newcommand{\mud}{\ensuremath{\mu_\delta}}
\newcommand{\mua}{\ensuremath{\mu_\alpha^*}}
\newcommand{\bov}{\ensuremath{\boldsymbol{v}}}
\newcommand{\pos}[2]{\ensuremath{\boldsymbol{x}_{\rm #1 \to #2}}}
\newcommand{\vel}[2]{\ensuremath{\bov_{\rm #1 \to #2}}}
\newcommand{\mwbary}{\ensuremath{\textrm{MW}_\textrm{bary}}}
\newcommand{\mwouter}{\ensuremath{\textrm{MW}_\textrm{outer}}}
\newcommand{\mwdisk}{\ensuremath{\textrm{MW}_\textrm{disk}}}

% Style tweaks
% \renewcommand{\twocolumngrid}{\onecolumngrid}
% \setlength{\parindent}{1.1\baselineskip}
% \sloppy\sloppypar\raggedbottom\frenchspacing

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\shorttitle{Updated Local Group Mass from Timing Argument}
\shortauthors{Chamberlain, Price-Whelan et al.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\graphicspath{{./}{figures/}}
\input{math_definitions.tex}

% Affiliations
\newcommand{\affuofa}{University of Arizona, 933 N. Cherry Ave,
    Tucson, AZ 85721, USA}
\newcommand{\affcca}{Center for Computational Astrophysics, Flatiron Institute,
    Simons Foundation, 162 Fifth Avenue, New York, NY 10010, USA}

%% This is the end of the preamble.  Indicate the beginning of the
%% manuscript itself with \begin{document}.

\begin{document}

\title{
    A timing argument mass for the Local Group accounting for the
    Milky Way--LMC reflex motion
}

\author[0000-0001-8765-8670]{Katie~Chamberlain}
\affiliation{\affuofa}
\affiliation{\affcca}

\author[0000-0003-0872-7098]{Adrian~M.~Price-Whelan}
\affiliation{\affcca}

% TODO: Alphabetical ok?
\author{Gurtina Besla}
\affiliation{\affuofa}

\author{Emily Cunningham}
\affiliation{\affcca}

\author{Nicol\'{a}s Garavito-Camargo}
\affiliation{\affcca}

\author{Jorge Pe\~{n}arrubia}
\affiliation{TODO: Edinburgh}

\author{Michael Petersen}
\affiliation{TODO: Barcelona}

% TODO: Any other authors??

\begin{abstract}
    % \textbf{Context}
    The total mass of the Local Group (LG) is a fundamental quantity that
    enables interpretation of the orbits of its constituent galaxies and is
    needed to place the LG in a cosmological context.
    One of the few methods that enables inferring the total mass directly is the
    ``Timing Argument,'' which models the relative orbit of the Milky Way (MW)
    and M31.
    However, recent models of stellar tracers in the outer MW halo have shown
    that the inner MW and disk are moving with respect to the outer halo, likely
    because of the infall of the Magellanic Clouds (MCs), thus biasing past
    Timing Argument measurements that do not account for this motion.
    % \textbf{Aims}
    % \textbf{Methods}
    Here, we measure the total LG mass using a Timing Argument model that
    incorporates this measured ``travel velocity'' of the MW disk using several
    compilations of recent kinematic measurements of M31.
    % \textbf{Results}
    We generally find lower LG masses than past Timing Argument results and
    measure a consistent (between datasets) total mass of
    $4.5^{+0.8}_{-0.6}\times 10^{12}~\Msun$ using the travel velocity $32 \pm
    4~\kms$ measured in \citet{Petersen2021}.
    Measurements of the travel velocity with more distant tracers could yield
    even larger values, which would further decrease the inferred LG mass.
    Future data releases from \emph{Gaia} will lead to more precise measurements
    of M31's proper motion that will improve the precision of Timing Argument
    mass constraints by a factor of $\sim2$.
    % \textbf{Conclusions}
    The Timing Argument remains one of the only ways to measure the Local Group
    mass independent of the masses of the individual component galaxies, but
    it is clear that the dynamical impact of the MCs must be accounted for when
    using these techniques.

\end{abstract}

\section{Introduction}
\label{sec:intro}
% \textbf{Importance of local group mass and measuring it}
The total mass of the Local Group is a fundamental quantity in many local
cosmological and Milky Way (MW) applications.
For example, it is used to identify analogous halos in cosmological simulations
and thus allows comparing host galaxy and satellite galaxy number counts and
properties \citep{Patel2017a, Dooley2017, Besla2018, Patel2018, Sawala2022}
\todo{Any additional citations?}.
It is also used to turn the kinematics of Local Group galaxies into orbital
histories, which is used to interpret their gas content (\todo{Geha, Putman
papers}) and star formation histories (\todo{Weisz, others} \citep{Weisz2011}).
However, as most of the mass in the Local Group is in dark matter distributed
over megaparsec scales, it is difficult to directly measure its total mass.

Given its utility in studies of the local universe, several methods have been
used to dynamically infer the mass of the Local Group.
Many of these techniques determine the individual masses of the MW and M31
independently, often via the dynamics of their satellites and stellar streams,
then combine them to get an estimate of the total LG
mass \citep{Watkins2010,Diaz2014,Patel2018} \todo{Eadie papers}.
Other techniques aim to more directly measure the mass of the Local Group en
masse, for example looking for Local Group analogs in cosmological simulations
based on stellar mass and kinematic criteria \citep{Zhai2020}, or by studying
the kinematics of Local Volume galaxies \citep{Penarrubia2014} \todo{check this
reference}.
One of the earliest methods utilized in this vein is the ``Timing Argument,''
which uses the fact that the local group galaxies (most often the MW and M31)
are bound and approaching pericenter in their relative orbit, but must have been
close enough over cosmic time to not be pulled apart by the Hubble flow. We
summarize the relevant details of the Timing Argument method in
Section~\ref{sec:timingarg}

The Timing Argument (using the MW and M31) uses the observed kinematics of M31
to model the relative orbit of the two galaxies as a Keplerian orbit.
Assuming Keplerian dynamics enables dynamically measuring the total mass of the
MW and M31 because of symmetries \todo{is it symmetries?} of the Kepler
equations.
However, recent studies of the dynamics of the MW and its satellites have
revealed that the infall of the Magellanic Clouds (MCs) is likely causing
significant distortions to the dark matter and stellar distribution in the MW
halo \todo{People, Conroy}, thus impacting the interpretation of observations of
the M31 position and velocity relative to the MW center of mass.
In particular, the inner MW and disk are likely being accelerated away from the
center of mass reference frame that would exist in the absence of the MCs
\citep{Gomez2015, Garavito-Camargo2021b}.

In past work, this (then unknown) velocity offset has been included in a Timing
Argument model of the Local Group by independently modeling the mass of the MW,
M31, and the MCs (labeled the LMC; \citealt{Penarrubia2016}).
However, the velocity offset of the inner MW with respect to the outer halo,
likely induced by the infall of the MCs, has been directly measured using tracer
stars in the stellar halo of the MW (the ``travel velocity'';
\citealt{Petersen2021}).
In this Article, we use this measurement of the travel velocity or reflex motion
of the inner Milky Way with respect to the outer halo (assumed to be the
reference frame that would exist in the absence of the MCs) in a Timing Argument
model to infer the mass of the Local Group using recent measurements of the
distance and proper motions of M31.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The Timing Argument}
\label{sec:timingarg}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Following past work \citep[e.g.,][]{Lynden-Bell:1981, vdm2012, Penarrubia2016},
we assume that the orbital trajectories of the M31 and MW --- the Local Group
system --- over cosmic history are well-described by Keplerian orbits.
By assuming that the M31 and MW are gravitationally bound and were last at
closest approach in the early universe (i.e. the two galaxies have not yet
strongly interacted), we can then use the present-day kinematics of M31 to
estimate the total mass of the Local Group (i.e. using the ``Timing Argument'').

% \textbf{The dynamics of the M31-MW system can be approximated by simple Keplerian orbits.}
We largely follow the methodology and notation defined in
\citet{Penarrubia2016}, but the Timing Argument has been used in many other
studies \citep[e.g.,][]{stuff}.
% TODO: we have to put a list of TA references here so people don't get
% grumpy... but they will still be grumpy!
Briefly recapping the Timing Argument method, we assume that the dynamics of the
MW and M31 is dominated by the local gravitational potential of the Local Group
(LG) and therefore the Hubble flow can be neglected for computing the relative
orbits of the galaxies \citep[see, e.g.,][]{someone}.
% TODO: figure out most relevant citation for this!
Since we observe something close to the relative position and motion between M31
and the MW, we reduce the dynamics of the galaxies in the LG system to a single
Keplerian orbit that specifies the relative orbit between the galaxies and is
completely determined by four model parameters: the total mass of the Local
Group \mlg, the semi-major axis $a$, the eccentricity $e$, and the present value
of the eccentric anomaly $\eta$.

In terms of these four model parameters, the closed-form equations for relevant
two-body quantities like the separation between the masses $r$, the elapsed time
since last pericenter $t$, and the radial and tangential velocity components
\vrad\ and \vtan\ are given by:
\begin{align}
  r &= a \, (1-e\,\cos\eta) \label{eq:r} \\
  t &= \left( \frac{a^3}{GM} \right)^{1/2}(\eta-e\,\sin\eta) \label{eq:t} \\
  \vrad &= \left( \frac{GM}{a} \right)^{1/2} \frac{e\,\sin\eta}{1-e\,\cos\eta} \label{eq:vrad} \\
  \vtan &= \left( \frac{GM}{a} \right)^{1/2} \frac{\sqrt{1-e^2}}{1-e\,\cos\eta} \label{eq:vtan} \quad .
\end{align}
In our model, the separation $r$ is the distance between the centers of mass of
M31 and the MW, the time since last pericenter $t$ is the age of the Universe,
and (\vrad, \vtan) expresses the radial and tangential velocity components of
M31 relative to the MW center.

In a simpler universe where the MW and M31 are point masses and there are no
other massive bodies in the LG system, we could transform the observed
heliocentric sky position, distance, and velocity of M31 to a MW Galactocentric
reference frame and combine these with an estimate of the Hubble time to obtain
the four ``observables'' $(r, t, \vrad, \vtan)$ and then infer the four model
parameters $(\mlg, a, e, \eta)$ using Equations~\ref{eq:r}--\ref{eq:vtan}.
% \textbf{To compare our model predictions of the M31-MW system to the observed kinematics, we must translate these quantities into observables to constrain our model with observational data.}
To describe this ``classical'' Timing Argument approach in more detail and set
the stage for extending it, we adopt the notation of \citet{Penarrubia2016} in
which $\vel{A}{B}$ represents the velocity vector of A as measured in
the reference frame of B and $\pos{A}{B}$ represents the position vector of A as
measured from B.
With this notation, $\vel{A}{B} = -\vel{B}{A}$ and $\vel{A}{C} = \vel{A}{B} +
\vel{B}{C}$.
Thus, the position and velocity of M31 with respect to the center of mass of the
MW can be represented by $\pos{M31}{\mwbary}$ and $\vel{M31}{\mwbary}$
respectively, and the position and velocity of M31 as measured in a heliocentric
reference frame are given by
\begin{align}
  \pos{M31}{\odot} &= \pos{M31}{\mwbary} + \pos{\mwbary}{\odot} \label{eq:xoffset1}\\
  \vel{M31}{\odot} &= \vel{M31}{\mwbary} + \vel{\mwbary}{\odot} \label{eq:voffset1}\quad .
\end{align}
Here $\left|\pos{M31}{\mwbary}\right| = r$, $\vel{M31}{\mwbary}$ is determined
completely by the Keplerian model parameters (through \vrad\ and \vtan), and the
position and velocity of the center of mass of the MW as measured from the sun
are $\pos{\mwbary}{\odot}$ and $\vel{\mwbary}{\odot}$, respectively, and are
given by the adopted solar position and velocity in the Galaxy (the values we
adopt are given in Section~\ref{sec:datasets} below).

As noted above and in \citet{Penarrubia2016}, the dynamics of the MW--M31 system
is now thought to be more complex because of the infall of the LMC into the MW's
dark matter halo:
It is thought that the recent pericentric passage of the LMC has, to first
order, imparted a velocity boost on the disk and central regions of the MW,
shifting its position and velocity with respect to the mean position and
velocity of tracers in the outer MW \citep{Nico, Erkal, Petersen}.
This implies that we must account for additional terms in
Equations~\ref{eq:xoffset1} and \ref{eq:voffset1} to account for the reflex
motion of the MW disk with respect to the outer halo.
Thus, the observed position and velocity vector of M31 from the solar reference
frame is instead given by
\begin{align}
  \pos{M31}{\odot} &= \pos{M31}{\mwouter} + \pos{\mwouter}{\mwdisk}+\pos{\mwdisk}{\odot} \\
  \vel{M31}{\odot} &= \vel{M31}{\mwouter} + \vel{\mwouter}{\mwdisk}+\vel{\mwdisk}{\odot}
\end{align}
where ``\mwouter'' refers to a reference frame centered at and moving with the
center of mass of the outer MW halo and ``\mwdisk'' refers to a reference frame
centered at and moving with the center of the MW disk.
We assume that the outer MW halo frame is equivalent to the MW barycentric frame
in the simpler case where there is no LMC, or in other words we assume that the
outer MW halo has not yet had time to respond to the infall of the LMC.
We also assume that the sun, Galactic disk, and inner MW moved as a solid body
so that $\vel{\mwdisk}{\odot}$ and $\vel{\mwdisk}{\odot}$ are equivalent to the
solar position and velocity with respect to the Galactic center (as in
Equations~\ref{eq:xoffset1}--\ref{eq:voffset1}).
Figure~\ref{fig:schematic} shows a schematic of these different vectors --- all
drawn in a frame that is comoving with the \mwouter\ frame --- and a rough
illustration of the geometry we assume.

In what follows, we will assume that we have access to a direct measurement of
$\vel{\mwouter}{\mwdisk}$; This is different from \citet{Penarrubia2016} who
instead parametrize this term as a function of an additional parameter that sets
the mass ratio of the LMC and the MW.
We also assume that $\pos{\mwouter}{\mwdisk} \approx 0$ motivated by the fact
that this displacement is likely much smaller than the distance between the MW
and M31 $\pos{\mwouter}{\mwdisk} \ll r$ \citep[as expected from simulations,
e.g.,][]{Garavito-Camargo2021b}.

% APW: I'm not sure we need to go into detail about the coordinate system here
% info about coordinate system setup
% \textbf{We choose a coordinate system centered on the disk of the MW, where positive x is along the line of sight between the MW disk and the center of M31's disk, and positive y is in the direction of the tangential motion of M31.} Thus, the velocity vector of M31 in this Keplerian coordinate system is $(v_x, v_y, v_z) =(v_{rad},v_{tan},0)$, and $v_{rad}<0$ means M31 is moving towards the MW disk.

%%% Schematic %%%
\begin{figure*}[htb]
  \centering
  \includegraphics[width=0.8\columnwidth]{schematic_placeholder.png}
  \caption{
    Placeholder for whatever schematic we're going to end up creating
  }
  \label{fig:schematic}
\end{figure*}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Datasets}
\label{sec:datasets}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Key input into Timing Argument inferences of the Local Group mass are the
present position and velocity of M31 and the age of the universe (used in in
Equation~\ref{eq:t}).
Here we consider two compilations of data that provide this information to have
as comparisons.
The two datasets used in our analysis are summarized in Table~\ref{table:data}.
Briefly, ``Dataset 1'' comes from the measured proper motion of M31 and a
collection of other data used to constrain the mass of the Local Group via the
Timing Argument in~\citet{vdm2012}.
\todo{add note that we uses the full weighted pms from satellite kinematics and not just the HST.}
``Dataset 2'' is a compilation of more recent measurements, including a more
precise Cepheid-based distance measure to M31 \citep{Li2021} and updated proper
motions of M31 measured using data from \textit{Gaia} eDR3 \citep{Salomon2021}.
The \textit{Gaia}-based M31 proper motion measurement is slightly higher,
leading to an increased implied transverse velocity that will likely lead to a
higher inferred Local Group mass compared to the more radial orbit implied by
Dataset 1.

\begin{table*}
  \centering
  \begin{tabular}{lc|c}
    \hline\hline
                    & Dataset 1                     & Dataset 2 \\\hline
  $D$               &  $770 \pm 40~\kpc$ \citep{vdm2008}     &   $761\pm11~\kpc$ \citep{Li2021}        \\
  $v_{\rm rad}$     &     $-301 \pm 1~\kms$ \todo{Citation?}       &   $-301 \pm 1~\kms$        \\
  $(\mu_{\alpha^*},  \mu_\delta)$    & $(34.30 \pm 8.25, -20.22 \pm 7.71)~\muasyr$ \citep{vdm2012} & $(48.98 \pm 10.47, -36.85 \pm 8.03)~\muasyr$ \citep{Salomon2021}\\
  $\bs{v}_\odot$ & $(11.1, 251.54, 7.25)~\kms$ \todo{cite} & $(12.9, 245.6, 7.78)~\kms$ \citep{Drimmel2018}\\
  $t_{\rm peri}$ & $13.75 \pm 0.11~\Gyr$ \citep{Jarosik2011} & $13.801 \pm 0.024~\Gyr$ \todo{cite Planck18}\\
  %              &           &           \\
  %              &           &           \\
  \hline\hline

  \end{tabular}
  \caption{\label{table:data}
  Observational datasets used for comparison throughout analysis and their
  references (vdMG08 is \cite{vdm2008}) Each value is measured for M31 with
  respect to the sun. $D$ is the distance, $v_{\rm rad}$ is the radial velocity,
  $(\mu^*_{\alpha}, \mu_{\delta})$ are proper motions in RA cosdec and Dec, and
  (U$_{\rm pec}$, V$_{\rm pec}$+V$_0$, W$_{\rm pec}$) the solar motion with
  respect to the galactic center. $t_{\rm peri}$ is the time elapsed since the
  last pericenter of the M31 Keplerian orbit, which in this case is the age of
  the Universe.
  \apw{The references make the table spill over the page. I think we need to do
  references in footnotes instead?}
  }
\end{table*}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Bayesian Inference}
\label{sec:bayes}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

We construct a likelihood function for the observed, heliocentric position and
velocity of M31 and the time since last pericenter given the four parameters of
the Timing Argument model $(\mlg, a, e, \eta)$, assign prior probability
distribution functions (pdfs) for the parameters, and use these to compute the
posterior pdf over the parameters given the data.
In detail, we first use the four Timing Argument parameters to compute the
present day separation between the MW and M31, and the relative radial and
tangential velocities as defined in Equations~\ref{eq:r}--\ref{eq:vtan}.
These velocity components represent the relative velocity M31 would have as
observed from the barycenter of the MW--LMC subsystem; We then use the measured
``travel velocity'' of the MW disk $\vel{\mwouter}{\mwdisk}$ to compute the
relative velocity of M31 that would be observed from a frame moving with the
center of the Milky Way disk (i.e. a Galactocentric frame).
We finally then transform from this Galactocentric frame to a heliocentric
reference frame moving with the solar system barycenter (i.e. ICRS coordinates).
At this final stage, we must introduce an additional nuisance parameter $\alpha$
which represents the orientation of the MW--M31 orbital plane as it intersects
the tangent plane located at the sky position of M31 on the celestial sphere.
This is necessary because the Kepler equations only provide the magnitude of the
tangential velocity (i.e. Equation~\ref{eq:vtan}), but in order to compute
proper motion components we must also know the exact orientation of the M31
velocity vector.

We specify this model using the \texttt{Python} probabilistic programming
package \texttt{pymc3}~\citep{Salvatier2016} and our adopted prior pdfs are
summarized in Table~\ref{table:priors}.
We use the No-U-Turn Sampler (NUTS) \citep{gelman?} implemented in
\texttt{pymc3} to generate samples from this posterior pdf, given data from each
of the datasets defined in Table~\ref{table:data}.
We sample over the parameter Local Group mass $\mlg$, (true) present-day MW--M31
separation $r$, log eccentricity $\ln\left(1 - e\right)$, eccentric anomaly
$\eta$, and the orbital plane orientation nuisance parameter $\alpha$.
However, we set the priors as follows:
\begin{itemize}
  \item Mass of the Local Group $\mlg$: we use a broad, truncated normal
  distribution centered on a past measured value of the local group mass.
  \item Present MW--M31 separation $r$: we again use a broad, truncated normal
  distribution centered on past measurements of the distance to M31.
  % TODO: oops - we should center it on ~770 ot 750, not 700 kpc like we chose!
  \item Eccentricity $e$: we assume a uniform prior on eccentricity but sample
  in the transformed parameter $\ln(1-e)$ to improve the acceptance fraction
  when generating posterior samples.
  \item Eccentric anomaly $\eta$: we assume a uniform prior.
  \item Orbital plane orientation $\alpha$: we assume a uniform prior.
\end{itemize}

For each dataset, we run the sampler with 4 chains for 4000 tuning steps and
8000 draws.

% \begin{equation}
%   \mathcal{L}(| \boldsymbol{S})
% \end{equation}
% where $\boldsymbol{S} = ($\mlg$, a, e, \eta)$

% TODO: Letters have a 1 table max limit, so we might have to move the prior
% details into the list above. But we could always submit as a short regular
% paper instead of a letter...
\begin{table}
  \centering
  \begin{tabular}{lc}
  \hline\hline
  Prior  & Description \\\hline
  \mlg: $\mathcal{N}(4.5,3)\times10^{12}\Msun$ & Mass of the Local Group\\
  %
  $r$: $\mathcal{N}(700,100)$kpc & Distance from M31 to $\mwdisk$\\
  %
  $\ln(1-e)$: $\mathcal{U}$(-10,0) & Eccentricity (close to 1) \\
  %
  $\eta$: angle(0,2$\pi$)& Eccentric anomaly\\
  \multirow{2}{*}{$\alpha$: angle(0,2$\pi$)} & Angle between M31 orbital\\
  & pole and Galactocentric\\
  \hline\hline
  \end{tabular}
  \caption{\label{table:priors}Priors \kc{note: on \mlg and $r$, we also set bounds? how should I show those here? or should they go in the text?}}
\end{table}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Results: Local group mass estimates}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\label{sec:results}
\kc{Include the velocity vector of M31 from the halo frame?}

\begin{figure*}[htb]
  \centering
  \includegraphics[width=0.8\textwidth,trim=1.3cm 0.8cm 1.3cm 0cm,clip=true]
  {analyze-runs-contour.pdf}
  \caption{\label{fig:contour} 95\% confidence contours of sampled posterior
  distributions with three observational datasets for a subset of our model
  parameters: the total mass of the Local Group (\mlg)
  % , the distance between the Sun and M31 ($r$),
  and the eccentricity of the orbit of M31 about a fixed MW ($e$).
  The more radial orbit implied by the~\cite{vdm2012} \textit{HST} proper
  motions leads to a lower inferred \mlg\ and a higher
  eccentricity, while the larger \textit{Gaia} proper motions of
  ~\cite{Salomon2021} yield a more circular orbit, and thus a lower eccentricity
   and higher mass system.
  % A stationary MW disk is shown in the dotted contours, while our model,
  %which includes the reflex motion of the MW disk, is shown in solid lines.
  % The distributions for the separations are unchanged between models, as our
  % model does not implement a spatial shift to the location of the MW disk.
  \apw{I have some nitpicky requests! I added them as separate points after this. Sorry to be picky: I think this is the key figure, so want it to be very clear!}
  \apw{Change the MLG range to (1.5, 7) and add tick marks at 2, 3, 4, 5, 6, 7}
  \apw{Change the eccentriity range to (0.5, 1)}
  \apw{Set bins=101 or some bigger number}
  \apw{try passing smooth=1 or something to smooth out the contours}
  \apw{Remove the shaded bands (Penarrubia and vdM2012) from the bottom left panel - they should only appaer in the histogram}
  \apw{For the main case of vtravel=32, run for tune=4000, draws=40000 and remake}
  }
\end{figure*}

% We use recent measurements of the present-day kinematics of M31 as observed from the solar system, updated measurements of the solar position and motion with respect to the Milky Way center, and a recent measurement of the velocity of the Milky Way disk with respect to the outer stellar halo to measure the mass of the Local Group using observed kinematics of M31.

We use a Bayesian model to place constraints on the mass of the Local Group and the distance between M31 and the Sun using the Timing Argument. Our model of the Local Group includes the reflex motion of the Milky Way disk and results in new constrains on the mass of the Local Group to 4.69$\pm0.71 \times 10^{12}~\Msun$.

% this will maybe go in discussion?
Previous studies that have used the Timing Argument to constrain the mass of the
Local Group have found a range of masses.
~\cite{vdm2012} used the timing argument with Dataset 1 and derived a mass of
$4.27\pm 0.53\times 10^{12}~\Msun$) \kc{note: our value of \mlg is $\sim.3 \times 10^{12}~\Msun$ higher than found in vdm2012 with the same set of data with no travel velocity. probably just in implementation of mcmc or something?}.
~\cite{Penarrubia2016} finds a Local Group mass of ($\sim2.64\pm0.4\times
10^{12}~\Msun$) which is significantly lower than our expectations, although this
constraint combines the observed kinematics of 35 Local Volume galaxies in
addition to the dynamics of the M31--MW system.
Each of the Local Volume Galaxies is fit to a radial Keplerian orbital model.
However, inclusion of any transverse motion will increase the inferred total
mass of the system, so it is likely the assumption of radial orbits leads to
an underestimate of the mass of the Local Group with LV galaxies only.
Including the dynamics of the M31--MW system increased their recovered
total mass by $0.6\times10^{12}~\Msun$.

We found that, for both considered datasets, our model prefers lower Local Group masses and a lower eccentricity orbit compared to models that do not include MW disk reflex motion. Fig.~\ref{fig:contour} shows the 95\% contours from the sampled posterior PDFs of the distance to M31, the eccentricity of the orbit of M31 with a fixed MW, and the inferred Local Group mass. Arrows in the bottom left panel of the corner plot indicate the shift to lower masses and eccentricities when introducing the reflex motion of the MW.

The direction of the motion of the disk is directly tied to the behavior of the inferred mass of the Local Group. In this case, the orbit of the LMC and location of the LMC at pericenter are in the same region of the sky as M31 such that the radial component of motion is in the direction of M31. Thus, the observed radial velocity of M31 will be higher than for an unperturbed MW halo. Since $-v_{rad}\propto M^{1/2}$ for an infalling system, a smaller (but still negative) radial velocity will yield a lower Local Group mass.

The eccentricity decreases significantly for Dataset 2 compared to Dataset 1, due to the larger measured proper motions of Dataset 2.  Additionally, a smaller radial velocity corresponds to a lower eccentricity for a fixed mass and distance, which can be seen in the bottom right panel of~\ref{fig:contour}.

Constraints on the distance to M31 remain roughly unchanged for both datasets, primarily because our model does not introduce a physical displacement of the MW disk, since we assume the motion of the disk over the past XX Myr since the LMC achieved pericenter is negligible compared to the separation between M31 and the MW. Thus, the inclusion of the reflex motion of the disk in our model does not affect constraints on the distance to M31.

% bit about the stellar halo tracers and different distances etc
\cite{Garavito-Camargo2021b} showed that stellar halo tracers at different distances from the MW disk center may result in different measured travel velocities, and it's likely that the current measurements on $v_{travel}$ of 32km/s are just a lower bound on the actual reflex motion of the disk. In Fig.~\ref{fig:mvsv}, we show that for increasing travel velocity magnitudes, the mass of the Local Group from the Timing Argument steadily decreases. Thus, future measurements of the travel velocity of the disk will likely result in a lower inferred Local Group mass. Vertical lines show the travel velocities that are expected for three tracer distances in simulations from~\cite{Garavito-Camargo2021b}. \kc{why does the mass level off after 80kpc / 70km/s? }

% bit about PM improvement
Of all our observational data, the proper motions have the largest relative errorbars. In order to determine how improved constraints on the proper motions from future Gaia data releases would impact Timing Argument constraints on the Local Group mass, we redid our analysis as a function of the fractional improvement in proper motion errors.
We find that as proper motion measurements improve by a factor of $\sim2$, the constraints on the Local Group mass from the timing argument will improve by a factor of more than 1.5. These results are compiled in Fig.~\ref{fig:mvspm}.

\begin{figure}[htb]
    \centering
    \includegraphics[width=\columnwidth]{analyze-runs-MvV.pdf}
    \caption{\label{fig:mvsv}
    Mean inferred Local Group mass as a function of travel velocity
    magnitude of the MW disk.
    The larger \textit{Gaia} proper motions (yellow) lead to higher transverse
    motion and thus higher mass than either of the \textit{HST} proper motion
    datasets (pink and purple), though they display the same general trends with increasing travel velocity.
    The vertical lines represent simulated travel velocities for
    stellar tracers at different distances in~\cite{Garavito-Camargo2021b}.
    The mean Local Group mass corresponding to the observed travel velocity
    from~\cite{Petersen2021} of 32km/s (triangle points) and the 1-$\sigma$
    spread on the mass is shown for comparison.
    \textbf{The inclusion of the reflex motion of the MW disk systematically
    lowers the inferred mass of the Local Group} regardless of observational
    dataset.
    \kc{make sense of the leveling off at 70km/s.}
    \kc{also maybe add to x values of points to put them next to each other?
    instead of overlapping?}
    }
  \end{figure}

\begin{figure}[htb]
    \centering
    \includegraphics[width=\columnwidth]{analyze-runs-deltaMvsPM.pdf}
    \caption{\label{fig:mvspm} Improvement in the inferred Local Group mass as a function of fractional improvement in proper motion errors.
    The standard deviation in the mass decreases with decreasing proper motion
    error, and in particular, decrease by a factor of $\sim2.5$ for PMs that are
    4 times smaller than in Dataset 2.
    \textbf{As future \textit{Gaia} data releases provide improved proper motion errors, constraints on the Local Group mass from the Timing Argument can
    improve by a factor of $>$2.}
    }
\end{figure}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Summary and Discussion}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\label{sec:discussion}
In this Letter, we use the Timing Argument to constrain the mass of the Local
Group by
simplifying the dynamics of the MW--M31 pair to a Keplerian orbital model and
given two compilations of data for the position and velocity of M31.
However, these observations have not accounted for the reflex motion of the
Milky Way disk with respect to the outer halo, and thus previous Timing
constraints on
the LG mass do not include the crucial dynamical effect of the velocity boost
of the disk.

We show that introducing the travel velocity of the MW disk into the Keplerian
model lowers the inferred Local Group mass from the Timing Argument for two 6D
M31 datasets.
We provide an updated constraint on the mass of the Local Group of
4.69$\pm\times$0.71 $10^{12}~\Msun$ using recent \textit{Gaia} eDR3 proper
motions~\citep{Salomon2021}, precise Cepheid distance measurements
~\citep{Li2021}, and assuming a disk travel velocity of 32km/s from
~\cite{Petersen2021}, and show that an increase in the travel velocity of the
disk will result in even lower inferred LG masses.

\subsection{Cosmological implications}
\begin{table*}
  \centering
  \begin{tabular}{clc|c}
    \hline\hline
    Mass & Method & Result ($ 10^{12}~\Msun$ ) & Citation \\\hline
    \multirow{7}{*}{\mlg}  &{LV Galaxies + Timing Argument} & {2.64$\pm0.4$} & \cite{Penarrubia2016} \\
    &{Timing only} & {4.27$\pm$0.45} & \cite{vdm2012} \\
    &{Timing (3D + cosmic bias and scatter)} & {4.93$\pm$1.63} & \cite{vdm2012} \\
    &Timing (radial + cosmo sim calibration)  & $5.27$& \cite{LiWhite2008} \\
    &Timing & $3.6$ & \cite{Lynden-Bell:1981} \\
    & Cosmo Sims & 4.4$^{+2.4}_{-1.5}$ & \cite{Zhai2020}\\
    & LG Dynamics &$2.5\pm0.4$ & \cite{Diaz2014}\\
    %  &  &  \\
    \hline
    \multirow{3}{*}{\mmto}& Kinematics of M31 Sats & $1.4 \pm 0.4$ ($<$300 kpc) & \cite{Watkins2010}\\
    & Cosmo Sims & 2.5$^{+1.3}_{-1.1}$ & \cite{Zhai2020}\\
    & LG Dynamics &$1.7\pm0.3$ & \cite{Diaz2014}\\
    \hline
    \multirow{4}{*}{\mmw}&  Kinematics of LG sats & $1.4 \pm 0.3$ ($<$300 kpc) & \cite{Watkins2010}\\
    & Cosmo Sims & 1.5$^{+1.4}_{-0.7}$ & \cite{Zhai2020} \\
    & LG Dynamics &$0.8\pm0.5$ & \cite{Diaz2014}\\
    & MW Sats & $0.96^{+0.29}_{-0.28}$ & \cite{Patel2017}\\
  \hline\hline
  \end{tabular}
  \caption{\label{table:masses}Can remove this, this is just to keep me sane}
\end{table*}
Previous uses of the Timing Argument have placed constraints on the mass of the Local Group

By including reflex motion, we move in the direction of the expected summed masses of the Milky Way and M31 which is good.

How does the mass that we found compare to mass estimates from other means?
- like hubble flow constraints, previous timing argument, previous MW--M31 measurements, etc.

If our mass is higher, what does that mean?
If our mass is lower, what does that mean?
What does this high mass mean to the Local Group? What about to the
constituents?

What is context for mergers and M31 and why they might be
related to the Local Group mass?

Our findings of a high mass Local Group are consistent with findings that the
mass of M31 is XXbig and the MW is $1-1.5\times10^{12}~\Msun$~\citep{??}.
However, this high group mass also has cosmological implications.
A high Local Group mass could also be consistent with tk that propose that M31
has undergone recent (XX Gyrs) major? accretion events with other massive
subhalos, resulting in morphological features like the Giant Southern Stream and
XX (what are other M31 things that indicate recent interactions? Do we think
much about M32? )

\subsection{Inclusion of reflex motion in dynamics of the Local Group}
The inclusion of the reflex motion of the Milky Way disk can result in up to
$1\times10^{12}$ difference in the estimated mass of the Local Group, which
means that by not accounting for this motion, we could get measurements of the
Local group mass that are overestimated by 20-25\%.
Other dynamical interactions within the Local Group will also be affected by
the reflex motion of the disk. (What is the distribution of satellite velocities
about the MW now and w reflex motion? Cause should there maybe be an excess of
-vrad satellites in the MW halo? )

\subsection{Expectations for future observations.}
\kc{Adrian!}

Do we expect Gaia DR3 proper motions to improve by a factor of ~4?
This would provide the tightest constraints on the Local Group mass from the
Timing Argument!

\subsection{The M31--M33 system}
We do not account for the effects of reflex motion of M31 due to
uncertainties in both its interaction history and the orbital history of
M33.
A first infall scenario for M33 would rule out the possibility of a
strong reflex response resulting due to a close pericentric passage.
On the other hand, M31 has likely experienced significant disturbances, as
evidenced by the double nucleus and Giant Southern Stream,
which may have been resulted in a substantial reflex motion.
Thus, we elect to disregard the effects of an M31 reflex motion.

\subsection{Other?}
Concluding remarks

\appendix
Currently, appendix only includes the corner plots for all of the 5 model parameters for each of the three datasets.
\begin{figure*}[htb]
  \centering
  \includegraphics[width=0.8\columnwidth]{analyze-runs-all-vdm2012.pdf}
  \caption{\label{fig:contour-vdm}
  \apw{Can you remove the 99.7 line (so just 68 and 95), change the MLG range to
  (2.5, 7), change the eccentricity range to (0.5, 1), and set bins=101}
  \apw{try passing smooth=1 or something to smooth out the contours}
  }
\end{figure*}

\begin{figure}[htb]
  \centering
  \includegraphics[width=0.8\columnwidth]{analyze-runs-all-Dataset3.pdf}
  \caption{\label{fig:contour-dataset3}
  \apw{same as above}
  }
\end{figure}

\begin{figure*}[htb]
  \centering
  \includegraphics[width=0.8\columnwidth]{analyze-runs-all-fiducial2021.pdf}
  \caption{\label{fig:contour-fiducial}
  \apw{same as above}
  }
\end{figure*}

% \software{
%     Astropy \citep{astropy, astropy:2018},
%     gala \citep{gala},
%     IPython \citep{ipython},
%     numpy \citep{numpy},
%     pymc3 \citep{Salvatier2016},
%     scipy \citep{scipy}
% }

\bibliography{refs}{}
\bibliographystyle{aasjournal}

\end{document}


\subsection{Temperature and Other Fundamentals Solutions}
\begin{enumerate}
    \item Particles in an ideal gas undergo elastic collisions. It is one of the necessary conditions for a gas to be considered ideal.
    \item \begin{enumerate}
        \item Substituting $k_b = \frac{R}{N_A}$ into the ideal gas law $PV = Nk_bT$, we get:
    \[PV = N\frac{R}{N_A}T \]
    And the number of molecules $N$ divided by Avogadro's number is just the number of moles of gas $n$, so this becomes:
    \[PV = nRT \]
    As desired.
        \item This answer follows a very similar process to the previous problem. Substituting $k_b = \frac{R}{N_A}$ into the thermal energy of the system $E_{th} = \frac{\chi}{2}Nk_bT$, we get:
    \[ E_{th} = \frac{\chi}{2}N\frac{R}{N_A}T \]
    And using the same identity of $\frac{N}{N_A} = n$, as above:
    \[ E_{th} = \frac{\chi}{2}nRT \]
    As desired.
        \item ubstituting $PV = nRT$ into $E_{th} = \frac{\chi}{2}nRT$, we obtain:
    \[ E_{th} = \frac{\chi}{2}PV \]
    As desired.
    \end{enumerate}
    \item No, two systems having the same amount of total energy does not imply the same amount of temperature. Temperature is a measure of the average kinetic energy of particles, while total thermal energy is the measure of \textbf{all} the thermal energy of all the particles in the system. For example, a large ice cube and a millilitre of boiling water could have the same thermal energy, but clearly are at different temperatures. Mathematically, one only needs to look at the equation \[ E_{th} = \frac{\chi}{2}nRT \] to see that thermal energy depends not only on temperature, but the amount of stuff that you have (As well as the degrees of freedom of the stuff).
    \item Assuming that this vacuum-box is placed in a room with any molecules, then no. A vacuum is the absence of molecules, and in the absence of any molecules, you don't have any pressure on the walls of the box. So the inside of the box will have a different pressure than the outside, and hence not be in equilibrium.
    \item \begin{enumerate}
        \item If the volume of a box of ideal box decreased, then $V$ would decrease, while
        the amount of gas $n$ and the temperature of gas $T$ would stay the same (as the average kinetic energy of the molecules wouldn't change in this case). Therefore by the ideal gas law $PV = nRT$, if the right hand side stays the same size while $V$ decreases, then the pressure $P$ must increase.
        \item By the same logic as above, if the volume of the box of ideal gas increased, the pressure $P$ must decrease.
        \item If the box of ideal gas springs a leak, then the amount of gas $n$ in the box decreases, while the volume $V$ and the temperature $T$ of the box would stay the same (as again, the average kinetic energy of the particles would not be affected). Therefore, by the ideal gas law $PV = nRT$, the pressure $P$ must decrease (as we would expect from any container that sprung a leak!)
    \end{enumerate}
    \item If this hypothetical super-heavy gas indeed could exist, then it clearly couldn't be ideal, as the gravitational attraction between the gas particles would be significant. So this isn't a situation where we can apply the ideal gas law. However, principles of energy conservation would still apply (as they always do). When we increase the volume of the box, the average distance between any two superheavy molecules will increase. When we increase the distance between the super-heavy gas molecules, the gravitational potential energy $U_g = -\frac{GM^2}{r}$ (Where $G$ is the gravitational constant, $m$ is the mass of one super-heavy molecule, and $r$ is the distance in between two molecules) increases (or to be more clear, it becomes less negative, as $r$ increases). Therefore, if the potential energy increases, energy conservation tells us that kinetic energy must then decrease. Another way of thinking about this is to pull appart two massive objects, I need to put energy into the system to pull them apart; this energy comes from the kinetic energy of the molecules in this case. Either way, the decrease of the kinetic energy of molecules means that by our definition of temperature $T=\frac{2}{3 k_{b}} \epsilon_{kavg}$ which linearly scales with the kinetic energy, the temperature of the super-heavy molecules must decrease.
    \item This question follows a similar thought process to the one above. Since we have a gas of electrons which clearly would interact with one another through the electrostatic force, our gas again is not ideal. However, we once again consider an argument from energy conservation. This time, the electric potential energy between two negatively charged electrons is given by $U_{q} = \frac{ke^2}{r}$, where $k$ is the constant in Coloumb's law, $e$ is the elementary charge on the electron, and $r$ is the distance between any two electrons. In this case, increasing the volume of the box and increasing the average distance between two electrons will lead to a decrease in the electric potential energy. Therefore, by energy conservation, the kinetic energy of the electrons must increase, and we would then have that the temperature of the electron gas would increase by the definition.
    \item \begin{enumerate}
        \item By equation \ref{eqn:(2)} of $\frac{3}{2}PV = N\epsilon_{kavg}$ we see that the pressure of of the box scales linearly with the number of particles. Therefore, the box with the greater number of particles would have greater pressure. However, temperature is independent of the number of particles, (as it only depends on the average kinetic energy of all the particles, by the definition $T=\frac{2}{3 k_{b}} \epsilon_{kavg}$) so therefore the temperature of the two boxes would be the same.
        \item Again looking at equation \ref{eqn:(2)} of $\frac{3}{2}PV = N\epsilon_{kavg}$, we see that the pressure scales linearly with kinetic energy; kinetic energy is linear in the mass $m$ of the particles. Therefore, the
        box with the heavier (but identical speed) molecules would have greater kinetic energy and therefore greater pressure. By the same argument, since temperature also scales linearly with kinetic energy, the heavier-particle box would also have a higher temperature.
    \end{enumerate}
    \item I would have to supply three times as much heat. Recalling equation \ref{eqn:(13)} which relates the energy change with temperature, we have:
    \begin{align*}
        \Delta E = nc_v\Delta T = n\frac{\chi}{2}\Delta T
    \end{align*}
    Where $\Delta E$ is the change in temperature, $n$ is the number of moles of gas, $\chi$ is the degrees of freedom of the molecule. and $\Delta T$ is the change in temperature. For a monoatomic molecule, we have $\chi = 3$ and for a triatomic molecule, we have $\chi=6$. Therefore, per unit of temperature change, we would require three times as much energy for the triatomic
    \item A monoatomic molecule in 10 dimensional space would still not have any rotational degrees of freedom, but would have 10 translational degrees of freedom (don't bother thinking about what this looks like...) By the same argument given in the previous section, since the 10-D helium has more degrees of freedom, it would have a smaller temperature increase than the 3-D helium if both were given the same amount of energy.
\end{enumerate}


\chapter{Unconstrained optimisation of non-differentiable real functions}


\subsection{Managerial Implications}
\label{implications}

Even though zeitgeist claims that having more data is always better, our study
    shows this is not the case here:
First, under certain circumstances, accuracy may go up with shorter training
    horizons.
Second, none of the external data sources improves the accuracies.
Somewhat surprisingly, despite ML-based methods` popularity in both business
    and academia in recent years, we must conclude that classical forecasting
    methods suffice to reach the best accuracy in our study.
There is one case where ML-based methods are competitive in our case study:
    In a high demand pixel (defined as more than 25 orders per day on average),
    if only about four to six weeks of past data is available,
    the \textit{vrfr} model outperformed the classical ones.
So, we recommend trying out ML-based methods in such scenarios.
In addition, with the \textit{hsma} and \textit{hets} models being the overall
    winners, incorporating real-time data is not beneficial, in particular,
    with more than six weeks of training material available.
Lastly, with just \textit{hets}, that exhibits an accuracy comparable to
    \textit{hsma} for low and medium demand, our industry partner can likely
    schedule its shifts on an hourly basis one week in advance.

This study gives rise to the following managerial implications.
First, UDPs can implement readily available forecasting algorithms with limited
    effort.
This, however, requires purposeful data collection and preparation by those
    companies, which, according to our study, is at least equally important as
    the selection of the forecasting algorithm, as becomes clear from
    investigating the impact of the length of the training horizon.
Second, the benefits of moving from manual forecasting to automated forecasting
    include being able to pursue a predictive routing strategy and
    demand-adjusted shift scheduling.
At the time the case study data was collected, our industry partner did not
    conduct any forecasting; the only forecasting-related activities were the
    shift managers scheduling the shifts one week in advance manually in
    spreadsheets.
Thus, selecting the right forecasting algorithm according to the framework
    proposed in this study becomes a prerequisite to the much needed
    operational improvements UDPs need to achieve in their quest for
    profitability.
In general, many UDPs launched in recent years are venture capital backed
    start-up companies that almost by definition do not have a strong
    grounding in operational excellence, and publications such as the ones by
    Uber are the exception rather than the rule.
Our paper shows that forecasting the next couple of hours can already be
    implemented within the first year of a UDP's operations.
Even if such forecasts could not be exploited by predictive routing (e.g., due
    to prolonged waiting times at restaurants), they would help monitoring the
    operations for exceptional events.
Additionally, the shift planning may be automated saving as much as one shift
    manager per city.
We emphasize that for the most part, our proposed forecasting system
    is calibrated automatically and no manual work by a data scientist is required.
The only two parameters where assumptions need to be made are the pixel size
    and the time step.
The results in our empirical study suggest
    that a pixel size of $1~\text{km}^2$ and a time step of one hour are ideal,
    which results in the optimal trade-off
    between signal strength and spatial-temporal resolution.
Future research may explore adaptive grid-sizing depending on, for instance, demand density.


\section{test}
\index{test}
Used mainly to test the code. It checks that some conditions are true, otherwise it aborts with an error.

\begin{description}

\item[array=$<$x1 y1 x2 y2 ... xn yn$>$] It requires the options \param{value=$<$value$>$}, \param{error=$<$error$>$}, \param{init=$<$init$>$} and \param{end=$<$end$>$} it checks that for all the xs between \param{init} and \param{end} the ys have a relative error smaller than \param{error} with respect to \param{value}. It prints the maximum relative error in the array.
\item[array.2D] Similar to \param{array} but with input in 2D.
\item[array.3D] Similar to \param{array} but with input in 3D.
\item[arrays.2D] Compares that, given two 2D arrays in \param{one} and \param{two}, their $x$ and $y$ are identical and the values are withing a relative error smaller than \param{error}.
\item[float=$<$number$>$]  It requires the options \param{value=$<$value$>$} and \param{error=$<$error$>$}. It checks that \param{number} has a relative error smaller than \param{error} with respect to \param{value}. It prints the relative error in the array.
\item[equal] It tests that \param{one} is equal to \param{two}.
\item[interval] Tests that \param{value} is between \param{begin} and \param{end}.
\item[not] Inverts the meaning of the test, i.e., returns OK it is NOT passed.
\item[tag=$<$tag$>$] Optional argument that allows setting a ``tag'' associated with this test. Useful to distinguish between test commands when many are called.
\end{description}

\subsection{Examples}
\begin{itemize}
\item \verb+test float=[extract count.particles] value=9 error=0+
\item \verb+test float=[extract count.particles particle=I] value=4 error=0+
\item \verb+test float=[extract count.particles particle=V] value=5 error=0+
\item \verb+test one="Hola" not equal two="hola"+
\end{itemize}


\section{Outline}
This is a temporary section for the outline/to-do list.
\begin{itemize}
\item[•] Framework of GP: model data augmentation with the established model grid
\item[•] Two strategies: S1 is from observables to fundamentals for modelling stars; S2 is from fundamentals to observables for augmenting model grids. \item[•] Step 1: selection of GP model inputs. Key points include independence of inputs and overlapping of the ranges of base data.
\item[•] Step 2: selection of GP kernels and validation.
\item[•] Step 3: uncertainty analysis. Key points include unreliable GP variance and the produce of uncertainty estimating.
\item[•] Step 4: Application of S1: 1) fake stars (MS, turn-off, subgiant) 2) real stars (the Sun, turn-off star, subgiant star) 3) solar calibration
\item[•] Step 5: Application of S2: augmenting the base grid (challenges, limitations due to grid step etc.)
\end{itemize}


%
% Chapter 3
%
\chapter {Basics of Quantum Error Correction}

This chapter explains the basic concepts to understand how quantum computations can be performed reliably in the presence of noise. Given the fragility of coherent quantum systems, quantum error correction and fault-tolerant quantum computation are fundamental arbitrarily large quantum algorithms operating on many qubits.

\section{Noise and Error Correction}

Noise can introduce errors in data while it is being processed, sent through a channel and/or stored in a medium. A common error that can be introduced by noise is a bit flip (e.g. $0 \rightarrow 1$, $1 \rightarrow 0$). The task of error correction is to detect when an error has occurred and correct it.

In classical error correction, coding based on data-copying is extensively used. The key idea is to protect data against the effects of noise by adding redundancy. For example, a classical repetition code can encode a logical bit using three physical bits:
$$0 \rightarrow 000$$
$$1 \rightarrow 111$$

The problem is that classical error correction techniques cannot be directly applied to qubits because of the following reasons:
\begin{itemize}
    \item It is impossible to create an independent and identical copy of a qubit in an arbitrary unknown state. This is known as the no-cloning theorem of quantum mechanics and it has the consequence that qubits cannot be protected from errors by simply making multiple copies.
    \todo{Find reference for the no-cloning theorem.}
    \item Measurement destroys quantum information, implying that we cannot measure a qubit to decide which correcting action to perform.
    \item In addition to bit flip errors ($\ket{\psi}=\alpha\ket{0}+\beta\ket{1} \rightarrow \ket{\psi}=\alpha\ket{1}+\beta\ket{0}$), qubits are also susceptible to phase flip errors ($\ket{\psi}=\alpha\ket{0}+\beta\ket{1} \rightarrow \ket{\psi}=\alpha\ket{0}-\beta\ket{1}$) that have no classical analogous. Therefore, quantum error correction must be able to simultaneously correct for both.
    \item Errors in quantum information are continuous. This means that qubits, in the presence of noise, experience angular shifts rather than full bit or phase flips.
\end{itemize}

\section{Bit Flip Code}

\todo{Describe and show how a bit flip code works.}

\section{Phase Flip Code}

\todo{Describe and show how a phase flip code works.}

\section{Shor Code}

\todo{Describe and show how the Shor code works and how it can completely correct a qubit from any type of errors.}

\section{Fault-Tolerant Quantum Computation}

\todo{Describe the concept of fault-tolerant quantum computation and how fault-tolerant quantum gates are constructed.}

\section{Threshold Theorem}

\todo{Explain the threshold theorem and why it is important.}


\documentclass[11pt]{paper}
\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                   % ... or a4paper or a5paper or ...
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage{hyperref}
\usepackage{natbib}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}

\newcommand{\aap}{{\it A\&A}}
%\newcommand{\aaps}{{\it A\&AS}}
\newcommand{\aj}{{\it AJ}}
\newcommand{\apj}{{\it ApJ}}
\newcommand{\apjl}{{\it ApJL}}
\newcommand{\mnras}{{\it MNRAS}}
\newcommand{\pasp}{{\it PASP}}

\title{Planetary Astrophysics Midterm:\\MCMC RV Fitting}
\author{Samuel Factor}
\date\today{}                                           % Activate to display a given date or no date

\begin{document}
\maketitle

Code can be found at \url{https://github.com/sfxfactor/PlanetaryMidterm}. The program \texttt{MCMCrv.py} runs a metropolis-hastings (MH) MCMC algorithm with a Gibbs sampler on radial velocity (RV) data of HD 209458. The data is in \texttt{RV.dat}. The \texttt{plots.py} program analyses the output Markov chain and generates the relevant plots.

The MCMC algorithm fits 3 parameters: time zero point $\tau_0$, orbital period $P$, and planetary mass times the $\sin$ of the inclination $M\sin i$. I assume a circular orbit \citep[the actual value of $e$ is $0.0082^{+0.0078}_{-0.0082}$,][]{e} which simplifies the amplitude of the radial velocity, $V_r$, to
\begin{equation}\label{eq:RVa}
    V_r=a\frac{2\pi}{P}\frac{m_p\sin i}{m_*+m_p},
\end{equation}
where $G$ is Newton's gravitational constant, $m_p$ is the mass of the planet, $i$ is the inclination, $m_*$ is the mass of the central star, and $a$ is the semimajor axis. Using Keppler's third law to substitute $P$ for $a$ and assuming $m_*+m_p\approx m_*$, we get
\begin{equation}\label{eq:RV}
    V_r=\left(\frac{2\pi G}{P m_*^2}\right)^{1/3}m_p\sin i.
\end{equation}
The measured radial velocity is then just $V_r\cos\theta$, where $\theta$ is the orbital phase $2\pi(t-\tau_0)/P$.

The MH MCMC algorithm with a Gibbs sampler works by randomly selecting a parameter to vary. A new value for that parameter is then drawn from a Gaussian centered at the current value with a specified width. A $\chi^2$ statistic is then calculated for the proposed step. If the step has a lower $\chi^2$ statistic, it is accepted. If the proposed step has a higher $\chi^2$ statistic, the probability of that step being accepted is $(\exp{\Delta\chi^2/2})$. For a more in depth discussion of the algorithm see \citet{ford}.

The optimum acceptance fraction of a MH sampler is between 40\% (for 1 dimensional parameter space) and 25\% \citep[for many dimensions,][]{baye,convF}. Thus the widths of the Gaussian distribution from which proposed steps are drawn must be fine tuned. A wider distribution results in a smaller acceptance fraction since jumps are larger and more likely to increase $\chi^2$ (and visa-versa for narrower distributions). Fine tuning is performed by fixing the normally random parameter which is changed and watching the acceptance fraction as you change the width. This must be done for all fitted parameters individually. Once this is completed, all parameters are allowed to vary and the acceptance fraction should be in the optimal range. My final acceptance fraction was 36\%. A histogram is shown in Figure \ref{fig:acchist}.

\begin{figure}
\begin{center}
    \includegraphics[width=0.5\textwidth]{outputs/acc.pdf}
    \caption{Histogram (normalized to a probability density of 1) of acceptance for an MCMC run. 0 is reject, and 1 is accept.}
    \label{fig:acchist}
\end{center}
\end{figure}

Before any analysis can be done on the Markov chain, the ``burn in" steps must be discarded. This can be done quantitatively by looking at the autocorrelation of each parameter and discarding $\sim3$ autocorrelation times. Qualitatively it can be done by simply looking at the $\chi^2$ values. When the chain has ``burned in" the $\chi^2$ values will look like noise around a minimum value. This is shown in Figure \ref{fig:chi}. I chose to discard 20,000 steps of my 300,000 step chain.

\begin{figure}
\begin{center}
    \includegraphics[width=0.6\textwidth]{outputs/chiMinusBurn.pdf}
    \caption{$\chi^2$ values after 20,000 steps. There is no downward trend in the values, showing that the chain is fully burned in.}
    \label{fig:chi}
\end{center}
\end{figure}

Median values and $1\sigma$ error bars for the burned in Markov chain are given in Table \ref{tab:bf}. 2D and 1D (marginalized) posterior distributions are shown in Figure \ref{fig:corner}. A phased radial velocity curve showing the data and the best fit model is shown in Figure \ref{fig:rv}.

\begin{table}
    \begin{center}
        \caption{Orbital Parameters for HD 209458b}\label{tab:bf}
        \begin{tabular}{lc}
            \hline\hline
            Parameter & Median ($1\sigma$) \\
            \hline
            $\tau_0 [\mathrm{HJD}]$ & $2451725.174\pm0.004$ \\
            $P [\mathrm{days}]$ & $3.52468\pm0.00002$ \\
            $M\sin i~[M_J]$ & $0.693\pm0.005$ \\
            \hline
        \end{tabular}
    \end{center}
\end{table}

\begin{figure}
\begin{center}
    \includegraphics[width=\textwidth]{outputs/corner.pdf}
    \caption{Posterior probability distributions for the 3 fitted parameters. Contours are at 67\%, 95\%, and 99.7\%. Dashed lines in the 1D marginalized distributions show the median and 67\% confidence interval. Blue lines show the literature values of $P[\mathrm{days}]=3.52472\pm0.00003$ and $M_p[M_J]=0.69\pm0.02$ \citep{e}.}
    \label{fig:corner}
\end{center}
\end{figure}

\begin{figure}
\begin{center}
    \includegraphics[width=0.6\textwidth]{outputs/phrv.pdf}
    \caption{Phased RV curve showing the data and best fit model.}
    \label{fig:rv}
\end{center}
\end{figure}

Something interesting seems to be going on around a phase of 0.5. Upon further investigation, all of these data points are from one epoch (not spread over many phases). This is shown in Figure \ref{fig:err}. This is likely where the slight degeneracy between $\tau_0$ and $P$ is coming from. Since that tight grouping of data points has a lot of leverage on $\chi^2$ locally, shifting the zero point and changing the period accordingly will allow those points to stay near the proposed model. As we have no evidence that these points are anomalous, other than that they qualitatively look off, we cannot exclude them from our analysis.

Since the anomalies are near a phase of zero, it is possible that these data points are taken during transit and are trying to measure either the atmosphere of the planet or the gas being stripped from it. Again, without confirmation that this is actually what these data points are from (i.e. around the \emph{exact} transit time), I do not feel comfortable excluding them from my fit.

\begin{figure}
\begin{center}
    \includegraphics[width=0.6\textwidth]{outputs/rverror.pdf}
    \caption{RV curve showing the data and best fit model around the anomalous data points.}
    \label{fig:err}
\end{center}
\end{figure}
%\section{}
%\subsection{}

\setlength\bibsep{0pt}
\bibliographystyle{apj}
\bibliography{sources}

\end{document}


\documentstyle[11pt,reduce]{article}
\newcommand{\nl}{\hfill\newline}
\newcommand{\bq}{\begin{quotation}}
\newcommand{\eq}{\end{quotation}}
\newcommand{\bi}{\begin{itemize}}
\newcommand{\ei}{\end{itemize}}
\date{}
\title{{\bf DUMMY}\\[3pt]
A package to find the canonical form of expressions involving
dummy variables\\[5pt]
  \mbox{\hfill Version 1.1\hfil}}
\author{Alain Dresse \\
Universit\'e Libre de Bruxelles \\
Boulevard du Triomphe, CP 210/01 \\
B--1050 BRUXELLES \\[3pt]
 and \\[5pt]
Hubert Caprasse \\
Universit\'e de Li\`ege \\
Institut de Physique \\
All\'ee du 6 ao\^ut \\
B--4000 LIEGE \\[3pt]
E--mail: hubert.caprasse@ulg.ac.be}
\begin{document}
\maketitle
\index{DUMMY package}
\section{Introduction}
The possibility to handle dummy variables and to manipulate
dummy summations are important features in many applications. In particular,
in theoretical physics, the possibility to represent complicated expressions
concisely and to realize simplifications efficiently depend
on both capabilities.
However, when dummy variables are used, there are many more  ways
to express a given mathematical objects since
the names of dummy variables may be chosen  almost arbitrarily.
Therefore, from the point of view of computer algebra
the simplification problem is much more difficult.
Given a definite ordering, one is, at least, to find a representation which
is independent of the names chosen for the dummy variables otherwise,
simplifications are impossible.
The package does handle any number of dummy variables and summations
present in expressions which are arbitrary multivariate polynomials
and which  have operator objects eventually dependent on one (or several)
dummy variable(s) as some of their indeterminates.
These operators have the same generality as the one existing in {\tt REDUCE}.
They can be noncommutative, anticommutative or commutative. They can have
any kind of symmetry property.
Such polynomials will be called in the following {\em dummy} polynomials.
Any monomial of this kind will be called  {\em dummy} monomial.
For any such object, the package allows to find a well defined
{\em normal form} in one-to-one correspondance with it.

In section 2, the convention for writing dummy summations is explained
and the available declarations to introduce or suppress dummy variables
are given.

In section 3, the commands allowing to give
various algebraic properties to the operators are described.

In section 4, the use of the function {\tt CANONICAL} is
explained and illustrated.

In section 5, a fairly complete set of references is given.

The use of DUMMY requires that the package {\tt ASSIST}
 version 2.2 be available.
This is the case when {\tt REDUCE 3.6} is used. When loaded, ASSIST is
automatically loaded.
\section{Dummy variables and dummy summations}
A dummy variable (let us name it $dv$) is an identifier which runs from
the integer $i_1$ to another integer $i_2$. To the extent that no
definite space is defined, $i_1$ and $i_2$ are assumed to be some
integers which are the {\em same} for all dummy variables.

If $f$ is any {\tt REDUCE} operator, then the simplest dummy summation
associated to $dv$ is the sum
$$
\sum_{dv=i_1}^{i_2} f(dv)
$$
and is simply written as
$$
f(dv).
$$
No other rules govern the implicit summations. $dv$ can appear as many times
we want since the operator $f$ may depend on an arbitrary number of
variables. So, the package is potentially applicable to many contexts.
For instance, it is possible to add rules of the kind one encounters in
tensor calculus.

Obviously, there are as many ways we want to express the {\em same} quantity.
If the name of another dummy variable is $dum$ then
the previous expression is written as
$$
\sum_{dum=i_1}^{i_2} f(dum)
$$
and the computer algebra system should be able to find that the expression
$$
f(dv)-f(dum);
$$
is equal to $0$.
A very special case which is {\em allowed} is when $f$ is the identity
operator.
So, a generic dummy polynomial will be a sum
of dummy monomials of the  kind
$$
\prod_i c_i*f_i(dv_1,\ldots ,dv_{k_i},fr_1,\ldots , fr_{l_i})
$$
where $dv_1,\ldots,$ are dummy variables while $fr_1, \ldots, $
are ordinary or free variables.

To declare dummy variables, two commands are available:
\begin{itemize}
\item{i.}
\begin{verbatim}
     dummy_base <idp>;
\end{verbatim}
where {\tt idp} is the name of any unassigned identifier.
\item{ii.}
\begin{verbatim}
     dummy_names <d>,<dp>,<dpp> ....;
\end{verbatim}
\end{itemize}
The first one  declares $ idp_1,\ldots, idp_n$ as dummy variables i.e.
all variables of the form $idp_{xxx}$ where $xxx$ is a number
will be dummy variables, such as $idp_1, idp_2,\ldots, idp_{23}$.
The second one gives special names for dummy variables.
All other identifiers which may appear are assumed to be {\em free}.
However, there is a restriction: named and base dummy variables
cannot be declared {\em simultaneously}. The above declarations are
mutually {\em exclusive}.
Here is an example  showing that:
\begin{verbatim}

     dummy_base dv; ==> dv

               % dummy indices are dv1, dv2, dv3, ...

     dummy_names i,j,k; ==>

               ***** The created dummy base dv must be cleared
\end{verbatim}
When this is done, an expression like
\begin{verbatim}
     op(dv1)*sin(dv2)*abs(i)*op(dv2)$
\end{verbatim}
means a sum over $dv_1,dv_2$.
To clear the dummy base, and to create the dummy names $i,j,k$ one is
to do
\begin{verbatim}

      clear_dummy_base; ==> t

      dummy_names i,j,k; ==> t

                 % dummy indices are i,j,k.
\end{verbatim}
When this is done, an expression like
\begin{verbatim}
     op(dv1)*sin(dv2)*abs(x)*op(i)^3*op(dv2)$
\end{verbatim}
means a sum over $i$.
One should keep in mind that every application of the above commands
erases the previous ones.
It is also possible to display the declared dummy names using
{\tt SHOW\_DUMMY\_NAMES}:
\begin{verbatim}
     show_dummy_names(); ==> {i,j,k}
\end{verbatim}
To suppress {\em all} dummy variables one can enter
\begin{verbatim}
     clear_dummy_names; clear_dummy_base;
\end{verbatim}

\section{The Operators and their Properties}
All dummy variables {\em should appear at first level}
as  arguments of operators. For instance, if $i$ and $j$ are
dummy variables, the expression
\begin{verbatim}
     rr:=  op(i,j)-op(j,j)
\end{verbatim}
is allowed but the expression
\begin{verbatim}
     op(i,op(j)) - op(j,op(j))
\end{verbatim}
is {\em not} allowed. This is because dummy variables are not detected
if they appear at a level larger than 1.
Apart from that there is no restrictions. Operators  may be
commutative, noncommutative or even anticommutative. Therefore
they may be elements of an algebra, they may be tensors,
spinors, grassman variables, etc. $\ldots$
By default they are assumed to be {\em commutative} and without symmetry
properties. The {\tt REDUCE} command {\tt NONCOM} is taken into account
and, in addition, the command
\begin{verbatim}
     anticom at1, at2;
\end{verbatim}
makes the operators $at_1$ and $at_2$ anticommutative.

One can also give symmetry properties to them. The usual declarations
{\tt SYMMETRIC and AN\-TI\-SYM\-ME\-TRIC} are taken into account. Moreover
and most important they can be endowed with a {\em partial} symmetry
through the command {\tt SYMTREE}.
Here are three illustrative examples for the $r$ operator:
\begin{verbatim}
     symtree (r,{!+, 1, 2, 3, 4});
     symtree (r,{!*, 1, {!-, 2, 3, 4}});
     symtree (r, {!+, {!-, 1, 2}, {!-, 3, 4}});
\end{verbatim}
The first one makes the operator (fully) symmetric.
The second one declares it antisymmetric with respect
to the three last indices.
The symbols !*,\  !+\  and !-\  at the beginning of each list mean that
the operator has no symmetry, is symmetric or is antisymmetric with respect
to the indices inside the list. Notice that the indices are not denoted
by their names but merely by their natural order of appearance. 1 means the
first written argument of $r$, 2 its second argument etc.
The first command is equivalent to the declaration {\tt symmetric}
except that the number of indices of $r$ is {\em restricted} to
4 i.e. to the number declared in {\tt SYMTREE}.
In the second example $r$  is stated to have no symmetry with respect
to the  first index and is declared  to be antisymmetric with respect
to the three last indices. In the third example, $r$ is made symmetric
with respect to the interchange  of the pairs of indices 1,2
and 3,4 respectively and is made antisymmetric separately within
the pairs $(1,2)$ and $(3,4)$. It is the symmetry of the Riemann tensor.
The anticommutation property and the various
symmetry properties may be suppressed by the commands {\tt REMANTICOM} and
{\tt REMSYM}. To eliminate partial symmetry properties one can also use
{\tt SYMTREE}  itself. For example, assuming that $r$ has the Riemann symmetry,
to eliminate it do
\begin{verbatim}
     symtree (r,{!*, 1, 2, 3, 4});
\end{verbatim}
However, notice that the number of indices remains fixed and equal to 4
while with {\tt REMSYM} it becomes again arbitrary.
\section{The Function {\tt CANONICAL}}
{\tt CANONICAL} is the most important functionality of the package.
It can be applied on any polynomial whether it is a dummy polynommial
or not. It returns a normal form uniquely determined
from the current ordering of the system.
If the polynomial does not contain any dummy index, it is rewriten
taking into account the various operator properties or symmetries described
above.
For instance,
\begin{verbatim}
     symtree (r, {!+, {!-, 1, 2}, {!-, 3, 4}});

     aa:=r(x3,x4,x2,x1)$

     canonical aa; ==>  - r(x1,x2,x3,x4).
\end{verbatim}
If it contains dummy indices, {\tt CANONICAL} takes also into account the
various dummy summations, makes the relevant simplifications,
eventually rename the dummy indices  and returns the resulting normal form.
Here is a simple example:
\begin{verbatim}
    operator at1,at2;
    anticom at1,at2;

    dummy_names i,j,k; ==> t

    show_dummy_names(); ==> {i,j,k}

    rr:=at1(i)*at2(k) -at2(k)*at1(i)$

    canonical rr; => 2*at1(i)*at2(j)
\end{verbatim}
It is important to notice, in the above example, that in addition to
the summations over indices $i$ and $k$, and of the anticommutativity
property of the operators, {\tt canonical} has replaced the index $k$
by the index $j$. This substitution is essential to get full simplification.
Several other examples are given in the test file and, there, the output
of {\tt CANONICAL} is explained.

As stated in the previous section, the dependence of operators on dummy
indices is limited to {\em first} level. An erroneous result
will be generated if it is not the case as the subsequent example
illustrates:
\begin{verbatim}
    operator op;

    dummy_names i,j;

    rr:=op(i,op(j))-op(j,op(j))$

    canonical rr; ==> 0
\end{verbatim}
Zero is obtained because, in the second term, {\tt CANONICAL} has replaced
$j$ by $i$ but has left $op(j)$ unchanged because it {\em does not see}
the index $j$ which is inside. This fact has also the consequence that
it is unable to simplify correctly (or at all) expressions which
contain some derivatives.
For instance ($i$ and $j$ are dummy indices):
\begin{verbatim}
    aa:=df(op(x,i),x) -df(op(x,j),x)$

    canonical aa; ==> df(op(x,i),x) - df(op(x,j),x)
\end{verbatim}
instead of zero.
A second limitation is that {\tt CANONICAL} does not add anything to the
 problem of simplifications when side relations (like Bianchi identities)
are present.
\section{Bibliography}
\begin{list}{-}{\parsep 0in \itemsep 1pt}
\item\  {\bf Butler, G. and Lam, C. W. H.},
   ``A general backtrack algorithm for the isomorphism problem of
     combinatorial objects",
 J. Symb. Comput. vol.1, (1985) p.363-381.
\item\ {\bf Butler, G. and Cannon, J. J.},
    ``Computing in Permutation and Matrix Groups {I}: Normal Closure,
        Commutator Subgroups, Series",
 Math. Comp. vol.39, number 60, (1982), p. 663-670.
\item\ {\bf Butler, G.},
     ``Computing in Permutation and Matrix Groups {II}:
       Backtrack Algorithm",  Math. Comp. vol.39, number 160,
      (1982), p.671-680.
\item\  {\bf Leon, J.S.},
 ``On an Algorithm for Finding a Base and a Strong
Generating Setfor a Group Given by Generating Permutations'',
Math. Comp. vol.35, (1980), p941-974.
\item\  {\bf Leon, J. S.},
 ``Computing Automorphism Groups of Combinatorial Objects'',
 Proc. {LMS} Symp. on Computational Group Theory, Durham,
                  England, editor: Atkinson, M. D.,
 Academic Press, London, (1984).
\item\  {\bf Leon, J. S.},
``Permutation Group Algorithms Based on Partitions, {I}: Theory and
          Algorithms'', J.Symb. Comput.vol.12, (1991) p. 533-583.
\item\  {\bf Linton, Stephen Q.}, ``Double Coset Enumeration'',
        J. Symb. Comput., vol.12, (1991) p. 415-426.
\item\ {\bf McKay, B. D.},
``Computing Automorphism Groups and Canonical Labellings of Graphs'',
Proc. Internat. Conf. on Combinatorial Theory,
Lecture Notes in Mathematics`` vol. 686, (1977), p.223-232,
Springer-Verlag, Berlin.
\item\ {\bf Rodionov, A. Ya. and Taranov, A. Yu.},
``Combinatorial Aspects of Simplification of
Algebraic Expression'', Proceedings of Eurocal 87,
Lecture Notes in Comp. Sci., vol. 378,  (1989), p. 192.
\item\ {\bf Sims, C. C.},
``Determining the Conjugacy Classes of a Permutation Group'',
Computers in Algebra and Number Theory,
SIAM-AMS Proceedings, vol. 4, (1971), p. 191-195,
editor G. Birckhoff and M. {Hall Jr.}, Amer. Math. Soc..
\item\ {\bf Sims, C. C.},
``Computation with Permutation Groups'',
Proc. of the Second Symposium on Symbolic and Algebraic
                          Manipulation, (1971), p. 23-28,
editor S. R. Petrick, Assoc. Comput. Mach., New York.
\item\ {\bf   Burnel A., Caprasse H., Dresse A.},
`` Computing the BRST operator used in Quantization of Gauge Theories''
IJMPC vol. 3, (1993) p.321-35.
\item\ {\bf Caprasse H.},
``BRST charge and Poisson Algebras'',
Discrete Mathematics and Theoretical Computer Science,
Special Issue: Lie Computations papers, http://dmtcs.thomsonscience.com,
(1997).
\end{list}
\end{document}


\subsection{Homogeneous electron gas}
\label{sec:hegbasis}

The interacting Fermi liquid has its own special \ixml{determinantset} for filling up a
Fermi surface.  The shell number can be specified separately for both spin-up and spin-down.
This determines how many electrons to include of each time; only closed shells are currently
implemented.  The shells are filled according to the rules of a square box; if other lattice
vectors are used, the electrons might not fill up a complete shell.

This following example can also be used for Helium simulations by specifying the
proper pair interaction in the Hamiltonian section.

\begin{lstlisting}[style=QMCPXML,caption=2D Fermi liquid example: particle specification ]
<qmcsystem>
<simulationcell name="global">
<parameter name="rs" pol="0" condition="74">6.5</parameter>
<parameter name="bconds">p p p</parameter>
<parameter name="LR_dim_cutoff">15</parameter>
</simulationcell>
<particleset name="e" random="yes">
<group name="u" size="37">
<parameter name="charge">-1</parameter>
<parameter name="mass">1</parameter>
</group>
<group name="d" size="37">
<parameter name="charge">-1</parameter>
<parameter name="mass">1</parameter>
</group>
</particleset>
</qmcsystem>
\end{lstlisting}

\begin{lstlisting}[style=QMCPXML,caption=2D Fermi liquid example (Slater Jastrow wavefunction) ]
<qmcsystem>
  <wavefunction name="psi0" target="e">
      <determinantset type="electron-gas" shell="7" shell2="7" randomize="true">
  </determinantset>
      <jastrow name="J2" type="Two-Body" function="Bspline" print="no">
        <correlation speciesA="u" speciesB="u" size="8" cusp="0">
          <coefficients id="uu" type="Array" optimize="yes">
        </correlation>
        <correlation speciesA="u" speciesB="d" size="8" cusp="0">
          <coefficients id="ud" type="Array" optimize="yes">
        </correlation>
      </jastrow>
\end{lstlisting}