# Why did I measure the magnetic field to vary exponentially with distance?

In my physics lab class, we were allowed to come up with our own research question and then try to answer it. My question was whether permanent magnets (i.e., things like refrigerator magnets) would also have the characteristic that B decays with 1/distance as we see for the B created by current in a straight wire.

To answer this, I measured the magnetic field using a magnetometer at various distances from the magnet and then plotted 1/R vs. B in a linear fit, and B vs. R in a semi-log and log-log fit. For all the fridge magnets studied, the chi-square value of the best fit line in the semi-log plot was much closer to 1 than in the other fits and the residuals were all near zero, indicating that the semi-log was the best fit (and not only the best fit, but a very good fit over all) and the relationship between B and R was best modeled by an equation of the form B = Ae-CR. Why is this?

Why would permanent magnets have an exponential relationship with R? I don't need to know the answer to this question for my project. I just need to present the data, but I wondered if anybody knows why this might be.

• To be fair, the field of a bar magnet can be more complicated than just $\frac1r$, and may have dependence on other powers of $r$, much like how an ideal dipole has a field that has parts that go as both $\frac{1}{r^5}$ and $\frac{1}{r^3}$. – Triatticus Dec 4 '20 at 2:50
• Can you clarify what kind of magnet you looked at? Was it a straight bar magnet, or a "one-sided" refrigerator magnet? – J. Murray Dec 4 '20 at 2:59
• @J.Murray It was a "one-sided" fridge magnet. – Peter Blood Dec 4 '20 at 3:34
• I think constants and quantities are too close: A, B, C, and R. Isn't there a better notation? E.g., lowercase for constants? – Peter Mortensen Dec 4 '20 at 12:08
• Take the $R^2$s over log-linear and log-log transformed data with a *massive* grain of salt. The usual tools for linear regression assume that any noise in your data is (1) gaussian and (2) uniform over the data set. However, a linear-to-log transformation will magnify the noise in places where the signal is smaller. (To see why, plot the error bars on the log scale. What happens to the error bar of $\log(x)$ if $\Delta x$ is bigger than $|x|$?) There are specific ways to deal with this in the statistics (via nonlinear model fits, or non-uniform noise profiles)... – Emilio Pisanty Dec 4 '20 at 12:56

This comment

It was a "one-sided" fridge magnet.

is a key piece of information.

Your magnet is not a single dipole bar magnet; instead, it is a Halbach array, i.e., a carefully-engineered arrangement of individual dipole magnets which has been optimized to have a strong magnetic field near the magnet which becomes weak as you go away from it. This is normally achieved by having rapid switches in polarity, which channels the magnetic flux from one of the magnets of the array into its neighbours. In pictorial terms, this means that comparatively few field lines make it out to infinity, which makes the far-field weaker.

In more mathematical terms, the alternating polarity means that the total magnetic dipole moment of the system is zero (or, at best, very small), which implies that the leading $$\sim1/r^3$$ contribution to the field away from the system will vanish, and you will be left with higher powers taking up much of the variation. In a log-log plot, this will make the descent steeper.

