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

\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{\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{\w}{\mathbf w}
\newcommand{\e}{\mathbf e}

\begin{document}

\title{Exact Tracking in $s$ in a Magnetic Field}
\author{Stephen Brooks}
\maketitle

\section{Previous Result}
In a cartesian coordinate system, a particle of charge $q$ and momentum $p$ in a magnetic field $\B$ will follow a curved path according to
\[ \dd{\uv}{z} = \frac{q}{p}\frac{1}{u_z}\uv\times\B, \]
where $\uv=\vv/v=\p/p$ is the unit direction vector of the particle's motion \cite{ztracking}.  This formula is an exact expression of the Lorentz force law (without electric field) provided that $u_z>0$.

This may be manipulated \cite{ztracking} to give the exact evolution of $x'=u_x/u_z$ and $y'=u_y/u_z$ with respect to $z$.  At no point has the paraxial approximation $|x'|,|y'|\ll1$ been used.

\section{Curved Coordinate System}
Curvature $\kappa$ in the $z$--$x$ plane is defined such that positively charged particles experience positive curvature when $B_y>0$.  By the Lorentz force law, if motion is in the $+z$ direction and field is in the $+y$ direction, force on a positive particle will be in the $-x$ direction.  This means the $+x$ direction is aligned with the $+r$ radial direction for $\kappa>0$ (in fact, $r=x+\frac1\kappa$) when the particle is travelling in the $+z$ direction.  Viewed from `above' ($+y$), positive curvature corresponds to clockwise motion with $\ddh\theta{s}=-\kappa$.

In this treatment, $\kappa(s)$ will be a property of the curved reference coordinate system for the entire accelerator and not of any individual particle.  The variable $s$ will agree with arc length on the reference curve of the accelerator and planes of constant $s$ will be perpendicular to the reference curve (up to the axis of curvature).  The curvilinear coordinate $\tilde{x}$ replaces $x$, so that the reference curve satisfies $\tilde{x}=y=0$, with no change needed to $y$ as there is no vertical curvature.

\section{Making $s$ the Independent Variable}
Without loss of generality, analysis from this point on will assume the curvilinear and cartesian axes are momentarily aligned: $\tilde{x}$ with $x$ and $s$ with $z$.  Considering the forward motion in $z$ given by an increment in $s$ gives $\ddh{z}{s}=1+\kappa\tilde{x}$, which equals zero at the centre of curvature $\tilde{x}=-\frac1\kappa$ as expected.

The evolution of $\uv$ can now be restated in terms of $s$, remembering that the elements of $\uv$ are still relative to the fixed cartesian axes:
\[ \dd{\uv}{s} = \dd{\uv}{z}\dd{z}{s} = (1+\kappa\tilde{x})\frac{q}{p}\frac{1}{u_z}\uv\times\B. \]

\section{Rotation of Basis}
The vector $\w$ is defined to contain the same direction as $\uv$ but expressed in the local $\tilde{x},y,s$ basis rather than the $x,y,z$ one.  At the momentary point of axis-alignment, $\w=\uv$ but the derivatives differ by a rotation of rate $-\kappa$:
\[ \dd{\w}{s} = \dd{\uv}{s} + \vecthree{\kappa u_z}{0}{-\kappa u_x} = \dd{\uv}{s} + \uv\times(-\kappa\e_y). \]

\section{Conclusion (Vector Form)}
Combining the previous two results gives
\begin{eqnarray*}
\dd{\w}{s} &=& (1+\kappa\tilde{x})\frac{q}{p}\frac{1}{u_z}\uv\times\B + \uv\times(-\kappa\e_y) \\
&=& \uv\times\left((1+\kappa\tilde{x})\frac{q}{p}\frac{1}{u_z}\B-\kappa\e_y\right) \\
&=& \w\times\left((1+\kappa\tilde{x})\frac{q}{p}\frac{1}{w_s}\B-\kappa\e_y\right),
\end{eqnarray*}
where the final line uses the momentary axis alignment.  As a cartesian basis can be chosen at each point, the analysis holds for all $s$.  Setting $\kappa=0$ in this formula recovers the result for cartesian coordinates.

\subsection{Cyclotron Radius Check}
The form of the above equation means that $\w$ is constant if the term in brackets is zero.  If a particle is travelling directly along the reference trajectory, $\tilde{x}=0$ and $w_s=1$, so $\w$ will be constant (that is, the particle will remain on the reference trajectory) if
\[ \frac{q}{p}\B-\kappa\e_y = 0
\qquad\Rightarrow\qquad
\B = \frac{p}{q}\kappa\e_y = \frac{p}{qR}\e_y, \]
where $R=1/\kappa$ is the radius of curvature.  The relation $B=p/qR$ is the well-known formula for the cyclotron radius.

\section{Geometrical Variables $x'$ and $y'$}
\newcommand{\wx}{w_{\tilde{x}}}
\newcommand{\Bx}{B_{\tilde{x}}}
In the curvilinear coordinate system there are analogous definitions of $x'=\wx/w_s$ and $y'=w_y/w_s$.  Following previous work \cite{ztracking}, their derivatives are given by
\[ \dd{x'}{s} = \frac{1}{w_s}\left(\dd{\wx}{s} - x'\dd{w_s}{s}\right)
\qquad\qquad
\dd{y'}{s} = \frac{1}{w_s}\left(\dd{w_y}{s} - y'\dd{w_s}{s}\right). \]
Next, $\ddh{\w}s$ needs to be expressed in terms of $x'$ and $y'$:
\[ \frac{1}{w_s}\w\times\B = \vecthree{y'B_s-B_y}{\Bx-x'B_s}{x'B_y-y'\Bx}
\qquad\Rightarrow\qquad
\dd{\w}{s} = (1+\kappa\tilde{x})\frac{q}{p}\vecthree{y'B_s-B_y}{\Bx-x'B_s}{x'B_y-y'\Bx}-\kappa\vecthree{-w_s}{0}{\wx}. \]
Since $\frac{1}{w_s} = \sqrt{1+x'^2+y'^2}$,
\[ \frac{1}{w_s}\dd{\w}{s} = \sqrt{1+x'^2+y'^2}\ (1+\kappa\tilde{x})\frac{q}{p}\vecthree{y'B_s-B_y}{\Bx-x'B_s}{x'B_y-y'\Bx}-\kappa\vecthree{-1}{0}{x'}. \]
Finally, combinations of the rows of this vector give
\[  \dd{}{s}\vectwo{x'}{y'} = \sqrt{1+x'^2+y'^2}\ (1+\kappa\tilde{x})\frac{q}{p}\vectwo{y'B_s-B_y-x'^2B_y+x'y'\Bx}{\Bx-x'B_s-x'y'B_y+y'^2\Bx}+\kappa\vectwo{1+x'^2}{x'y'}. \]
The differences with the cartesian formula, apart from relabelling of axes, are the second term and the factor of $1+\kappa\tilde{x}$ in the first term; the cartesian formula is recovered by setting $\kappa=0$.

\subsection{New Derivative of $x$ and $y$}
The variables $x'$ and $y'$ are still the tangents of angles relative to the forward direction, in other words they are \emph{not} equal to $\ddh{\tilde{x}}{s}$ and $\ddh{y}{s}$ but rather $\ddh{\tilde{x}}{z}$ and $\ddh{y}{z}$, recalling that the $z$ axis is momentarily aligned with $s$ but represents a distance.  Thus the equations for updating $\tilde{x}$ and $y$ are now
\[ \dd{}{s}\vectwo{\tilde{x}}{y} = \dd{z}{s}\dd{}{z}\vectwo{\tilde{x}}{y} = (1+\kappa\tilde{x})\vectwo{x'}{y'}. \]

\begin{thebibliography}{9}   % Use for  1-9  references
%\begin{thebibliography}{99} % Use for 10-99 references
\newcommand{\link}[1]{\texttt{#1}}

\bibitem{ztracking} \emph{Exact Tracking in z in a Magnetic Field}, S.J. Brooks, available from \url{http://stephenbrooks.org/ral/report/2012-2/magnetztracking.pdf} (2012).

\end{thebibliography}


\end{document}