Skip to main content
edited body
Source Link

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 functionsintegrals 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.

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.

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 integrals 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.

Source Link
Jens
  • 97.9k
  • 7
  • 215
  • 510

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.