Magnetic Field of a Continuous Ring

In this worksheet you will examine the magnetic field due to a continuous ring of charge with radius R=1, linear charge density given by ((λ (Subscript[μ, o]))/(4π))=1,, and rotating with period T=1.

The magnetic field is given by an elliptic integral, which Mathematica cannot do in general.

(OverVector[B])=(∫_0^(2π))(((-sin(ϕ')(OverHat[x])+cos(ϕ')(OverHat[y]))×((r-cos(ϕ'))(OverHat[x]) -sin(ϕ')(OverHat[y]) + z(OverHat[z])))/((((r^2)+1-2r cos(ϕ')+(z^2)))^(3/2)))dϕ'

Clear[r,z,ϕ]

Set ϕ=0 for simplicity.

ϕhat={-Sin[ϕ'],Cos[ϕ'],0};
DeltaR={r-Cos[ϕ'],-Sin[ϕ'],z};

Num=Simplify[Cross[ϕhat,DeltaR]]

Den=(r^2+1-2r Cos[ϕ']+z^2)^(3/2)

(Subscript[B, x])=z Integrate[Cos[ϕ']/Den,{ϕ',0,2π},Assumptions->{r>0,z>0}]

(Subscript[B, y])=z Integrate[Sin[ϕ']/Den,{ϕ',0,2π},Assumptions->{r>0,z>0}]

(Subscript[B, z])=-r (Subscript[B, x])/z+Integrate[1/Den,{ϕ',0,2π},Assumptions->{r>0,z>0}]

Mathematica can "do" the integral for particular values of the coordinates r and z (and with ϕ=0).

Integrate[Num[[1]]/Den/.{r->4,z->2},{ϕ',0,2π},Assumptions->{r>0,z>0}]

N[%]

Integrate[Num[[2]]/Den/.{r->4,z->2},{ϕ',0,2π},Assumptions->{r>0,z>0}]

Integrate[Num[[3]]/Den/.{r->4,z->2},{ϕ',0,2π},Assumptions->{r>0,z>0}]

N[%]

It can also use this numerical evaluation to plot the potential, We plot (OverVector[B]) in the r and z plane, alongside the magnitude of the potential (OverVector[A]).

(Subscript[A, y])=Integrate[Cos[ϕ']/Sqrt[r^2+1-2r Cos[ϕ']+z^2],{ϕ',0,2π},Assumptions->{r>0,z>0}];

Plot3D[(Subscript[A, y]),{r,0,3},{z,-1.5,1.5},AxesLabel->{r,z}, ColorFunction-> Hue,ViewPoint->{0,0,Infinity},MeshFunctions->{#3 &}]

aplot=ContourPlot[(Subscript[A, y]),{r,0,3},{z,-1.5,1.5},Contours->10]

Kluge to help Mathematica evaluate?

Bx[rr_,zz_]:=Integrate[Num[[1]]/Den/.{r->rr,z->zz},{ϕ',0,2π}];
Bz[rr_,zz_]:=Integrate[Num[[3]]/Den/.{r->rr,z->zz},{ϕ',0,2π}];

Bx[rr_,zz_]:=Evaluate[(Subscript[B, x])/.{r->rr,z->zz}];
Bz[rr_,zz_]:=Evaluate[(Subscript[B, z])/.{r->rr,z->zz}];

Bplot=VectorPlot[{Bx[r,z],Bz[r,z]},{r,0,3},{z,-1.5,1.5},VectorPoints->12,VectorScale->0.2,VectorStyle->Red,PlotRange->{{0,3},{-1,1}}]

Show[aplot,Bplot]

by Tevian Dray