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?
 A: 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.
A: 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?
A: 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.
A: 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

A: 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.
