Helmholtz coil approximations

My friend Joss Ives got this blog post rolling with this tweet:

What I decided to do to check this out was to integrate the field for a true coiled wire. The first thing I did was figure out the parametric equation for a coil. Here’s what I came up with:

$f(u)=\left[x(u),y(u),z(u)\right]=\left[\left(1+\frac{u}{200}\right)\cos(u),\left(1+\frac{u}{200}\right)\sin(u),\frac{1}{20}\sin\left(\frac{u}{4}\right)\right]$

and here’s what that curve looks like:

plot of the coil parametric function

For that picture I had u go from 0 to 16 pi or 8 round trips.

Now that I had a mathematical expression for the coil, I could go about determining the exact magnetic field for it, rather than assuming it was 8 perfect circular loops. The field is given by:

$\vec{B}(\vec{r})=\frac{\mu_0}{4\pi}\int\frac{\vec{dl}\times\left(\vec{r}-\vec{r'}\right)}{\left|\vec{r}-\vec{r'}\right|^{3/2}}$

The trick to getting this to work was to figure out $\vec{dl}$. I got that by calculating the directional derivative of the parametric curve, f'(u). I wasn’t, at first, convinced that f'(u) would be right, so I thought about an easier integral first, namely, the length of the parametric curve. For that, you need $\left|\vec{dl}\right|$ which is given by $\sqrt{x'(u)^2+y'(u)^2+z'(u)^2}$, also known as the length of f'(u). For the vector form of dl, I needed a normalized unit vector in the direction of dl times its length, but that’s just the same as the original vector, f'(u).

Ok, then I was off and running. I could figure out r and r’ from the coordinates, and I just need to ask Mathematica to numerically integrate all three components of the field. Here’s the code that did that:

Mathematica syntax for integrating the magnetic field

You give bfield the location where you want to calculate the field.

To answer Joss’ question, I decided to look at the field strength on the axis, and compare it to the field for an 8-turn coil with an adjustable radius. That latter field is given by:

$B=\frac{\mu_0}{4\pi}\frac{(2\pi R)R}{\left(R^2+z^2\right)^{3/2}}$

I’ve purposely factored the numerator to show where the length of the coil comes into play. What I did was to calculate the coil field at several points on the axis and then fit that data to the equation above. The result was:

fitting the coil field to a simple circular wire field

I also show the value of R for the best fit along with the error on that. What’s interesting is how close the best value of R is to the midpoint of the coil:

$R_\text{mid}=1+\frac{1}{2}\frac{16\pi}{200}=1.12566$

However, it’s important to realize that the length of the two coils I’m comparing are not the same. The best fit length is:

$\text{length}_\text{best fit}=16\pi R_\text{best}=56.47$

while the length of the spiraled coil is given by integrating the dl mentioned above to get 56.61.

Thanks, Joss, that was fun!

Associate professor of physics at Hamline.
This entry was posted in mathematica, physics. Bookmark the permalink.

6 Responses to Helmholtz coil approximations

1. ProfeJMarie (Janet) says:

But what do these coils DO? Are they changing the world? Are they helping cure cancer? Huh? Huh?

• Andy "SuperFly" Rundquist says:

For those who haven’t guessed, that’s my better half joking about questions I always get from family about research I do. Basically, if it’s not medical research, it isn’t worth anything, or so it feels like sometimes.

2. Joss Ives says:

Clever work Andy. It looks like I know into whose ear I should place a bug!

I’m still trying to decide if I find it surprising that there was such good agreement of the radius with the midpoint of the coil given that you only used 8 coils.

• Andy "SuperFly" Rundquist says:

I might go do a longer coil to check, though the integration takes a while so I can’t just whip it out. It would be interesting to see effects from non-integer coils, too.

• Joss Ives says:

I was also thinking about non-integer coils. Things like the effect of an extra half-coil as a function of the number of coils.