
\section {Betatron Oscillations and E-field Systematic}


Because of the finite curvature of the quadrupoles, the E-field correction to $\omega_a$ can depend on the betatron amplitude as well as the momentum.
The muon that circulates at the magic radius with zero betatron oscillation amplitude will see zero electric field and no correction is required. 
But the muon with that same momentum and finite betatron amplitude will oscillate about the
magic radius and its precession will indeed be effected by the E-field. 
If the quad field were strictly antisymmetric about the magic radius and the betatron trajectory strictly symmetric, the net contribution would be zero.
But neither condition is true.   

\subsection*{Electrostatic quadrupole nonlinearity}
Consider the electric field in the quadrupoles. Laplace's equation in two dimensions and cartesian coordinates is
\begin{equation}
\nabla^2 V(x,y) = \frac{\partial^2 V}{\partial x^2}+\frac{\partial^2 V}{\partial y^2} =0
\end{equation}
The potential corresponding to a pure quadrupole field is one (of many) solutions.
$$V = \frac{1}{2} k(x^2 -y^2)$$ for some constant $k$.
The electric field is
$$E={\vec \nabla}V = k(x\hat i -y\hat j)$$
and of course the divergence is zero. The electric field is linear in both $x$ and $y$. Higher order terms may appear (and indeed in the g-2 quads
they well appear due to the geometry of the plates), but the
symmetry (in the 2-D cartesion limit permits only those terms that are odd in $x,y$.
In particular there is no sextupole ($\sim kx^2$) dependence that would be symmetric in displacement.

In the limit of finite curvature (as in the g-2 geometry) it is more appropriate to represent the fields in cylindrical coordinates, where Laplace's equation is
$$\nabla^2 V(\rho,z,\phi) =  \left(\frac{1}{\rho}\frac{\partial}{\partial \rho}\left(\rho \frac{\partial}{\partial \rho}\right) + \frac{1}{\rho^2}\frac{\partial^2 }{\partial \theta^2}+\frac{\partial^2}{\partial z^2}\right)V= 0$$
We assume the quads are continuous so that there is no dependence on the angular coordinate $\phi$.
Then the simplest possible solution is
$$V(\rho,z) = k\left(\frac{1}{2}(\frac{\rho^2}{\rho_0^2}-1)-\ln\frac{\rho}{\rho_0}-\left(\frac{z}{\rho_0}\right)^2\right)$$ 
and the electric field
\begin{equation}
{\vec\nabla V}=\frac{1}{2}k\left((\rho - \frac{\rho_0^2}{\rho}){\hat \rho}-2 z \hat z\right)
\end{equation}

If we write $\rho = \rho_0+x$ where $\rho_0$ is the magic radius, then
\begin{equation}
\vec E \sim k\left((x-\frac{x^2}{2\rho_0}+\ldots){\hat \rho} -z\hat z\right)\label{eq:laplaciansolution}
\end{equation}
Evidently, Maxwell's equations require a term quadratic in displacement. The quadratic term is equivalent to a sextupole-like
component that will effect the chromaticity, complicate the correction
of the E-field systematic, and possibly drive a third order resonance.

The above solution is not unique. One can write alternative solutions where the quadratic ($x^2$) term does not appear in the radial field, but then it always turns up as (($xz$) in the vertical direction.
%There do exist other linear combination of solutions to Laplace's equation with no $x^3$ term in the potential. But those solutions all have a $xy^2$ term which is also a sextupole.
There exist no solutions without some sextupole-like component.
A fit to a 3 dimensional field map would properly identify this term.

Note that the sextupole component that inevitably goes along for the ride with a linear component, due to the curvature of the quad plates, cannot 
drive the $3\nu_y=1$ resonance that appears in the quad scans. That would require a skew sextupole that is forbidden by the quad symmetry, 
and will not appear in the absence of a misalignment or plate voltage error that breaks the symmetry.

In any event, there evidently exists a symmetric component of the E-field which will contribute to the E-field systematic.

\subsection*{Path length}
The radial electric field along the trajectory of a muon with equilibrium radial offset $x_e$ and betatron amplitude $x_{\beta}$ is 
\begin{eqnarray*}
E_r(s) &=& k(x_e + x_\beta) - \frac{1}{2\rho_0}(x_e +x_\beta)^2+\ldots\\ 
E_r(s) &=& k(\eta\delta + x_\beta) - \frac{1}{2\rho_0}(\eta\delta +x_\beta)^2+\ldots\\ 
 \end{eqnarray*}
where $x_e=\eta\delta = \eta \frac{\Delta p}{p}$ and we assume the 'simple' solution to Laplace's equation discussed above.
The muon trajectory is along the path $dl$ as shown in Figure ~\ref{fg:pathlength}. The path {\it s} is the reference orbit.
\begin{figure}[tb]
 \begin{center}
    \includegraphics*[width=0.45\textwidth,angle=0, trim= 0 20 0 10, clip=.true.]{figures/pathlength.pdf}
\caption{Curvilinear coordinate system. The integrated path length for the part of the trajectory at $\rho > \rho_0$ is greater than the length of the path for $\rho < \rho_0$.}
 \label{fg:pathlength}
 \end{center}
 \end{figure}
The average electric field along the trajectory is
\begin{eqnarray}
\langle E_r(s)\rangle &=& k\langle\left(\eta\delta + x_\beta - \frac{1}{2\rho_0}(\eta\delta +x_\beta)^2\right)\rangle\label{eq:sextpluspath}\\ 
 &=& \frac{k}{L}\int_0 \left(\eta\delta + x_\beta - \frac{1}{2\rho_0}(\eta\delta +x_\beta)^2\right) d l\label{eq:sextpluspath2}\\ 
 &=& \frac{k}{L}\int_0 \left(\eta\delta + x_\beta - \frac{1}{2\rho_0}(\eta\delta +x_\beta)^2\right) (1+x_\beta/\rho_0){d s} \label{eq:opposite} 
 \end{eqnarray}
here in that last step we use $d\phi = \frac{ds}{\rho_0}= \frac{dl}{(\rho_0+x)}$, and $L$ is the length of the trajectory.
Using $x_\beta = x_{\beta 0 }\cos\phi(s)$,
$\langle E_r\rangle$ becomes
\begin{eqnarray}
\langle E_r(s)\rangle &=& {k}\int\left(\eta\delta + x_{\beta 0}\cos\phi - \frac{1}{2\rho_0}(\eta\delta +x_{\beta 0}\cos\phi)^2\right){d\phi}(1+x/\rho_0)\nonumber\\ 
 &=& k\int\left(\eta\delta + x_{\beta 0}\cos\phi + \frac{1}{2\rho_0}(\eta\delta +x_{\beta 0}\cos\phi)^2\right) (1+x_{\beta 0}/\rho_0\cos\phi +\eta\delta/\rho_0) d\phi\nonumber\\ 
&=& k\left(\eta\delta - \frac{1}{2\rho_0}((\eta\delta)^2+ \frac{1}{2} x_{\beta 0}^2) +\frac{1}{2\rho_0}x_{\beta 0}^2+(\eta\delta)^2+\ldots    \right)\nonumber\\
&=& k\left(\eta\delta + \frac{1}{2\rho_0}((\eta\delta)^2+ \frac{1}{2} x_{\beta 0}^2) +\ldots    \right)\label{eq:avgefield}
\end{eqnarray}
There is contribution to the average electric field that scales quadratically with the betatron amplitude.
\subsection*{E-field correction}
Following Miller (DocDB 11082) and Nguyen (DocDB 12047), the relative contribution of the E-field to $\omega_a$ is
\begin{equation}
C_e=\left(1-\frac{1}{a_\mu}\frac{m^2}{p^2}\right)\frac{\beta E_r}{cB}\sim \left(1-\frac{m^2}{a_\mu p_0^2} (1-2\frac{\Delta p}{p})\right) \frac{\beta E_r}{cB}\label{eq:ce}
\end{equation}
If $\frac{m^2}{p_0^2}=a_\mu$, that is if we choose the magnetic field so that the magic momentum muon is at the magic radius, then
the electric field correction for 
$$C_e \approx -2\frac{\Delta p}{p}\frac{\beta E_r}{cB}$$
Substitution of Equation ~\ref{eq:avgefield} gives the correction to $\omega_a$ due to fractional momentum offset $\delta$ and betatron amplitude $x_{\beta 0}$ as
\begin{eqnarray*}
C_e(\delta,x_{\beta 0})&\approx& -2\delta\frac{\beta k}{cB}\left(\eta\delta + \frac{1}{2\rho_0}((\eta\delta)^2+ \frac{1}{2} x_{\beta 0}^2)\right)\\
&\approx& 2\frac{\beta k}{cB}\left(\eta\delta^2 + \frac{1}{2\rho_0}(\eta^2\delta^3+ \frac{1}{2} x_{\beta 0}^2\delta)\right)
\end{eqnarray*}

Next we need to  average $C_e(\delta,x_{\beta 0})$ over the entire momentum and CBO distribution. 
\begin{eqnarray*}
\vev{C_e(\delta,x_{\beta 0})}
&\approx& -2\frac{\beta k}{cB}\left(\frac{\langle x_e^2\rangle}{\eta} + \frac{1}{2\rho_0}(\frac{\langle x_e^3\rangle}{\eta}+ \frac{1}{2} \vev{x_{\beta 0}^2}\frac{\vev{x_e}}{\eta})\right)
\end{eqnarray*}
where $\vev{\delta}=\vev{x_e}/\eta$. If $\langle \delta \rangle = \vev{x_e}/\eta =0$, and we assume that the betaron amplitude and momentum offset are uncorrelated. In fact
momentum offset and betarton amplitude are strongly anti-correlated. We will return to this point.
\begin{eqnarray*}
\langle C_e(\delta,x_{\beta 0})\rangle&=& -2\frac{\beta k}{cB}\eta\vev{\delta^2}
\end{eqnarray*}

and there is no contribution from the sextupole or path length terms.
If $\langle \delta \rangle \ne 0$ then the fractional change to the E-field correction is
$$\frac{\Delta C_e}{C_e}\sim \frac{\vev{x_e^3}+\vev{x_e}\vev{x^2_{\beta 0}}/2}{2\vev{x_e^2}\rho_0}$$
%$$\frac{\vev{x_e}}{\vev{x_e^2}}\frac{\vev {x^2_{\beta 0}}}{2\rho_0}= \frac{\eta\vev{\delta}} {\eta^2\vev{\delta^2}} \frac{\vev {x^2_{\beta 0}}}{2\rho_0}\sim \frac{\vev{\delta}\vev{x^2_{\beta 0}}}{2\eta\rho_0\vev{\delta^2}}.$$
For the equilibrium radial distribution typical for Run I (Figure ~\ref{fg:equilibrium}.), 
$$\frac{\Delta C_e}{C_e} \sim   1.1 \time 10^{-3} + 1.9\times 10^{-6}\vev{x_{\beta_0}^2}$$
\begin{figure}[tb]
 \begin{center}
 \includegraphics*[width=0.8\textwidth,angle=0, trim= 0 0 0 0, clip=.true.]{figures/60hrRadialDistribution.pdf}
 \caption{Equilibrium radial distribution}
\label{fg:equilibrium}
 \end{center}
  \end{figure}
 If we very conservatively estimate that $\vev{x_{\beta_0}^2}< 45^2{\rm mm^2}$, then
 $$\frac{\Delta C_e}{C_e} <   4.9 \time 10^{-3}$$
 We find that the change in the efield correction due to the nonlinearity associated with the curvature of the quad plates, is less than 0.5\%. 





Now let's return to Equation ~\ref{eq:ce} but this time we suppose that the distribution is not centered at the magic radius and choose $p_0$ according to the Miller/Nguyen rule
to minimize the E-field correction. 

Then
\begin{eqnarray*}
C_e\sim -\left(1-\frac{m^2}{a_\mu p_0^2} (1-2\frac{\Delta p}{p_0})\right) \frac{\beta E_r}{cB} \sim
\left(1-\frac{m^2}{a_\mu p_0^2} (1-2\frac{\Delta p}{p_0})\right)\frac{\beta k}{cB}\left(\eta\delta + \frac{1}{2\rho_0}((\eta\delta)^2+ \frac{1}{2} x_{\beta 0}^2)\right)\\
\end{eqnarray*}
With Miller's definition of $\alpha = \frac{m^2}{p_0^2}- a_\mu$, and his finding that $\alpha = 2a_\mu\frac{\vev{p-p_0}}{p_0}=2a_\mu\vev{\delta}$ minimizes the E-field correction when the average momentum is not $p_0$,
the correction becomes
\begin{eqnarray*}
C_e\sim -2\left[-\vev{\delta}+(1+2\vev{\delta})\delta\right]\frac{\beta k}{cB} \left(\eta\delta + \frac{1}{2\rho_0}((\eta\delta)^2+ \frac{1}{2} x_{\beta 0}^2)\right)\\
C_e\sim -2\left[-\vev{\delta}\eta\delta+\eta(1+2\vev{\delta})\delta^2   -\frac{\vev{\delta}-\delta}{2\rho_0}(\eta\delta)^2+\frac{1}{4\rho_0}(\delta-\vev{\delta}+\vev{\delta}\delta x_{\beta 0}^2\right]\frac{\beta k}{cB} \\
\vev{C_e}\sim -2\left[-\eta(\vev{\delta}^2-\vev{\delta^2})+\frac{1}{4\rho_0}(\vev{\delta}^2 \vev{x_{\beta 0}^2}\right]\frac{\beta k}{cB} \\
\end{eqnarray*}
The relative contribution to the E-field correction due to the finite betatron amplitude is
$$\Delta C_e/C_e\sim \frac{\vev{x_{\beta 0}^2}}{4\rho_0\eta}\left(\frac{\vev{\delta}^2}{\vev{\delta}^2-\vev{\delta^2}}\right)$$ 
Is this important? Probably not. (Remember that $\eta\sim \rho_0/(1-n)$). Note however that the hypothesized sextupole component discussed above has opposite sign to and 
partially cancels the contribution from the path length effect. The real
sextupole component may be somewhat different. Also a magnetic sextupole will similarly enhance (or at least complicate) the dependence of the E-field correction on betatron amplitude.

\subsection*{Multipoles Fitted to 3-D Field Map}

The electric field along the horizontal axis ($y=0$) is given by
\begin{equation}
E_x - iE_y = (b_n -ia_n)\frac{x^n}{r_0^n}\label{eq:mpoleexpansion}
\end{equation}
where $r_0=0.045$ m and $a_n,b_n$ are given in Table ~\ref{tab:multipoles}. The multipoles are computed as a fit to an azimuthal slice of the 3D Opera field map of the quads\cite{wanwei}. The
fit is for a 'horizontally' pure basis\cite{bmad}\cite{mcmillan} of Mcmillan functions. 
Figure ~\ref{fg:efield} shows the horizontal electric field in the midplane. The values from the Opera map, and from the multipole expansion
are superimposed and evidently are in excellent agreement.

\begin{figure}[tb]
 \begin{center}
 \includegraphics*[width=0.8\textwidth,angle=0, trim= 0 0 0 0, clip=.true.]{figures/quad_field.pdf}
 \caption{Electric field along the x-axis in the midplane (y=0). The green points
are computed from the multipole expansion using Equation ~\ref{eq:mpoleexpansion} and the coefficients in Table ~\ref{tab:multipoles}.
 The 'purple' curve (hidden by the green points) are the values from the field map.}
 \end{center}
   \label{fg:efield}
 \end{figure}

\begin{table}[h]
\caption{}
\begin{center}
\begin{tabular}{|l|c|c|}
\hline
 Multipole & Normal ($b_n$) &  Skew $(a_n)$  \\
\hline


          1 &  1.01609E+06& -1.19899E+00\\
          2 & -2.71281E+03&  7.71402E+00\\
          3 & -1.45524E+04& -1.50954E+01\\
          4 & -6.90244E+02&  1.46521E+00\\
          5 & -5.23865E+03&  4.35213E+01\\
          6 &  1.00671E+02& -4.83666E+01\\
          7 &  1.21107E+03&  7.75800E+01\\
          8 & -1.43120E+02&  4.99963E+00\\
          9 & -9.02621E+04&  5.20048E+00\\
         10 &  2.87638E+02& -3.47144E+01\\
         11 &  5.36519E+03&  3.43053E+01\\
         12 &  1.05747E+02&  2.39598E+00\\
         13 &  8.00742E+02& -9.14390E+00\\
\hline
\end{tabular}
\end{center}
\label{tab:multipoles}
\end{table}

We can compare the fitted sextupole-like coefficient to our 'guess' discussed above.
We found a solution to the Laplacian in the curved system as Equation ~\ref{eq:laplaciansolution}. 
The ratio of the coefficients of
the quadratic and linear terms is $r_{hyp}-\frac{1}{2\rho_0} = -0.0703{\rm m}^{-1}$. But that 'hypothetical' solution is not unique. 
After all, while we insisted on a form that satisfies Maxwell's equations, we made no attempt to also satisfy the boundary conditions. 
The ratio based on the fit to the Opera field map, that satisfies both Maxwell and the boundary conditions, taking the values from the table is
$r_{fit} = \frac{b_2}{b_1 r_0}= -2.71281\times 10^{3}/1.01609\times 10^6 = -0.0593 {\rm m}^{-1}$, within 16\% of our guess.

As was shown above,the effect of the sextupole-like component of the quadrupole, and the asymmetry of the path length about the magic radius, is that the E-field correction
depends on betatron amplitude and nonlinearly on equilibrium radial offset.
From Equations ~\ref{eq:sextpluspath}-~\ref{eq:opposite} we see that the sextupole-like component and the path length contribute with opposite sign,
and the amplitude of the sextupole-like component is about 1/2 of the path length piece.  Based on measured equilbrium radial distribution we conclude that the
contribution of the sextupole-like component to the E-field correction is less than 1\%.

There are in addition to the sextupole-like component higher order multipoles as evident from the table. In particular we see in Fig. ~\ref{fg:efield} that the field gradient
rolls off at large amplitudes. Since the quad plate is an equipotential surface, the component of the electric field parallel to the plate vanishes near the surface. Then
$\vec\nabla\cdot\vec E=0\rightarrow \partder{E_\perp}{d x_\perp}\rightarrow 0$. Near the plates, the quad index $n\rightarrow 0$. We explore the implications in simulation.


\begin{comment}
The general solution to Laplace's equation in cylindrical coordinates is 
\begin{equation}
 V(\rho,z,\phi) = \sum_{m=0}^\infty(CJ_m(k\rho)+DN_m(k\rho))\sinh(kz)[A_{mn}\sin m\phi + B_{mn}\cos m\phi]
\end{equation}
where we assume that the potential vanish at $z=0$, and that it is single valued in $\phi$. 
If we further assume zero angular dependence then
\begin{equation}
 V(\rho,z) =(CJ_0(k\rho)+DN_0(k\rho))\sinh(kz)
\end{equation}
And since $V(\rho = r_0\pm a) = 0$, that is constant on the plates at $r=r_0\pm a$, then
\begin{equation}
 V(\rho,z) =\sum_{n=1}^\infty(C_nJ_0(k_n\rho)+D_nN_0(k_n\rho))\sinh(k_nz)
\end{equation}
where $J_0(k_n (r_0\pm a))= N_0(k_n(r_0\pm a))=0$.
\end{comment}

