to achieve objective 2 by continuing outward using the Maxwell equations. However, these functions do not have completeness properties, item 1. And there is no smooth- ing, item 5, to overcome the amplification of noise due to numerical differentiation. In the case of midplane fitting, one approach would be to attempt to employ expressions that relate the on- axis gradients to midplane data and its derivatives. For example, in the case of midplane symmetry, there are the relations By repeatedly differentiating these relations with respect to z , one can obtain the C [ n ] $_{m,s}$( z ) for n > 0. In gen- eral, the determination of C [ n ] $_{m,s}$( z ) requires the computa- tion of m + n − 1 derivatives. Although this approach achieves objective 2, since all relevant quantities are sub- sequently computed in terms of on-axis gradients, in the case where data is available only at grid points it presup- poses the ability to compute very high-order derivatives by high-order numerical differentiation. This is generally impossible, due to the high noise sensitivity associated with high-order numerical differentiation, because there is no intrinsic smoothing, item 5. Another approach is to use an analytic functional form, with free parameters, that is known to satisfy the the 3- dimensional Laplace equation for all parameter values. These parameters can be adjusted so that the field de- rived from this representation well approximates the field at various grid points. (These grid points could be in the midplane, but could be out of the midplane as well.) This representation can then be repeatedly differenti- ated to provide the required field derivatives. However, commonly this fitting procedure has no known complete- ness/convergence property, item 1. In some cases Fourier series representations with known completeness proper- ties are used. But with Fourier series representations, an artificial periodicity is imposed in the transverse hor- izontal direction. As a result, the Fourier coefficients for the field expansions, call them a$_{n}$ , can fall off at best as (1 /n $^{2}$)[4]. Correspondingly, the Fourier coeficients in the associated expansion for ψ fall off at best as (1 /n $^{3}$). As a result, repeated differentiation produces nonconvergent series, and there is no analyticity, item 3. Whatever rep- resentation is used, there is again no intrinsic smoothing to overcome the amplification of noise due to numerical differentiation. Suppose the magnetic field B ( x, y, z ) = B ( ρ, φ, z ) is given on a grid, and this data is interpolated onto the surface of the cylinder using values at the grid points near the surface. Next, from the values on the surface, compute B$_{ρ}$ ( R, φ, z ), the component of B ( ρ, φ, z ) normal to the surface. The major remaining task is to compute the on-axis gradients from a knowledge of B$_{ρ}$ ( R, φ, z ). See Fig. 2. At this point we note that the functions exp( ikz ) sin( mφ ) and exp( ikz ) cos( mφ ) form a complete set over the surface of the circular cylinder. Let ˜ B$_{ρ}$ ( R, φ, k ) be the Fourier transform of B$_{ρ}$ ( R, φ, z ) given by the integral Because B decays rapidly in the fringe field region, B$_{ρ}$ ( R, φ, z ) is absolutely integrable along the z -axis, and Consider a circular cylinder of radius R , centered on the z -axis, fitting within the bore of the beam-line el- ement in question, and extending beyond the fringe- field regions at the ends of the beam-line element. The beam-line element could be any straight element such as a solenoid, quadrupole, sextupole, octupole, etc., or it could be wiggler with little or no net bending. See Fig. 1, which illustrates the case of a wiggler. All three-dimensional electromagnetic codes calcu- late all three components of the field on some three- dimensional grid. Also, such data is in principle avail- able from actual field measurements. In this subsection we will describe how to compute the on-axis gradients from such field data using the surface of a circular cylin- der [5]. Once these gradients are known, we may use (11) and (12) to compute the associated scalar and vector po- tentials. 4 A. Use of Field Data on Surface of Circular Cylinder C [0] $_{m,c}$( z ) = 0 , (15a) C [0] 1 $_{,s}$( z ) = B$_{y}$ ( x = 0 , y = 0 , z ) , (15b) C [0] 2 $_{,s}$( z ) = 1 2 ∂B$_{y}$ ∂x ∣ ∣ (0 , 0 ,z ) , (15c) C [0] 3 $_{,s}$( z ) = 1 6 ∂ $^{2}$B$_{y}$ ∂x 2 ∣ ∣ (0 , 0 ,z ) + 1 24 ∂ $^{2}$B$_{y}$ ∂z 2 ∣ ∣ (0 , 0 ,z ) , etc . (15d) FIG. 1: A circular cylinder of radius R , centered on the z - axis, fitting within the bore of a beam-line element, in this case a wiggler, and extending beyond the fringe-field regions at the ends of the beam-line element. ˜ B$_{ρ}$ ( R, φ, k ) = 1 2 π ∫ ∞ −∞ dz e − $^{ikz}$B$_{ρ}$ ( R, φ, z ) . (16)