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.
