Hover over the menu bar to pick a physics animation.

In electical media, if we have no unpaired charges then we have only dipoles in our medium. By Poisson's equation for the electric field we have:

`bbgrad*bbE=rho_(unpaired)/epsilon_0`

where `rho_(unpaired)` is the un-paired charge density and `epsilon_0` is the permittivity of vacuum. Since the un-paired charge density is zero we have the expression`bbgrad*bbE=0`

where `bbgrad*` is called the divergence. Similarly this expression also applies to `bbB` since there are no un-paired magnetic poles (magnetic monopoles do not exist).`bbgrad*bbB=0`

To begin we need solutiions to these equations for a single dipole. For cartesian coordinates and for a source dipole centered at (0,0,0) we can try (using `bbF` as a substitute for `bbE` or `bbB`)`bbF=x/(x^2+y^2+z^2)^(3/2)bbhatx+y/(x^2+y^2+z^2)^(3/2)bbhaty+z/(x^2+y^2+z^2)^(3/2)bbhatz`

where (x,y,z) is the point of observation (field point) and e,g, `bbhatx` signifies a unit vector in the `x` direction. Then:
`bbgrad.bbF=(delF_x)/(delx)+(delF_y)/(dely)+(delF_z)/(delz)=`

`1/(x^2+y^2+z^2)^(3/2)-3x^2/(x^2+y^2+z^2)^(5/2)+1/(x^2+y^2+z^2)^(3/2)-3y^2/(x^2+y^2+z^2)^(5/2)
+1/(x^2+y^2+z^2)^(3/2)-3z^2/(x^2+y^2+z^2)^(5/2)
`

`=1/(x^2+y^2+z^2)^(5/2)[(x^2+y^2+z^2)-3x^2+(x^2+y^2+z^2)-3y^2+(x^2+y^2+z^2)-3z^2]=0/(x^2+y^2+z^2)^(5/2)`

For simplicity, however, we will use a circular cylinder shape for the media so the results will be axisymmetric about the axis of the cylinder and the field coordinates will be (`rho,z`) where `rho` is the distance from the media axis to the field point. In those coordinates `bbgrad*bbF` is:

`bbgrad*bbF=1/rhodel/(delrho)(rhoF_(rho))+del/(delz)F_z`

I propose the polar coordinate solution`bbF=1/(rho^2+z^2)^(3/2)(rhobbhatrho+zbbhatz)`

Then `F_rho` is`F_rho=rho/(rho^2+z^2)^(3/2)`

Taking the divergence of this solution we get the following components:`F_(rho)/rho+1/rho(rhodelF_rho)/(delrho)= 1/(rho^2+z^2)^(3/2)+del/(delrho)(1/(rho^2+z^2)^(3/2))= 1/(rho^2+z^2)^(3/2)(2-3rho^2/(rho^2+z^2))=1/(rho^2+z^2)^(5/2)(2(rho^2+z^2)-3rho^2)`

Similarly the derivative of `F_z` is`(delF_z)/(delz)=1/(rho^2+z^2)^(3/2)-3z^2/(rho^2+z^2)^(5/2)=((rho^2+z^2)-3z^2)/(rho^2+z^2)^(5/2)`

Adding to get `bbgrad*bbF``bbgrad*bbF=F_rho/rho+1/rho(rhodelF_rho)/(delrho)+(delF_z)/(delz)`

we obtain:`bbgrad*bbF=F_rho/rho+1/rho(rhodelF_rho)/(delrho)+(delF_z)/(delz)= (2(rho^2+z^2)-3rho^2+(rho^2+z^2)-3z^2)/(rho^2+z^2)^(5/2)=0/(rho^2+z^2)^(5/2)`

Note that the result is just 0 except when (rho,z)=(0,0). So the form of `bbF` is an acceptable solution when there are no unpaired sources (monopoles). We will use that solution for both `bbE` and `bbB` here. Remember that a dipole source for `bbB` is just a infinitesimal current loop where `bbb=ia` where `i` is the current and `a` is the area of the loop.

The source dipole charges are at the ends of the media which we will define as `z_d=[-L/2,L/2]` where L is the length of the magnet.

It is worth noting that all of the dipoles in the interior of the cylinder cancel each other so we need only compute the fields due to the single charges sticking out of the ends. Each end will then have opposite charge signs.

Let the radius of the ends be `a` so the source radius range is `r_d=(0->a)`. Then we have to integrate `bbF(rho-r_d,z-z_d)` using the integrands:
`F_rho=(rho-r_dcosphi)/((rho-r_dcosphi)^2+(z-z_d)^2)^(3/2)`

`F_z=(z-z_d)/((rho-r_dcosphi)^2+(z-z_d)^2)^(3/2)`

`F_rho=int_0^aint_0^(2pi)(rho-r_dcosphi)/((rho-r_dcosphi)^2+(z-z_d)^2)^(3/2)dr_ddphi`

`F_z=int_0^aint_0^(2pi)(z-z_d)/((rho-r_dcosphi)^2+(z-z_d)^2)^(3/2)dr_ddphi`

The length, `L`, of the media is adjustable using a slider. Radio buttons allow plotting contours of the axial, radial, and field magnitude.