\begin{centering}
{\Large Transfer Line Dispersion}\\
{ D. Rubin}\\
February 26, 2024\\
\end{centering}
\bigskip
It is convenient to evaluate the dispersion as if the ring were a series of transfer lines in order to determine the relationship
between radial offset and momentum offset at any point $s$ along the trajectory. To that end note that the radial phase space coordinates are propagated according to
\begin{eqnarray*}
\begin{pmatrix}x \cr x^\prime \cr l \cr \delta\end{pmatrix}_f &=& \begin{pmatrix} M & m\cr n & N\end{pmatrix}  \begin{pmatrix}x \cr x^\prime \cr l \cr \delta\end{pmatrix}_i \\
\end{eqnarray*}
where $M$,$m$, $n$, and $N$ are 2X2 matrices and subscripts $i$ and $f$ refer to initial and final values.
Then
\begin{eqnarray*}
\begin{pmatrix}x \cr x^\prime \end{pmatrix}_f& =&  M   \begin{pmatrix}x \cr x^\prime\end{pmatrix}_i + m\begin{pmatrix} l \cr \delta\end{pmatrix}_i \\
\end{eqnarray*}
and the dispersion is given by
\begin{eqnarray}
\der{}{\delta}\begin{pmatrix}x \cr x^\prime \end{pmatrix}_f& =&  M  \der{}{\delta} \begin{pmatrix}x \cr x^\prime\end{pmatrix}_i + m\der{}{\delta}\begin{pmatrix} l \cr \delta\end{pmatrix}_i \label{der}\\
\begin{pmatrix}D \cr D^\prime \end{pmatrix}_f& =&  M  \begin{pmatrix}D \cr D^\prime\end{pmatrix}_i + m \begin{pmatrix} 0 \cr 1\end{pmatrix}_i \label{dispersion}
\end{eqnarray}

%Since there is no dependence on the longitudinal position $l$, the matrix $N$ has the form
%\begin{equation} 
%N = \begin{pmatrix} 1 & f \cr 0 & 1\end{pmatrix}
%\end{equation}
%where $f$ has dimensions of length.
For clarity, explicit examples of $M$ and $m$,
are given for a sector dipole
\begin{eqnarray*}
M&=&\begin{pmatrix}\cos\theta & \rho\sin\theta\cr -\frac{1}{\rho}\sin\theta & \cos\theta\end{pmatrix}\\
m&=&\begin{pmatrix}0 & \rho(1-\cos\theta)\cr 0 & \sin\theta\end{pmatrix}
\end{eqnarray*}
where $\theta = \frac{L}{\rho}$.
Of course we can determine the matrices by computing the Jacobian of the mapping from $i$ to $f$.
If we treat the storage ring like a transfer line with periodic lattice then the dispersion at some distance $s$ from the starting point is
\begin{equation}
\begin{pmatrix}D(s) \cr D^\prime(s) \end{pmatrix}= M(s\leftarrow s_0)  \begin{pmatrix}D(s_0) \cr D^\prime(s_0)\end{pmatrix} + m(s\leftarrow s_0) \begin{pmatrix} 0 \cr 1\end{pmatrix} \\
\end{equation}
(For example, the dispersion $\frac{3}{4}$ of the way through the $100^{th}$ turn, is $D(s)$ where $s=(99+\frac{3}{4})C$ and $C$ is the ring circumference.
)

At $s_0$, the inflector exit, the dispersion $D(s_0)=D^\prime(s_0)=0$. Then
\begin{equation}
\begin{pmatrix}D(s) \cr D^\prime(s) \end{pmatrix}= m(s\leftarrow s_0) \begin{pmatrix} 0 \cr 1\end{pmatrix} \\
\end{equation}
We can compute $m(s \leftarrow s_0)$ at any distance $s$ from the inflector exit by concatenating full and partial turn transport matrices, giving us $D(s)$ for any $s$.
$D(s)$ will indeed be a maximum where the radial width of the distribution is maximal and a minimum where the width is minimal.
But it allows us to use all of the data, not just at minima and maxima, which maybe gives an improved determination of the momentum. 

We can equivalently determine the dispersion by tracking an off momentum particle with initial coordinates $x=x^\prime=0$ as indicated
by equations 1 and 2. 
The result is shown in Figure 1 
with scraping turned off and in Figure 2 with scraping turned on.
\begin{figure}
\centering
\includegraphics[width=.9\linewidth]{DispersionScrapingOff-30us.pdf}
\includegraphics[width=0.9\linewidth]{DispersionScrapingOff-3us.pdf}
\caption{{Dispersion, $D(t) = \der{}{\delta}x(t)$, with scraping off.}
\label{fig:dispersionoff}}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.9\linewidth]{DispersionScrapingOn-30us.pdf}
\includegraphics[width=0.9\linewidth]{DispersionScrapingOn-3us.pdf}
\caption{Dispersion, $D(t) = \der{}{\delta}x(t)$, with scraping on.}
\label{fig:dispersionon}
\end{figure}
