we seek a collection of basis functions which converges to the magnetic field data quickly, and thus requires relatively few terms to achieve high precision. With slight modifications, we employed the set of basis functions given in [@wiggler]. Since the authors did not include a derivation of this basis, we provide one below.

Separable partial differential equations (PDE’s) yield an ample source of candidate basis functions. The most natural way to proceed is to solve the potential formulation of Maxwell’s equations, find a set of basis functions for the vector potential, and take the curl to acquire a set for the magnetic field. We begin with Ampere’s law, expressed in terms of the magnetic vector potential $\mathbf{A}$:

$\nabla(\nabla \cdot \mathbf{A}) - \nabla^2\mathbf{A} = \mu_0\mathbf{J}$,\
in which $\mathbf{J}$ is the current density. For the sake of computational simplicity, we choose the Coulomb gauge with the modification that $A_x = 0$. Next we note that in our region of interest, the current density is zero. Thus we are left with Laplace’s equation: $$\nabla^2\mathbf{A} = 0.$$

The next step is to choose a coordinate system in which to solve equation (1). Choosing different coordinate systems yields different functional bases whose corresponding series might 