Helmholtz Coils

This note explains why "Helmholtz coils"produce an especially uniform magnetic field near their center. I'll use Mathematica to do this, so along the way some rudimentary Mathematica techniques are also explained.

The Biot-Savart law tells us that a little bit of wire carrying current i and of length dl provides a contribution to the magnetic field 

\(d 
               B\&⇀ = \ μ\_0\/\(4  π\)\ \(i\ d\ l\&⇀\ ×\ r\&⇀\)\/r\^3\)

where (Overscript[r, ⇀]) is the distance from the current element to the observation point, and (Subscript[μ, 0]) is exactly 4π × (10^(-7)) ((Tesla - m)/Ampere) in MKS units.

This formula can be readily integrated to find the B-field at a distance z on the axis above a circular loop of current:

(Subscript[B, z])(z)= ((Subscript[μ, 0])/2) ((R^2)/((((R^2) + (z^2)))^(3/2))) i ,

where R is the radius of the loop. If there are N turns of the loop, superposition tells we may simply multiply this result by N. 

Let's define an expression in Mathematica that reflects this:

Bz  =  ((μ  (R^2) N i)/(2 ((((R^2) + (z^2)))^(3/2))))

(You need to use "Shift+Enter" to get Mathemtica to actually "evaluate" the the expression.)

Now suppose there are two such loops, located at distance +d/2 and -d/2 about z=0. We need to shift z by the corresponding amounts. Mathematica has a wonderful tool for symbolic substitution, which takes the somewhat obscure form "slash/dot oldVariable->newForm", e.g., "/.z->z+d/2". 

Here is how we can use our first expression, combined with /. operator, to define a new expression for such a symmetrically configured pair of coils:

BzTwo  = ( 
          Bz /. z -> z + d/2 ) +  (Bz /. z -> z - d/2)

Now let's expand this expression in a Taylor's series about z=0, and see how "smooth" we can make it (by picking an optimal value for d ). To do this, we'll use the Series[] command in Mathematica, the '4' tells it to expand things out to the 4-th power in z :

Series[BzTwo, {z, 0, 4}]

Eek. 

Let's pick a value of d that eliminates the (z^2) term. To do this, I cut and paste the relevant part of that term into a new expression,  and ask Mathematica to make it zero:

Solve[((15 (d^2))/(4 (((((d^2)/4) + (R^2)))^2))) - 
          (3/(((d^2)/4) + (R^2))) == 0, d]

Well, that seems simple enough. Let's see if it simplifies the expansion:

Series[BzTwo /. d -> R, {z, 0, 4}]

Yes! That's much nicer. This special configuration of coils is called a Helmholtz coil, and is used in many laboratory applications when one wants to generate a uniform magnetic field over some region. 

To see how smooth it is, let's ask Mathematica to plot it:

Plot[BzTwo /. d -> R, {z, -2, 2}]

Oops. The above mess is Mathematica's not so polite way of telling us that it can't plot a function with a bunch of undefined parameters (like (Subscript[μ, 0]), N, i, R, ...)

One way around this would be to set them all to 1, again using the /. operator, leaving only z as the plot variable. That would be OK, but even better is to scale the function to its central value at z=0:

BzScaled  =  (BzTwo /. 
            d -> R) / (BzTwo /. {d -> R, z -> 0})

Well, OK, that didn't quite work; let's be explicit and tell Mathematica to simplify this:

BzScaled  = 
      Simplify[(BzTwo /. 
              d -> R) / (BzTwo /. {d -> R, z -> 0})]

Much better. Now you can plot this, after setting R=1.  (This is equivalent to plotting in terms of z/R ; do you understand this?):

Plot[BzScaled /. R -> 1,{z, -2.5, 2.5},PlotRange -> {{-2.0, 2.0}, {0, 1.2}},AxesLabel->{"z/R","(Subscript[B, z])/((Subscript[B, z])^MAX)"}]

Now that is definitely a FLAT function over quite a broad range of z/R. 

One can also show by more advanced techniques (using Legendre polynomials) that the field is also very uniform in the region (x,y) < R near z=0. 

That's it for the mathematical properties of the Helmholtz configuration. Next, I'd like to show you how to work with physical units in Mathematica:

<< Miscellaneous`Units`;  << 
      Miscellaneous`PhysicalConstants`

These commands (separated by the semi-colon) tell Mathematica to define various useful constants, for example

SpeedOfLight

Of particular interest here is the value of (Subscript[μ, 0]), which has this fancy name:

VacuumPermeability

Once you read in this package, Mathematica is more or less comfortable working with units. In particular, the "Physical Constants" palette (llook for it in the Help index) allows you to define things using the conventional symbols for various physical quantities:

BforCoil = (((Subscript[μ, 0]) (R^2)N i)/(2 ((((R^2) + (z^2)))^(3/2))))

BzHelmholtz  =  (BforCoil /. z -> z - R/2)  +   (BforCoil /. 
            z -> z + R/2)

Let's put in the particular values used in lab, that is, R = 0.33 Meter, N = 72, evaluated at the center (z=0) of the coil:

BlabCenter  =  
      BzHelmholtz /. {R ->  0.33 Meter,  N -> 72, z -> 0}

Those units look a little weird, but the Convert[] function in Mathematica lets you 'cast' this into a more useful form:

BlabPerAmpere  =  Convert[ BlabCenter,  Tesla/Ampere ]

(Yes, it will choke if you ask it to convert to incompatible units.)

Finally, you can use this to calculate the B field for any given current. Here is a range of B fields, defined by a Mathematica 'list' of current ranges:

Blab = 
      BlabPerAmpere /. 
        i -> {1 Ampere,  2 Ampere,  3 Ampere,  4 Ampere,  
            5 Ampere}