Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am working on solving the Biot-Savart Law equation for the magnetic field around a charged ring of uniform current density. The expression that Mathematica gives is rather nasty, as expected. Notice that the limits of integration are not included in the solution. Mathematica rejects the bounds of integration by silently refusing to even consider a solution (literally, it sits there for several minutes "Running..." and then just stops like nothing ever happened). My idea was that since Mathematica didn't mind handing over the indefinite integral, that I could turn it into a function of theta and manually apply the first fundamental theorem of calculus. For some reason, I can't seem to convince Mathematica that I want this to be a function that I want evaluated at 2Pi and at 0 so that they can be subtracted. Here is the code up to the integration. Thanks in advance for any feedback.

s=1;
m=4*Pi*10^7;
l[Theta_]:={s Cos[Theta],s Sin[Theta],0};
R={x,y,z}-l[Theta];
r=R/Sqrt[R.R];
Deel=D[l[Theta],Theta];
Cross[Deel,r];
Integrand=%/R.R;
B=(m/4*Pi) Integrate[(Integrand),Theta,GenerateConditions ->False]
share|improve this question
1  
It looks like a ghastly integral. I am not so sure the results, symbolically, would be of any use. Is there a reason not to make this into a numerical problem wherein, for given (x,y,z), you use NIntegrate to get a value? –  Daniel Lichtblau Sep 21 at 0:33
    
I don't recall off the top of my head whether there exists a closed-form solution for the magnetic field of a current loop, although there are closed-form solutions for the on-axis field strength, and they are typically derived in intro E&M classes. For the off-axis case, if a closed-form solution does not exist, there exist multipole-expansions which are available in closed-form, but again, they are series expansions. –  DumpsterDoofus Sep 21 at 2:19
1  
See my answer at physics.stackexchange.com/questions/107632/…, I don't know if this helps, but it's at least a usable series approximation. –  DumpsterDoofus Sep 21 at 2:24

2 Answers 2

The integrals can in fact be done exactly, but only if you make some use of the symmetries of the problem first.

  • The circular ring geometry implies that the magnetic field will look the same in any vertical plane going through the rotation axis (which we call the z axis). Therefore, we don't need to specify three independent variables x, y and z to do the calculation. Instead, set y = 0 and look only at the xz plane.
  • The component of the magnetic field perpendicular to the xz plane must be zero, so we don't have to calculate the integral for it.
  • Use spherical polar coordinates to specify the point of interest, instead of Cartesian coordinates
  • In the non-zero integrals over the ring, the integration variable Theta appears only in the form Cos[Theta] which is symmetric around Theta = π. Therefore, all integrals can be reduced to the domain {Theta, 0, π} if we multiply the result by 2 at the end.

With these points in mind, the calculation goes like this (using exactly your setup): replace the Integrand by int2 which uses spherical coordinates with the azimuthal angle set to zero (xz plane), then observe that we only need to integrate int[[1]] and int[[3]] to get Bx and Bz:

s = 1;
m = 4*Pi*10^7;
l[Theta_] := {s Cos[Theta], s Sin[Theta], 0};
R = {x, y, z} - l[Theta];
r = R/Sqrt[R.R];
Deel = D[l[Theta], Theta];
Cross[Deel, r];
Integrand = %/R.R;
int2 = Simplify[
  Integrand /. 
   Thread[{x, y, 
       z} -> ρ {Cos[ϕ] Sin[θ], 
        Sin[ϕ] Sin[θ], Cos[θ]} /. ϕ -> 
      0], ρ > 0 && θ > 0 && ϕ > 0 && Theta > 0]

$$\left\{\frac{\rho \cos (\theta ) \cos (\text{Theta})}{\left(\rho ^2-2 \rho \sin (\theta ) \cos (\text{Theta})+1\right)^{3/2}},\\ \frac{\rho \cos (\theta ) \sin (\text{Theta})}{\left(\rho ^2-2 \rho \sin (\theta ) \cos (\text{Theta})+1\right)^{3/2}},\\ \frac{1-\rho \sin (\theta ) \cos (\text{Theta})}{\left(\rho ^2-2 \rho \sin (\theta ) \cos (\text{Theta})+1\right)^{3/2}}\right\}$$

Bx = 
 2 Assuming[ρ > 0 && Pi/2 > θ > 0, 
   Integrate[int2[[1]], {Theta, 0, Pi}]]

$$\frac{2 \cot (\theta ) \left(\left(\rho ^2+1\right) E\left(\frac{4 \rho \sin (\theta )}{\rho ^2+2 \sin (\theta ) \rho +1}\right)-\left(-2 \rho \sin (\theta )+\rho ^2+1\right) K\left(\frac{4 \rho \sin (\theta )}{\rho ^2+2 \sin (\theta ) \rho +1}\right)\right)}{\left(-2 \rho \sin (\theta )+\rho ^2+1\right) \sqrt{2 \rho \sin (\theta )+\rho ^2+1}}$$

Bz = 
 2 Assuming[ρ > 0 && Pi/2 > θ > 0, 
   Integrate[int2[[3]], {Theta, 0, Pi}]]

$$\frac{2 \left(\left(-2 \rho \sin (\theta )+\rho ^2+1\right) K\left(\frac{4 \rho \sin (\theta )}{\rho ^2+2 \sin (\theta ) \rho +1}\right)-\left(\rho ^2-1\right) E\left(\frac{4 \rho \sin (\theta )}{\rho ^2+2 \sin (\theta ) \rho +1}\right)\right)}{\left(-2 \rho \sin (\theta )+\rho ^2+1\right) \sqrt{2 \rho \sin (\theta )+\rho ^2+1}}$$

Here, $E$ and $K$ are the elliptic functions EllipticE and EllipticK.

StreamPlot[{Bx, 
   Bz} /. {θ -> ArcTan[z, x], ρ -> Sqrt[
    x^2 + z^2]}, {x, -2, 2}, {z, -2, 2}]

ringeField

This is a plot of the exact result.

share|improve this answer

You might also be interesting in looking at web-Mathematica (version 5) solution below.

http://mokslasplius.itpa.lt/eksperimentai/ta-kinio-kruvio-judejimas-nevienalyciame-lauke#etn09

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.