# Formula for the magnetic field due to a current loop

I need expressions for the $$\mathbf B$$ field generated by a circular current loop at a point off-axis from the ring's axis of symmetry.

The ones I came across on the internet aren't very convincing. I verified them with Mathematica, and none seems to be correct ─ I'm checking whether $$\nabla \times \mathbf B = I \hat{\mathbf e}_\theta$$ and $$\nabla \cdot\mathbf B =0$$, but the examples here don't satisfy those (so e.g. the latter will have $$\nabla \times \mathbf B=0$$).

So, more generally: given a ring of current, what is the magnetic field it generates at an arbitrary point? Can this be calculated exactly?

• As mentioned in a comment elsewhere, this can be done in terms of complete elliptic integrals as worked out here. Commented Apr 16, 2018 at 14:50

As mentioned in the accepted answer, the second link in the original question (now hijacked) does have the correct exact expression for the magnetic field, which is essentially given by direct line integration of the vector potential into \begin{align} \mathbf A &= \frac{\mu_0 I}{4\pi} \oint_C \frac{\mathrm d\mathbf l}{r} \\ & = \frac{\mu_0 I}{2\pi} \frac{\sqrt{z^2+(R+\rho)^2}}{2R\rho} \Bigg[ \left(1-\frac{2R\rho}{z^2+(R+\rho)^2}\right) K\mathopen{}\left(\sqrt{\frac{4R\rho}{z^2+(R+\rho)^2}}\right)\mathclose{} \\& \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad - E\mathopen{}\left(\sqrt{\frac{4R\rho}{z^2+(R+\rho)^2}}\right)\mathclose{} \Bigg] \hat{\mathbf e}_\phi , \end{align} where $$K(k)$$ and $$E(k)$$ are complete elliptic integrals of the first and second kind, evaluated at the position-dependent argument $$k=\sqrt{\frac{4R\rho}{z^2+(R+\rho)^2}},$$ and where obviously $$\rho^2=x^2+y^2$$ and the current ring has radius $$R$$ in the $$x,y$$ plane. The magnetic field $$\mathbf B$$ can then be obtained by taking the curl of this vector potential, as usual. (Don't trust the exact detailed constants on my expressions, by the way ─ double-check everything if you're going to use it.)

The catch here, as mentioned in the accepted answer, is that the elliptic-integral functions have singularities at the argument $$k=1$$, which is reached when $$z=0$$ and $$\rho=R$$ (i.e. at the current ring), and those singularities need to be handled carefully when evaluating the derivatives in $$\mathbf B=\nabla \times\mathbf A$$: they almost certainly can be done rigorously, but to do so, you need to treat the derivatives of the singular functions as derivatives in the distributional sense, at which point they will give Dirac-delta contributions to the derivative that exactly match what's required for Ampère's law to hold with a Dirac-delta current density.

• I'm thinking that to get a finite B at the surface of the conductor, the conductor must have a non-zero radius. Commented Mar 7, 2020 at 1:39

Remember, $\vec{\nabla} \times \vec{B} = \mu_0 \vec{J}$, and $\vec{J}$ will be zero anywhere except on the loop itself, where it will be singular. Do you mean, perhaps, that the line integral around the loop equals the current, a la Ampere's law?

Expression for off-axis magnetic field can be derived much more simply... even not going any higher than the elementary Biot-Savart law... as done in this MIT OCW material.

• The example I'm seeing in the MIT material is for points on the axis. I'm thinking that using the Biot formula off axis may require a numeric integration. Commented Mar 7, 2020 at 1:50

This formula has singular induction at center of ring whereas for ring radius 1 it should stay at 1/2.1Formula for the magnetic field due to a current loop is perhaps quadriatic at mid r and reaches correct center velocity of 1/2 but is very odd as r approaches 0 and induction goes singular

n[X_, R_, r_] = Sqrt[XX + (R - r)(R - r)]

d[X_, R_, r_] = Sqrt[XX + (R + r)(R + r)]

l[X_, R_, r_] = (n[X, R, r] - d[X, R, r])/(n[X, R, r] + d[X, R, r])

S[X_, R_, r_] := (n[X, R, r] + d[X, R, r])*(EllipticK[l[X, R, r]] - EllipticE[l[X, R, r]])/2/Pi

Q[X_, R_, r_] = Sqrt[XX + (R + r)(R + r)]

k[X_, R_, r_] = 2Sqrt[rR]/Q[X, R, r]

JS[X_, R_, r_] = Q[X, R, r]*((2 - k[X, R, r]^2)EllipticK[k[X, R, r]] -2EllipticE[k[X, R, r]])/4/Pi

u[X_, R_, r_] = D[JS[X, R, r], r]/r;
out = Plot[{JS[0, 1., r], S[0, 1., -r], u[0, 1., r]}, {r, -0.1, 1.05},PlotStyle -> {Red, Pink, Orange, Brown, Black, Red, Blue, Green}, GridLines -> Automatic, PlotRange -> {0, 2}]

Please someone set down and or code the analytically correct function with parabolic variation at r=0 Mathematica output then code

• Formula given by Emilo is indeed iwrong!. In the end in 2min vs the 2 days I have spent struggling with his and other incorrect formulae like en.wikipedia.org/wiki/…. I directly integrated the formula for magnetic potential of a current segment in Mathematica Commented Dec 5, 2022 at 16:27

Formula given by Formula for the magnetic field due to a current loop, Jackson and https://en.wikipedia.org/wiki/Vortex_ring#:~:text=A%20vortex%20ring%2C%20also%20called,be%20toroidal%2C%20more%20precisely%20poloidal. were all wrong!. I have now corrected wiki In the end in 2min vs the 2 days I have spent struggling with such incorrect formulae like en.wikipedia.org/wiki/…. I directly integrated the formula for magnetic potential of a current segment in Mathematica from Kurrelmeyer and Mais (9.4). The S stream function are just r times this

Clear[r, R, X]
SI[X_, R_, r_] = Integrate[Cos[f]/Sqrt[r*r + R*R - 2*R*r*Cos[f] + X*X]/2/Pi,
{f, 0, Pi}]
u[X_, R_, r_] = D[SI[X, R, r], r]/r;
Plot[{ SI[0, 1., r], u[0, 1., r]}, {r, -0.1, 1.05},
PlotStyle -> { Orange, Brown, Black, Red, Blue, Green},
GridLines -> Automatic, PlotRange -> Automatic]


The salient difference is the argument of the elliptic functions should be k*k. Yes that was the sole mistake In Jackson and thence wiki and physics stackexchange The argument of the ellipitic function should be k squared not k, so just remove the square roots from the arguments in the original post. I hope the moderator can do this please. People should not post formulae without attribution they have crabbed from elsewhere and are not original and not verified and can cause others grief by replicating mistakes, as happened here.

• Yes that was the sole mistake In Jackson and thence wiki and physics stackexchange The argument of the ellipitic function should be k squared not k, so just remove the square roots from the arguments in the original post. I hope the moderator can do this please. Commented Dec 5, 2022 at 19:41