And, to make matters worse, as you get close to the magnet, you will get near-field effects where the various smaller constituent dipoles contribute nonzero amplitudes which do not fully cancel, so you cannot expect the near-field distribution to be a single power law. If you want a clean single-power asymptotic, you need to be in the asymptotic regime. (But then at that asymptotic regime the signal is much weaker, which means that the signal-to-noise ratio is much worse, and it's much harder to get useful data.)

When you combine all of these things (high near fields, higher-than-$$r^{-3}$$ asymptotics, bad SNR in the asymptotic region, and challenging statistical handling of the uncertainty at low SNR using the fit methods you mentioned) it is entirely plausible that a naive search for fits (in your case, looking for single-line fits in various log scales) can find a good statistical fit which does not follow from first principles.

• This answer is fine up till the last paragraph. The exponential fit is not a fluke--if you look at the Wikipedia page you linked, you'll see that the field of an ideal Halbach array is rigorously exponential. If you change that last paragraph, you'll get an upvote from me (and I'll delete this comment). – Yly Dec 4 '20 at 20:56
• @Yly Having looked at Wikipedia more closely, I don't think the description provided in the OP is sufficient to tell whether a rigorous exponential decay is an appropriate model or not. (The critical information missing is the range of distances probed, as compared to the length of the magnet.) – Emilio Pisanty Dec 5 '20 at 14:38
• Given that the original wording is non-committal w.r.t. whether the obtained statistical fit follows or not from first principles, I will retain the wording as it stands. But thank you deeply for bringing up this aspect of the problem! – Emilio Pisanty Dec 5 '20 at 14:39

Ahhh, the delights of experimental science! You have imperfect data, and a particular model fits. But does the model make physical sense? Could there be another model which (a) is similar to the one you used (to within the noise) and (b) follows from first-principles? Would this unknown alternate model be better? Should you lie awake at night worrying that the model you’re about to publish is nonsense?? Are you going to stand up in front of an audience and present this model which some self-satisfied, grey-haired professor will shoot down with conspicuous glee??? But it fits the data......

Luckily, here the stakes are low, and we know what we’re dealing with. A bar magnet is a magnetic dipole. Its field falls off as $$1/r^3$$, at least once you’re far away compared to its size. So try fitting with that.

Why might you have gotten decent results with exponential decay? Well, $$1/r^3$$ and $$e^{-r}$$ don’t look that different from each other over an appropriate range. And who knows? Maybe your experiment was over that very range. And then there’s noise! Sometimes only one or two noisy data points throw off a fit (just by chance!) if you don’t have a lot of measurements. That’s science!

• Note that the OP isn't using simple dipole bar magnets, they're using one-sided fridge magnets, i.e., Halbach arrays. – PM 2Ring Dec 4 '20 at 14:43
• @PM2Ring well, that’s important information! Thinking you have something you don’t is probably the most tried and true way to get the model wrong. And with noisy data, it could fit anyway (gulp!). – Gilbert Dec 4 '20 at 15:44
• To the down-voters, the original question said “bar magnet”. Fortunately, this information trickle is a teachable moment aligned with the crux of my answer: In experimental science, we don’t have all the information, and noisy data can lead us to propose an incorrect model. More and more data can further constrain a model, but given limited measurements, many models might fit to within an acceptable confidence. – Gilbert Dec 4 '20 at 19:49
• -1. This is not an answer. If you chock up everything you don't understand to experimental error you never learn anything. Dismissively attributing surprising results to "noise" or poor data is the hallmark of bad theory, and the better answer on Halbach arrays shows that such is indeed the case for this answer. Also, $1/r^3$ does look quite different than $e^{-r}$ if you do your stats right (which it seems the OP has done), and the OP apparently did try fitting $1/r^3$. – Yly Dec 4 '20 at 20:38
• You having a bad day, @Yly? This is just an unexpectedly aggressive and sanctimonious comment. I’ll reiterate that Halbach arrays were irrelevant to the original question. The OP said “bar magnet”. And obviously one can distinguish between $1/r^3$ and $e^{-r}}$, in principle. We don’t know know the statistics of the experiments, only that there was inevitable noise. – Gilbert Dec 5 '20 at 1:45

As has already been answered by @Gilbert, a permanent magnet can be considered as a magnetic dipole, and the leading term in the dipolar field decreases as $$1/r^3$$. This power law dependence is hard to distinguish from an exponential one $$e^{-\alpha r}$$.

Let me throw in a few experimental/data analysis tips: the power law would be best seen on a log-log plot: $$y=r^{-\beta}\longrightarrow \log y = -\beta\log r,$$ and the rule of thumb is that onr needs a data over at least four decades to ascertain that it is really a power law (i.e., changing $$r$$ over four orders of magntitude.) Note that you still have to be sufficiently far from the magnet, to consider it as a dipole.)

• OP is clearly aware of this technique, and is explicitly asking why the log-log fit did not work as well as the log-linear one. This does not address the question (as asked) at all, beyond the callout to the other existing answer. – Emilio Pisanty Dec 4 '20 at 13:45
• @EmilioPisanty Well, I did miss mentioning of log-log plot in the question. But the key point here is that you need data over at least four decades. – Vadim Dec 4 '20 at 13:54