# Gas station without pumps

## 2012 November 27

### Magnetic fields with no lab

Last week we did measurements of the magnetic field around a single wire, and I had planned to “do a lab winding a helix of wire and measuring the field around it.  We’ll use the computational problem (18P79) to compute the expected field in different places, and try measuring the wound solenoid in corresponding locations.  This means that in setting up the program we’ll have to make the number of turns, the radius of the solenoid, its length, and the current through the solenoid all easily changed, to match the simulation to the coil that we wind.”

As it turned out, my son had the simulation finished and we spent most of an hour exploring what the program told us.  The initial picture showing magnetic field arrows near the coil looked fine, but I suggested trying a different visualization: having a particle trace out a magnetic field line.  We expected to see something like the classic pictures of iron filings around a bar magnet, and were surprised to see the magnetic field coiling out from the end of the solenoid.

We did a bunch of debugging.  We looked at at the contributions to the field from the different segments of the coil, by color coding arrows from a fixed observation position. The simulation had n segments for each turn of the helix, so we summed the segments mod n, to get the different contributions from the different parts of the helix.  We also tried varying the number of turns of the helix, and we played with the step size for the particle tracing out the field line.

We finally got some very nice drawings of the field lines coming out one end of the solenoid, spiraling out, then spiraling back in to the other end, and running through the center of the solenoid.  It took us a while to realize that the behavior was indeed what we should have been expecting, because the helix has current running parallel to the axis of the helix as well as around the helix.  A simulation (as the book suggests) using only circular rings would not have included this longitudinal current, and we would have missed some interesting views of the magnetic field.

I’m wondering whether we could have gotten a similar result by superimposing two fields: one computed from a stack of circular rings and the other from a wire down the axis, both with the same current.  I might try writing a program that compares the two approaches.

Because we spent an hour doing simulations and looking at the results, we did not get around to doing homework comparisons (a good thing, since I haven’t done the homework yet) nor did we get around to winding a coil and measuring the magnetic field, which I still want us to do.