My solution for Problem 3, Numerical Problem NP 5.01

Problem 3: Fun with Mathematica.

The Problem

Several weeks ago, the class considered a classic problem in magnetostatics. Suppose you place a spherical shell of some permeable material in a uniform external magnetic field (Jackson, section 5.12, p. 199). Let the material have permeability mu and call the external, uniform magnetic field Bo. What is the value of the magnetic field, B, everywhere in space, particularly inside the sphere?

Figure 1: A spherical shell in a uniform magnetic field.

The solution is theoretically straightforward. There are three regions in the problem: Region I is external to the shell, region II is inside the shell, and region III is inside the shell. Because we are dealing with magnetostatics we may employ electrostatic methods to solve the problem. In this case we can use the Laplace equation to determine the magnetic potential Phi(m), for the three regions.

According to Jackson, the regions have the following potentials:

For l=1
	Phi(I)   = Delta*r*cos(theta)
	Phi(II)  = (Beta*r+Gamma*r^-2)*cos(theta)

	Phi(III) = - Bo*r*cos(theta)+(alpha/r^2)*cos(theta)

Then one applies boundary conditions. Because the field normal to the surface must be continuous, we get:

	dPhi	       dphi	       dphi        dphi
	---- (b+) = mu ---- (b-)    mu ---- (a+) = ---- (a-) 
	 dr	        dr	        dr	    dr

And because the H(theta) is also continuous we have:

	dPhi	       dphi	          dphi           dphi
     -------- (b+) =  -------- (b-)     -------- (a+) = -------- (a-) 
      d(theta)	      d(theta)          d(theta)        d(theta)

The four conditions yield the four following equations:

	alpha -    b^3*beta -      gamma               =  b^3*Bo
      2*alpha + mu*b^3*beta - 2*mu*gamma               = -b^3*Bo
	           a^3*beta +      gamma - a^3*delta   =  0
	        mu*a^3*beta - 2*mu*gamma - a^3*delta   =  0

And we all know what this means! It means its time to fire up Mathematica to let it figure out alpha, beta, gamma, and delta for us.

The Solution

Actually, a system of four equations and four unknowns is completely doable. But it is quite time consuming, and Mathematica is very good at doing just this sort of thing. Whereas this problem would take me atleast an hour to do with pencil and paper (assuming I believe my first result), Mathematica did it in several seconds.

Type it in (using B for Bo):

Wait a few seconds and get:

Plug these values into the equations for phi above and you have your answer! As a check to see whether we believe these or not, let us take the limit a = 0. Type it in:

Hit enter and get:

According to this, there is no magnetic field inside the shell (seeing as there is no inside of the shell, so far so good).

Another good limit to consider is the limit where a = b, so that the shell thickness is zero. In this limit, the sphere pops out of existance, so one might expect the external field to be unperturbed. Let's see:

(Actually, I sort of lied a bit. I did employ the simplify command a few times to get the answers in slightly more attractive form. But Mathematica really is easy to use, and very fast.)

Once again, the answer checks out. The negative sign might throw you off, until you recall that the field line components are given by the negative derivatives of Phi with respect to the component in question.Lastly, let's consider the nature of the solution for a thin shell. One would expect that the answer wouldn't be much different then for the case where a = b. Let's test this for the situation in which a = .99b.

Type in:

Wait a few seconds and find out why Mathematica can kill you if you don't know what you are doing:

Many of these terms are zero or close enough to one that you can just call them one, but the Simplify command makes an even more horrible mess.

It's fair to say that as the thickness of the shell decreases, the magnetic field inside the shell increases. It's also fair to say that Mathematica has its limits.