On sector magnets or transverse electromagnetic fields in cylindrical coordinates

The Laplace's equations for the scalar and vector potentials describing electric or magnetic fields in cylindrical coordinates with translational invariance along azimuthal coordinate are considered. The series of special functions which, when expanded in power series in radial and vertical coordinates, in lowest order replicate the harmonic homogeneous polynomials of two variables are found. These functions are based on radial harmonics found by Edwin~M.~McMillan in his more-than-40-years"forgotten"article, which will be discussed. In addition to McMillan's harmonics, second family of adjoint radial harmonics is introduced, in order to provide symmetric description between electric and magnetic fields and to describe fields and potentials in terms of same special functions. Formulas to relate any transverse fields specified by the coefficients in the power series expansion in radial or vertical planes in cylindrical coordinates with the set of new functions are provided. This result is no doubt important for potential theory while also critical for theoretical studies, design and proper modeling of sector dipoles, combined function dipoles and any general sector element for accelerator physics. All results are presented in connection with these problems.


I. INTRODUCTION
Description of sector combined function magnets, and in general any magnet with translational symmetry along azimuthal coordinate in cylindrical coordinates, is very important issue, and, without any particular reference one can say that every modern accelerator code includes such elements. The main idea, which goes back to original 1968 K. Brown's paper [1], based on a solution of Laplace's equation for scalar potential in cylindrical coordinates using the general power series ansatz. Similar approach but for Laplace's equation for longitudinal component of vector potential can be found for example in [2]. As one can see the approach is the same in most recent books, e.g. in great details in [3].
Two major bottlenecks should be noticed. In the first place, if one looking for a solution in a form of a series, these series should be truncated. In our case truncation means that potentials do not satisfy the Laplace's equation anymore, even if symplectic integrators are used for numerical solution (of course potentials can "satisfy" the Laplace's equation up to desired order by keeping more and more terms in expansion). But more importantly, the recurrence equation is undetermined. That means in every new order of recurrence one have to assign an arbitrary constant, which will affect all other higher order terms. The uncertainty leads to the fact that there is no one particular choice of basis functions; it make it almost impossible to compare different accelerator codes, since different assumptions might be used for representations of basis functions.
The indeterminacy has simple geometrical illustration. Looking for a field with pure normal dipole component on equilibrium orbit in lowest order, one can come up with almost arbitrary shape of magnet's north pole if south pole is symmetric with respect to midplane. In the case of dipole, series can be truncated by keeping only dipole component. For higher order multipoles in cylindrical coordinates truncation without violation of Laplace's equation is not possible.
Working on implementation of these magnets for Synergia, I found particular assumptions which let me to summate series for pure electric and magnetic skew and normal multipoles. Further look for symmetry in description allowed to generate full family of solutions where no truncation is required since all series can be summated. While discussing my results with Sergei Nagaitsev, he brought my attention, as we found later to more-than-40-years forgotten, article by McMillan [4] of 1975.
Brining together his and my results I would like to present a new description for multipole expansion in cylindrical coordinates. Any transverse field can be expanded in terms of these functions and related to power series field expansion in horizontal or vertical planes. The new approach do not contradict with previous results but embrace it. An ambiguity in choice of coefficients and problem of truncation are resolved. Thus it can be employed for theoretical studies, design and simulation of sector magnets.

A. Article structure
Section II describes general equations of motion for a particle in curvilinear coordinates associated with Frenet-Serret frame. The case of transverse electromagnetic fields described in section III.
Subsections III A,III B provide most general equations of motion for pure electric and magnetic fields. Two further subsections III D,III E describes the expansion of fields in multipoles for cases with zero and constant curvatures. The section III F relates new family of functions to recurrence equations.

