This Instructabler describes how to make a scientific investigation to determine how magnetic field varies with distance. Two methods are presented , and reasonable conclusions made.
Note that the magnet used in this Instructable is a thin disk type, not a bar magnet.
Tools and equipment:
One rare earth neodymium magnet, 16mm diameter x 3mm.
Precise scale measuring to 0.1 gram
Balance beam apparatus to allow measuring magnetic attraction
Magnetic compass
Tape measure (non magnetic)
Step 1: Some background: inverse square law?
Many phenomena of nature, like light, obey the inverse square law. That means as you get farther away from the source of light, the intensity decreases as the square of the distance. The inverse square law applies to light, gravity, and electrostatic charge. And the equation is simple and beautiful: basically it is I = 1/d^{2} , where d is distance (or I = 1/r^{2 } in the photo, where r is distance) and I is intensity.
It is often assumed that the strength of a magnetic field also obeys the inverse square law. Researching the Internet produces many complex equations, most indicating that magnet field varies inversely with the third power of distance, in other words an inverse cube law.
Since it all seemed vague, or at best theoretical, I decided to test for myself.
Step 2: First trial: Measure magnetic attraction using precise scale
My initial plan was to build a device that could measure magnetic force at various distances using a precise scale. I then would analyze the data, plot a graph, and come up with an equation. It turned out to be not that easy. The device is shown in the photo:
 The magnet is attached at the end of a threaded brass rod, 16 threads per inch.
 The magnet is attracted to the cast steel surface of my table saw.
 All components are nonmagnetic, brass, aluminum, wood.
 Force is measured by the scale at 1/16" intervals over the full range the magnet is attracted to the steel, and recorded in a table.
Step 3: Plot of first trial data (Inconclusive!)
After adjusting data due to geometry of the balance beam, I plotted the data using Microsoft Excel. I was impressed by the nice plot that resulted, but the more I looked at it the more confused I got. Excel offers an equation that agrees with the plot, but it was not a simple inverse square or inverse cube relationship. In fact, the only equation that really fit was a crazy fifth order polynomial.
One key hint I learned: my measuring/testing system started to register a magnetic force at about 20 mm.
Step 4: There is no simple answer
x^m = y
m Log x = Log y
m = Log y / Log x
The table shows exponent m for distances of 1.28 mm (almost touching the saw table) to 18.26 mm (magnet force barely detectable). So only at a distance of about 16 mm does the magnetic field follow the inverse square law (exponent = 2). As the magnet gets farther way from the saw table, the exponent gets larger, and is about 2.5 at 18.26 mm. I "guessed" that if my testing device was sensitive enough, the exponent would approach 3, which would indicate inverse cube law.
At closer distances the exponent kept decreasing, getting close to zero.
The table shows the relationship between magnetic force and distance, as measured in my test on the saw table.
Distance from magnet, mm D  Force F  Exponent m 
1.28  960  0.35 
2.18  634  0.46 
3.03  442  0.90 
3.87  320  0.99 
4.69  236  1.08 
5.50  178  1.16 
6.31  135  1.23 
7.11  103.2  1.30 
7.91  79.6  1.37 
8.71  62.6  1.42 
9.51  49  1.48 
10.31  38.2  1.55 
11.10  30  1.60 
11.90  23.6  1.66 
12.69  18.2  1.73 
13.49  14.2  1.79 
14.28  10.8  1.86 
15.08  8.2  1.93 
15.87  6.2  2.00 
16.67  3.8  2.16 
17.46  2.4  2.29 
18.26  1.2  2.52 
But the table only goes af far as my scale could detect force from the magnet, only about 18 mm, less than an inch!
Step 5: The best experiment: use a compass!
My tests were inconclusive, after all the distance I could detect with my device only went to 18 mm.
After more Googleing, I found a great website describing how to measure magnetic field using an ordinary compass. The basic setup is shown in the photo. You measure compass needle deflection at different distances, then find the exponent for the relationship using trig formulas provided.
http://www.upicardie.fr/~dellis/Documents/PhysicsEducation/general%20rule%20for%20the%20variation%20of.pdf
After doing this test a few times and taking the average, the results are shown in the table below.
The table shows the relationshio between magnetic force and distance, as measured by the compass needle deflection method.
A really important point: the compass could detect magnet field at 356 mm, over seven inches away.
The average of the values of m is 3.05, indicating that as the magnet gets farther away, the exponent m is about 3, indicating that for this type of magnet only, the force from its magnet field varies inversely by the cube of distance.
In the website above, the professor also tests a long bar magnet. In this case, the field varies inversely by the square of distance. I did not do that experiment.

Try holding your magnet in place, with the north pole pointing in some fixed direction. Now, measure the force as a function of both distance from the center and as a function of the polar angle, the angle between the north axis and the direction to your measurement point (on a globe, this is equivalent to the latitude).
If you plot the data as a function of polar angle at a fixed distance, then you should see an interesting relationship. Conversely, if you plot your data as a function of distance at a fixed polar angle, you should see another interesting relationship.
Yes, there are a lot of issues that make magnetic field not trivial. Interesting point, to use polar angle and latitude, will try it. I found that results varied greatly with small changes in the angle the magnet is held.
I look forward to reading your Instructables.
Thanks much.
Bill
Olympia Wa
I still think this is an awesome instructable idea, and you've written it up quite well! I had forgotten that you were using a compass needle as the probe. Since this spins freely on it's axis, you can actually use it to trace out the orientation of the field lines around your test magnet, and take care of the polar angle dependence that way.
Bill
There are many variables, testing is not trivial. Yes, I have iron filings and will experiment.
This is interesting to consider: One of the most powerful natural magnetic fields is from a neutron star. Can this field be detected on earth, and would that field vary as inverse square?
No, such a field cannot be detected directly. All magnetic fields vary at best as 1/r^{3}, because the lowest order is the dipole. Considering the distances to the nearest compact objects are hundreds of light years (9.5 trillion kilometers), even the strongest known fields (10^{10} tesla) are undectable.
Magnetic fields of astronomical objects are measured spectroscopically. In a magnetic field, each spectral line is split into two slightly separated "versions" by the Zeeman effect. The spinup and spindown electrons in a given atomic energy level have slightly different energies (and hence spectral frequencies) depending on whether they align with or against the local magnetic field. The magnitude of this splitting is proportional to the local field strength.
Looking forward to studying your double slit experiment.
Regards
Bill
2) Surely very sensitive instruments could detect these magnetic fields. But measure its variations with distance, it is another question. I don't think that be possible.