\documentclass[a4paper,11pt]{article}
\parskip=1.5ex
\usepackage{verbatim,a4margins,graphicx}

\newcommand{\rem}[1]{}

\newcommand{\dd}[2]{\frac{\mathrm d #1}{\mathrm d #2}}
\newcommand{\ddh}[2]{\mathrm d #1/\mathrm d #2}
\newcommand{\dds}[2]{\frac{\mathrm d^2 #1}{{\mathrm d #2}^2}}
\newcommand{\ddhp}[3]{\mathrm d^{#3} #1/{\mathrm d #2}^{#3}}
\newcommand{\pdd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\pdds}[2]{\frac{\partial^2 #1}{\partial{#2}^2}}
\newcommand{\pddd}[3]{\frac{\partial^2 #1}{\partial #2\partial #3}}

\newcommand{\rowfour}[4]{\left[\begin{array}{cccc}#1&#2&#3&#4\end{array}\right]}
\newcommand{\vectwo}[2]{\left[\begin{array}{c}#1\\#2\end{array}\right]}
\newcommand{\vecthree}[3]{\left[\begin{array}{c}#1\\#2\\#3\end{array}\right]}
\newcommand{\mxtwo}[4]{\left[\begin{array}{cc}#1&#2\\#3&#4\end{array}\right]}

\newcommand{\sq}[1]{\left(#1\right)^2}

\newcommand{\B}{\mathbf B}
\newcommand{\F}{\mathbf F}
\newcommand{\x}{\mathbf x}
\newcommand{\p}{\mathbf p}
\newcommand{\vv}{\mathbf v}
\newcommand{\uv}{\mathbf u}
\newcommand{\s}{\mathbf s}
\newcommand{\M}{\mathbf M}

\newcommand{\avg}[1]{\langle#1\rangle}
\newcommand{\avgbig}[1]{\left<#1\right>}

% Twiss command from thesis.txt scaled for 11pt rather than 12pt
\newcommand{\twiss}[1]{\raisebox{-2.5pt}{\includegraphics[height=11pt]{t#1.png}}}
\newcommand{\talpha}{\twiss{alpha}}
\newcommand{\tbeta}{\twiss{beta}}
\newcommand{\tgamma}{\twiss{gamma}}

\begin{document}

\title{Matching to Drift Spaces Containing Acceleration}
\author{Stephen Brooks}
\maketitle

\section{Matching to Drift Spaces}
The transfer matrix of a drift space of length $L$ is shown in the equation below:
\[ \vectwo{x}{x'}(L) = \mxtwo{1}{L}{0}{1} \vectwo{x}{x'}(0), \]
with $y$ and $y'$ behaving similarly.  Writing the phase space vector as $\s=\vectwo{x}{x'}$, it can be seen that under a linear mapping $\s \mapsto \M\s$, the matrix $\avg{\s\s^T}$, where the average is taken over a beam of particles, transforms as $\avg{\s\s^T} \mapsto \avg{\M\s\s^T\M^T} = \M\avg{\s\s^T}\M^T$, assuming all particles have the same transfer matrix $\M$ (this is true if, for example, there is no momentum spread).

The covariance matrix is related to the geometric emittance and optical parameters via 
\[ \avg{\s\s^T} = \varepsilon \mxtwo{\tbeta}{-\talpha}{-\talpha}{\tgamma} \qquad \varepsilon = \sqrt{\det \avg{\s\s^T}}, \]
so the matrix containing \talpha, \tbeta, \tgamma\ has unit determinant, meaning $\tbeta\tgamma-\talpha^2=1$.  Transporting this matrix using the transformation law through the drift defined above gives
\[ \avg{\s\s^T}(L) = \M\avg{\s\s^T}(0)\M^T = \mxtwo{1}{L}{0}{1} \varepsilon \mxtwo{\tbeta}{-\talpha}{-\talpha}{\tgamma} \mxtwo{1}{0}{L}{1} \]
\[ = \varepsilon \mxtwo{1}{L}{0}{1} \mxtwo{\tbeta-L\talpha}{-\talpha}{-\talpha+L\tgamma}{\tgamma}
 = \varepsilon \mxtwo{\tbeta-2L\talpha+L^2\tgamma}{-\talpha+L\tgamma}{-\talpha+L\tgamma}{\tgamma}. \]
Since $\M$ has determinant one in this case, the determinant of $\avg{\s\s^T}$ has not changed and the new emittance is the same as the old.  Eliminating the optical parameter $\tgamma$ gives the evolution of the other two through the drift space:
\[ \tgamma = \frac{1+\talpha^2}{\tbeta} \qquad \Rightarrow \qquad 
\tbeta(L) = \tbeta-2\talpha L+\frac{1+\talpha^2}{\tbeta}L^2, \qquad
\talpha(L) = \talpha-\frac{1+\talpha^2}{\tbeta}L. \]
When matching to a drift space, it is often desirable to have reflection symmetry in $z$ about its centre, which means $\tbeta(0)=\tbeta(L)$ and $\talpha(0)=-\talpha(L)$.  The change of sign is because $\talpha$ is a linear combination of $xx'$ terms and $x'$ changes sign when reflected in $z$ (but $x$ does not).  The requirements for symmetrical matching are therefore
\[ \tbeta = \tbeta-2\talpha L+\frac{1+\talpha^2}{\tbeta}L^2 \qquad \Rightarrow \qquad 0=-2\talpha+\frac{1+\talpha^2}{\tbeta}L, \]
\[ \talpha = -\talpha+\frac{1+\talpha^2}{\tbeta}L. \]
Both of these are equivalent to
\[ 2\talpha = \frac{1+\talpha^2}{\tbeta}L \qquad \Rightarrow \qquad \tbeta = \frac{1+\talpha^2}{2\talpha}L. \]
Since $\tbeta$ is positive, this restricts solutions to $\talpha>0$.  The minimum value of $\tbeta(0)$ is achieved when $\talpha=1$ and $\tbeta=L$.  Above this, each value of $\tbeta$ is consistent with two different values of $\talpha$, one greater and one less than one.

The optical functions at the centre of the drift may also be of interest in this case, they are given by
\begin{eqnarray*}
 \tbeta(L/2) &=& \tbeta-\talpha L+\frac{1+\talpha^2}{4\tbeta}L^2 \\
&=& \frac{1+\talpha^2}{2\talpha}L-\talpha L+\frac{1+\talpha^2}{4}L^2\frac{2\talpha}{(1+\talpha^2)L} \\
&=& \frac{1+\talpha^2}{2\talpha}L-\talpha L+\frac{\talpha L}{2} = \left(\frac{1+\talpha^2}{2\talpha}-\frac{\talpha}{2}\right)L\\
&=& \frac{L}{2\talpha}
\end{eqnarray*}
and
\begin{eqnarray*}
\talpha(L/2) &=& \talpha-\frac{1+\talpha^2}{2\tbeta}L \\
&=& \talpha-\frac{1+\talpha^2}{2}\frac{2\talpha}{(1+\talpha^2)L}L \\
&=& 0,
\end{eqnarray*}
as would be expected by symmetry.  The beam size at this point is $\sqrt{\varepsilon\tbeta(L/2)} = \sqrt{\varepsilon L/2\talpha}$.


\section{Motion in a Uniform Accelerating Field}
Consider a particle of charge $q$ in a constant longitudinal electric field $E_z$.  The total energy of the particle satsifies $\ddh{E}{z}=qE_z$ and since relativistically $E=\gamma mc^2$,
\[ \dd{\gamma}{z} = \frac{qE_z}{mc^2} = \gamma', \]
which is a constant.  This means that for appropriate choice of $z$ origin, $\gamma=\gamma'z$.

\newcommand{\lnbgg}{\ln(\beta\gamma+\gamma)}
Assuming there is no other force on the particle, its transverse momentum components $p_x$ and $p_y$ are constant and the paraxial approximation yields
\[ x' = \frac{p_x}{p_z} \simeq \frac{p_x}{p} = \frac{p_x}{m\beta\gamma c} = C_1 \frac{1}{\beta\gamma} \]
for the constant $C_1=\frac{p_x}{mc}$.  To calculate $x$, use the identity $(\beta\gamma)^2=\gamma^2-1$ to express
\[ x' = C_1\frac{1}{\sqrt{\gamma^2-1}} \]
then note that
\[ \int \frac{1}{\sqrt{\gamma^2-1}}\ \mathrm d\gamma = \ln\left(\sqrt{\gamma^2-1}+\gamma\right)+C \]
so substituting $\mathrm d\gamma = \gamma'\mathrm dz \ \Rightarrow\  \mathrm dz = \mathrm d\gamma/\gamma'$ gives
\begin{eqnarray*}
x &=& \int x' \mathrm dz = \int C_1\frac{1}{\sqrt{\gamma^2-1}}\ \mathrm dz
= C_1 \int \frac{1}{\sqrt{\gamma^2-1}} \frac{\mathrm d\gamma}{\gamma'} \\
&=& \frac{C_1}{\gamma'}\ln\left(\sqrt{\gamma^2-1}+\gamma\right)+C_0 \\
&=& \frac{C_1}{\gamma'}\lnbgg+C_0.
\end{eqnarray*}

Next, consider relating the phase space vector at $z=z_1$ to that at $z=z_0$.  For $x'$,
\[ \frac{x'(z_1)}{x'(z_0)} = \frac{\beta\gamma(z_0)}{\beta\gamma(z_1)} \qquad \Rightarrow \qquad x'(z_1) = \frac{\beta\gamma(z_0)}{\beta\gamma(z_1)} x'(z_0). \]
Implicitly, this sets $C_1 = x'(z_0)\beta\gamma(z_0)$, which allows some progress when eliminating $C_0$ from $x$:
\[ x(z_1)-x(z_0) = \frac{C_1}{\gamma'}\left(\lnbgg(z_1)-\lnbgg(z_0)\right) \]
\[ \Rightarrow \quad x(z_1) = x(z_0) + x'(z_0)\frac{\beta\gamma(z_0)}{\gamma'}\left(\lnbgg(z_1)-\lnbgg(z_0)\right). \]
This reveals that the transfer matrix is linear:
\[ \vectwo{x}{x'}(z_1) = \mxtwo{1}{\frac{\beta\gamma(z_0)}{\gamma'}\left(\lnbgg(z_1)-\lnbgg(z_0)\right)}{0}{\frac{\beta\gamma(z_0)}{\beta\gamma(z_1)}} \vectwo{x}{x'}(z_0). \]

However, this transfer matrix has determinant $\frac{\beta\gamma(z_0)}{\beta\gamma(z_1)}$, meaning $\varepsilon(z_1)=\varepsilon(z_0)\frac{\beta\gamma(z_0)}{\beta\gamma(z_1)}$.  For compactness, the entries in the right-hand column of the transfer matrix are written as $A$ and $B$ when working out how the covariance matrix transforms:
\[ \avg{\s\s^T}(z_1) = \mxtwo{1}{A}{0}{B} \avg{\s\s^T}(z_0) \mxtwo{1}{0}{A}{B}
 = \varepsilon(z_0) \mxtwo{1}{A}{0}{B} \mxtwo{\tbeta}{-\talpha}{-\talpha}{\tgamma} \mxtwo{1}{0}{A}{B} \]
\[ = \varepsilon(z_0) \mxtwo{1}{A}{0}{B} \mxtwo{\tbeta-A\talpha}{-B\talpha}{-\talpha+A\tgamma}{B\tgamma}
 = \varepsilon(z_0) \mxtwo{\tbeta-2A\talpha+A^2\tgamma}{-B\talpha+AB\tgamma}{-B\talpha+AB\tgamma}{B^2\tgamma}. \]
If $A=L$ and $B=1$ this is the same matrix found in the section about drift spaces.  Noting that $\varepsilon(z_0)=\varepsilon(z_1)/B$, the optical parameters evolve as follows:
\begin{eqnarray*}
\tbeta(z_1) &=& \frac1B\tbeta-\frac{2A}{B}\talpha+\frac{A^2}{B}\tgamma = \frac1B\left(\tbeta-2A\talpha+A^2\frac{1+\talpha^2}{\tbeta}\right), \\
\talpha(z_1) &=& \talpha-A\tgamma = \talpha-A\frac{1+\talpha^2}{\tbeta}.
\end{eqnarray*}


\section{Consistent Matching with Acceleration}
Since the energy and emittance change from one end of the accelerating section to the other, it is not desirable (or even possible) for it to have optics that are symmetrical under a reflection in $z$.  Instead, consider a family of matching conditions $\tbeta(E)$, $\talpha(E)$ for each energy at the entrance to the section.  If the acceleration is used multiple times, as in an ERL, the same beam that left the section at energy $E$ will return to it at the same energy.  If the transfer line or ring that accomplished this is itself symmetrical in $z$ (or optically equivalent), then the beam that entered the accelerating section with $\tbeta(E)$ and $\talpha(E)$ must have left it with $\tbeta(E)$ and $-\talpha(E)$.  That is, if the section has energy gain $\Delta E$, it maps
\[ \tbeta(E), \talpha(E) \mapsto \tbeta(E+\Delta E), -\talpha(E+\Delta E), \]
a condition that will be referred to here as \emph{consistent matching}.  In the model where the accelerating section is just a constant $E_z$ field, this means 
\begin{eqnarray*}
\tbeta(E+\Delta E) &=& \frac1B\left(\tbeta(E)-2A\talpha(E)+A^2\frac{1+\talpha(E)^2}{\tbeta(E)}\right), \\
\talpha(E+\Delta E) &=& -\talpha(E)+A\frac{1+\talpha(E)^2}{\tbeta(E)},
\end{eqnarray*}
where
\begin{eqnarray*}
A &=& \frac{\beta\gamma(E)}{\gamma'}\left(\lnbgg(E+\Delta E)-\lnbgg(E)\right), \\
B &=& \frac{\beta\gamma(E)}{\beta\gamma(E+\Delta E)}.
\end{eqnarray*}

\subsection{High Energy Limit}
As energy tends to infinity, $A$ tends to $L$ and $B$ tends to one, recovering the matching situation for a drift space.  Although the equations permit various oscillating solutions with energy, it seems more natural that the limits $\tbeta,\talpha(\infty)=\lim_{E\rightarrow\infty}\tbeta,\talpha(E)$ exist and obey the drift entrance matching condition:
\[ \tbeta(\infty) = \frac{1+\talpha(\infty)^2}{2\talpha(\infty)}L. \]
\rem {In this case,
\[ \tgamma(\infty) = \frac{1+\talpha(\infty)^2}{\tbeta(\infty)} = \frac{2\talpha(\infty)}{L}. \]}
The only free parameter is thus $\talpha(\infty)$.

\subsection{Simplification by Substitution}
Examining the first recurrence relation with definitions of $A$ and $B$ expanded reveals some scaling structure:
\[ \tbeta(E+\Delta E) = \frac{\beta\gamma(E+\Delta E)}{\beta\gamma(E)}\left(\tbeta(E)-2\frac{\beta\gamma(E)}{\gamma'}\Delta_{\ln}\talpha(E)+\left(\frac{\beta\gamma(E)}{\gamma'}\Delta_{\ln}\right)^2\frac{1+\talpha(E)^2}{\tbeta(E)}\right), \]
where for compactness $\Delta_{\ln} = \lnbgg(E+\Delta E)-\lnbgg(E)$.  Notice that each appearance of $\tbeta$ is divided by $\beta\gamma$ overall, a feature that becomes even clearer if both sides are divided by $\beta\gamma(E+\Delta E)$.  It therefore makes sense to define a `normalised' beta function
\[ \tbeta_n(E) = \frac{\tbeta(E)}{\beta\gamma(E)}, \]
though note that this scaling is opposite to that used in the conventional definition of normalised emittance.  In terms of $\tbeta_n$, the recurrence relations become
\begin{eqnarray*}
\tbeta_n(E+\Delta E) &=& \tbeta_n(E)-2\frac{\Delta_{\ln}}{\gamma'}\talpha(E)+\left(\frac{\Delta_{\ln}}{\gamma'}\right)^2\frac{1+\talpha(E)^2}{\tbeta_n(E)}, \\
\talpha(E+\Delta E) &=& -\talpha(E)+\frac{\Delta_{\ln}}{\gamma'}\frac{1+\talpha(E)^2}{\tbeta_n(E)}.
\end{eqnarray*}
It is possible to simplify slightly further by defining another modified $\tbeta$, which is dimensionless:
\[ \tbeta_m(E) = \gamma' \tbeta_n(E) = \frac{\gamma' \tbeta(E)}{\beta\gamma(E)}, \]
so that
\begin{eqnarray*}
\tbeta_m(E+\Delta E) &=& \tbeta_m(E)-2\Delta_{\ln}\talpha(E)+\Delta_{\ln}^2\frac{1+\talpha(E)^2}{\tbeta_m(E)}, \\
\talpha(E+\Delta E) &=& -\talpha(E)+\Delta_{\ln}\frac{1+\talpha(E)^2}{\tbeta_m(E)}.
\end{eqnarray*}

\rem{ % looks pretty but Delta_ln definition wrong for this to be invariant
Subtracting $\Delta_{\ln}$ times the second equation from the first gives
\[ \tbeta_m(E+\Delta E) - \Delta_{\ln}\talpha(E+\Delta E) = \tbeta_m(E)-\Delta_{\ln}\talpha(E) \]
}

\rem{ % doesn't work because delta_ln changes
Another promising-looking substitution is to put 
\[ \talpha_n(E) = \frac{\Delta_{\ln}}{\gamma'}\talpha(E), \]
which turns the recurrence relations into
\begin{eqnarray*}
\tbeta_n(E+\Delta E) &=& \tbeta_n(E)-2\talpha_n(E)+\frac{(\Delta_{\ln}/\gamma')^2+\talpha_n(E)^2}{\tbeta_n(E)}, \\
\talpha_n(E+\Delta E) &=& \talpha_n(E)-\frac{(\Delta_{\ln}/\gamma')^2+\talpha_n(E)^2}{\tbeta_n(E)}.
\end{eqnarray*}
}

\rem{
\subsection{Series Expansion}
To simplify the mathematics and leave the particle mass $m$ out of the equations, the matched optical functions will now be parameterised by relativistic $\gamma$ instead of energy $E$.  The linac will produce a change in $\gamma$ of $\Delta\gamma = \Delta E / mc^2 = L\gamma'$.  A series representation assuming convergent behaviour as $\gamma\rightarrow\infty$ is proposed below:
\[ \tbeta_m(\gamma) = \sum_{n=1}^\infty b_n \gamma^{-n}, \qquad \talpha(\gamma) = \sum_{n=0}^\infty a_n \gamma^{-n}. \]
Here $a_0=\talpha(\infty)$ and $b_1=\gamma'\tbeta(\infty)$ is the first term for $\tbeta_m$ because the normalised beta function actually goes to zero as $\gamma\rightarrow\infty$.

Finding the coefficients in this series will be done by computer but first it has to be shown that this can be done in a logical order, without circular dependencies.  Suppose the coefficients are known up to and including $a_N$ and $b_M$ for some integers $N,M$.

% I can probably show causality of the series but the equation for a_{N+1} and b_{M+1} at each stage could be nonlinear.
}

\rem{
\subsection{Ultra-Relativistic Limit}
In the ultra-relativistic limit, $\lnbgg \simeq \ln(2\gamma) = \ln \gamma + \ln 2$ so that $\Delta_{\ln} = \ln(\gamma+\Delta \gamma)-\ln \gamma$.
}

\end{document}