A. Global coordinates in Lab frame
The Lagrangian of a relativistic particle of mass m with an electric charge e in most general static electromagnetic field is given by is a position vector in the configuration space of generalized coordinates spanned on three dimensional right-handed Cartesian coordinate system {Ê 1 ,Ê 2 ,Ê 3 } associated with Lab frame at the facility of a particle accelerator, V ≡Ṙ is a vector of matching generalized velocities where(. . .) ≡ d dt is the time derivative operator. Φ(R) and A(R) are the electric scalar and magnetic vector potentials respectively, and, is the relativistic Lorentz factor where β is the ratio of V to the speed of light in vacuum, c. Substituting the Lagrangian into the Euler-Lagrange equations (Lagrange's equations of the second kind) representing a vector of partial derivatives with respect to the indicated variables, gives the equation of motion which is the relativistic form of the Lorentz force where the electric and magnetic fields related to scalar electric and vector magnetic potentials through the gradient and curl vector operators respectively A more abstract formulation can be given in terms of Hamiltonian which describes phase space of canonical variables {P, Q}, where P is the particle's canonical (total) momentum defined as and Π = γ m V being the particle's kinetic momentum. The Hamiltonian might be constructed using the Legendre transformation of L The time evolution of the system is given by Hamilton's equations The model of accelerator assumes the specification of a reference orbit designed for a particle with certain equilibrium energy and assignment of beam line elements placed along it. In the case of a circular accelerator the closed orbit of a machine with alignment errors in general will not coincide with reference orbit. For most accelerator needs (except e.g. helical orbits for muon cooling) the designed orbit is piecewise flat function, which means that it consists of a series of curves with zero torsion; moreover, usually, these curves are straight lines and circular arcs. In order to better exploit the geometry of beam motion and symmetry of electromagnetic fields we will introduce the local Frenet-Serret frame attached to equilibrium orbit and new global coordinates associated with it (see FIG. 1).
FIG. 1. Schematic plot of an equilibrium orbit for an accelerator consisting of five drift spaces and five 72 • bending magnets. Lab frame and local Frenet-Serret frames are shown in black and blue colors respectively. The test particle winding the equilibrium orbit shown in red.

B. Global coordinates associated with
Frenet-Serret frame The equilibrium particle is a particle with design energy perfectly following the reference orbit. Let R 0 (t) be the position vector of it as a function of time. Then one can describe the equilibrium orbit in terms of its natural parametrization by arc length as Now on can introduce the local right-handed orthonormal Frenet-Serret basis {n,b,t} (or TNB frame), where basis vectors are defined as follows: • tangent unit vector • outward-pointing normal unit vector • and binormal unit vector b =t ×n, where κ = dt/ds defines the local curvature of the equilibrium orbit. Then, using the Frenet-Serret formulas describing the derivatives of unit vectors in terms of each other where τ (s) is the torsion of an equilibrium orbit which measures the failure of a curve to be planar, one can express the position vector of a test particle as a transverse displacement from equilibrium orbit, see FIG. 2, and its' infinitesimally small displacement where (q 1 , q 2 , q 3 ) are local curvilinear coordinates spanned on (n,b,t). One can see that in the case of flat orbit, i.e. τ = 0, the local Frenet-Serret frame can be associated with global orthogonal coordinate system with a line element in a form The use of global coordinates with metric provided by local Frenet-Serret frame allows to rewrite the Lagrangian as where the vector in the RHS of equation defined as K = (κ h, 0, κ q 1 ), and the operator (. . .) ≡ d dq3 is the derivative with respect to longitudinal coordinate. Derivatives of potentials expressed via electromagnetic fields using expressions for differential operators in curvilinear orthogonal coordinates form Table I. Calculating components of the new canonical momenta allows to write down the new Hamiltonian and equations of motioṅ

III. TRANSVERSE ELECTROMAGNETIC FIELDS
Now we will restrict ourself with the case of transverse electromagnetic fields; in orthogonal curvilinear coordinate system associated with Serret-Frenet frame these are the fields with translation symmetry along longitudinal coordinate q 3 . Thus, the scalar and vector potentials are function of transverse coordinates only and vector potential has only one nonvanishing component which is A 3 . Both potentials satisfies Laplace equation The corresponding fields are given by Maxwell equations with differential operators defined for orthogonal curvilinear coordinate system (Table I), and one gets In the case of pure electric or magnetic fields further simplifications can be applied. For numerical integration purposes it is very convenient to have a Hamiltonian in a form of a sum of "kinetic" and "potential" energies where potentials will be separated from momentum variables. In this case, one can easily construct symplectic integrator consisting of "drifts" and "kicks" associated with kinetic and potential terms respectively (e.g. [5]).
For pure electric field when curvature is independent of longitudinal coordinate not only Hamiltonian but also p 3 is an invariant of motion, and, problem is essentially two dimensional. Measuring the time in units of c t and normalizing the transverse momentums over the longitudinal component, We will call this model Hamiltonian the t-representation; with no assumptions made, but the field symmetry, we derived general equations of motion which can be used for the basis for the construction of symplectic integrator. In a paraxial approximation,p 1,2 1,and for p 1,2 m c the form is significantly simpler, and a limit of straight coordinates when h = 1 is obvious

B. s-representation
For pure magnetic field the Hamiltonian is very hard to exploit since it has only a square root and so no terms to split. Introducing an extended Hamiltonian with a new fictitious time parameter, τ , where the old independent variable and old Hamiltonian with a negative sign will be treated as an additional pair of canonically conjugated coordinates, (−H, t), one have:

Integration of additional equations of motion gives
where we can set a constant of integration C 0 = 0. If curvature is invariant of longitudinal coordinate the longitudinal component of momentum conserved, as well as in the case of electric field, and we will use −p 3 as a new Hamiltonian, reducing number of degrees of freedom back up to three by using q 3 as a new independent variable: The use of generating function will allow to use the full kinetic momentum −Π of a particle instead of −H as one of canonical momentums: , where corresponding canonical coordinate is a particle's traversed path l = −∂ G 2 /∂Π = βc t.
Since the Hamiltonian do not explicitly depends on l, full momentum Π is conserved and we can exclude associated degree of freedom using the further renormalization of the Hamiltonian K → K ≡ K/Π, which can be achieved by re-normalizing transverse components of canonical momentums p 1,2 →p 1,2 = p 1,2 /Π: We will call this model Hamiltonian s-representation since the longitudinal coordinate (sometimes referred to the natural parameter along equilibrium orbit, s) is used as a time-parameter. This representation is convenient to use for the numerical integrator construction for transverse magnetic fields. The paraxial approximation,

C. R-and S-elements
So far we provided dynamical equations of motion without specifying how to represent electromagnetic fields. In next two subsections we will discuss the multipole field expansion for two most important types of elements: R-element for κ = 0 and S-element defined for R-stays for rectangular and this element is the one whit (q 1 , q 2 , q 3 ) simply being the right handed Cartesian coordinate system which we will denote as (x, y, z). All fields in such an element are invariant along z axis and usually serves the function of regular quadrupoles, sextupoles, octupoles or combined function correctors. In addition one can design pure R-dipoles, while combined function bending magnets are exotic and very complicated since equilibrium orbit will not anymore coincides with axis of symmetry.

D. Multipoles in Cartesian coordinates
In Cartesian coordinates Laplace equations for electroand magnetostatic fields are in the same form which significantly simplify the problem Introduction of complex variables allows a very compact description of a problem with unified description of electric and magnetic fields. Suppose we have a holomorphic function of complex variable Z = x + i y which we will call complex scalar potential which real part is defined to be a longitudinal component of a vector potential and imaginary part is the electric scalar potential Since real or imaginary part of any holomorphic function are harmonic functions, A z and Φ automatically satisfies the Laplace equation. Indeed, suppose we have a vector field F = (F x , F y ). Introducing the Wirtinger derivatives where first equation is the Cauchy-Riemann condition for Ω which guarantees that this field can be implemented via either magnetic or electric potentials: The second equation defines complex function of field components such that For accelerator physics purposes the expansion of fields usually represented in terms of homogeneous harmonic polynomials of two variables, which are defined through the complex power function Explicit expressions up to 10-th order are in Table II. These functions satisfy the Laplace equation ⊥ = 0 and related to each other through Cauchy-Riemann equation as In addition one can introduce "ladder-like" lowering differential operators as Thus one can define two independent of each other sets of solutions, normal (sometimes called upright or straight) and skew pure multipoles, which we will denote with overline (. . .) and underline (. . .) respectively. The complex scalar potentials of pure multipoles are: where C n and C n are coefficients determining the strength of magnets. Corresponding vector fields are defined to have an odd and even midplane symmetries y (x, −y) and F (n) x (x, 0) = 0, F (n) x (x, y) = F (n) x (x, −y) and F (n) y (x, 0) = 0.
Formulas for potentials and fields are listed below in Table III and exact expressions are provided in Appendix A. Figure 4 shows the cross section of idealized multipole magnet's poles and corresponding fields.
Bn−1 (n − 1)! Therefore, if one provided with experimental data of the power series expansions of the fields in a horizontal or vertical planes the field derivatives on equilibrium orbit can be related to strength coefficients, see Table IV, which allows to expand a general R-element in terms of pure multipoles.

E. Multipoles in cylindrical coordinates
In the normalized right-handed cylindrical coordinate system the Laplace equations are Compared to the case with Cartesian coordinates these equations look quite different from each other. In order to retain the symmetry one can note that Thus looking for the solution in a form similar to harmonic homogeneous polynomials where F n (ρ) and G n (ρ) are the functions to be determined, one can find two recurrence equations They relate F n and G n to each other through and allows to construct lowering operators and thus defines raising operators where limits of integration are taking care of two constants of integration. These operators can be used to recursively calculate all members of F− and G−functions; an additional constraint to terminate recurrences defines lowest orders n = 0, 1 as First ten members of F n and G n are listed in Ta McMillan radial harmonics, G n , are introduced in order to provide the symmetry in description between electric and magnetic fields. Finally, in order to define the set of functions for pure S-multipoles (Table V) we will define sector harmonics: obeying differential relations   Table VIII and exact expressions for potentials and fields in Appendix A.
TABLE V. Formulas for the scalar potential, azimuthal component of the vector potential and field components for "pure normal and skew 2n-poles in cylindrical coordinates.
Normal Skew n Fn(ρ) n Gn(ρ) FIG. 6. Normal and skew 2n-pole magnets in cylindrical coordinates. Each figure shows magnetic (electric) field streamlines and poles' shape in transverse cross section. North (positive electrostatic potential) and south (negative electrostatic potential) poles are shown in red and blue and given by constant levels of (B, A) (e) n = ∓const respectively, const = 1 for this example. Bottom row shows 3D models of sector magnets with θ = 3π/2: skew S-dipole, normal S-dipole, skew S-quadrupole, normal S-quadrupole and skew S-sextupole from the left to the right respectively. Equilibrium orbit is shown in green color

F. Recurrence equations in sector coordinates
An alternative approach to find expansions for potentials is to use general power series ansatz. In Cartesian coordinates the use of gives the recurrence relation This equation immediately defines all coefficients, and up to a common factor, as easy to see, coincides with harmonic homogeneous polynomials A n and B n . In sector coordinates, the same substitution for Φ, and substitution for longitudinal component of the vector potential gives two new recurrences, respectively The detailed approach on how to treat these equations can be found for example in [Wiedemann]. In order to solve these recurrences, one can look for a solution where each term can be expressed in a form where starred variables are the "design" terms given by pure multipole fields and thus satisfying Other coefficients V (k) i,j are terms induced by lower k-th order pure multipoles due to recurrence. Thus in order to find an expression for a particular 2n-pole we will start the recurrence form the n-th order assuming that V n,0 = −V n−2,2 = . . . or V n−1,1 = −V n−3,3 = . . . for normal and skew elements. Then we will start exploiting the recurrence where all terms in the form V (n) i,j for i + j > n are subject to be determined. This approach has two major disadvantages. At first, in order to use the result on will have to truncate a recurrence. As a result the potentials representing magnets do not satisfies the Laplace equation anymore. This is a strong assumption which violate the "physics" and should be avoided. While potentials can be approximated with any precision by keeping an appropriate number of terms, there is another issue. At second, at each new order when solving the recurrence one will find that an arbitrary constant α i ∈ (0; 1) should be introduced since the system is undetermined. An additional assumption (A s , Φ) | x=0 ∝ y n allows to truncate or summate the series. The resulting solutions coincide with the one obtained above.

IV. SUMMARY
The scalar and vector Laplace's equations for static transverse electromagnetic fields in curvilinear orthogonal coordinates with zero and constant curvature are solved. In Cartesian coordinates these solutions are well known harmonic homogeneous polynomials of two variables. The set of solutions in cylindrical coordinates named sector harmonics, and should not be confused with cylindrical harmonics where ρ-dependent term is given by Bessel functions which occasionally are also called cylindrical harmonics. In contrast, the radial part is given by the set of introduced McMillan radial harmonics, independently introduced by E.M. McMillan in his "forgotten" article, and adjoint radial harmonics also described in this work. The feature of sector harmonics that when expanded around equilibrium orbit they resemble solution in Cartesian geometry. Compared to the traditional approach, widely used in accelerator community, of the use of recurrences based on general power series ansatz, this set of functions has two major advantages. It do not require any truncation and is exactly satisfying Laplace equation, and, provides a well defined full basis of functions which can be related to any field by its expansion in radial or vertical planes, see Table IX. Including the model Hamiltonians for t-and s-representations, where no assumptions but the field symmetry has been used, one can construct numerical scheme integrating equations of motion. Thus I would like to suggest the set of sector harmonics as a new basis for description and design of any sector magnets with translational symmetry along azimuthal coordinate.

ACKNOWLEDGMENTS
The author would like to thank Leo Michelotti, Eric Stern and James F. Amundson for their discussions and valuable input. Alexey Burov for encouraging to find full family of solutions. Valeri Lebedev whose solution for electrostatic quadrupole led me to generalization, just as in the case with E. M. McMillan and F. Krienen. And, of course, Sergei Nagaitsev who brought back to life original unknown McMillan's article which helped me with symmetric description of electromagnetic fields. The scalar potentials, longitudinal component of vector potential, and field components for pure R-and Smultipoles up to fifth order are listed in Table X-XI and  Tables XII-XIII respectively.  TABLE IX. Relationship between coefficients determining the strength of "pure" normal and skew S-multipoles and power series expansion of field in radial and vertical planes on equilibrium orbit.
Appendix B: Taylor polynomials of Fn and Gn.
The first ten terms of Maclaurin series of F n (x), G n (x) and G n (x) 1 + x are listed in Table XIV.