Wherever charged particles require transportation, elimination of all stray electric and magnetic is essential. A more realistic goal is for fields no greater than 1 mG in sensitive areas. Shielding involves the use of materials of high permeability. It is prone, for instance, to magnetisation, and if the shielding for example receives frequent knocks it may well develop very poor shielding abilities.
Cancellation involves the annulling of stray fields by the creation of equal and opposite fields.
The fields could be created by permanent magnets, but the easiest solution is to generate the fields with currents. The most common configuration of currents is a set of coils. Circular coils are most common, but here we will largely concern ourselves with square and rectangular coils. Using this technique we can express the field between a pair of rectangular coils. Let the planes of the coils be parallel to the xy plane, and let them be centred on the z axis.