As I began working on this modeling project in Mathematica, it quickly became apparent that even just the magnetic field of a single magnetic dipole is pretty complicated to model. Transforming between Spherical and Cartesian coordinates via Mathematica’s built in TransformedField function is more complicated than expected, and may even not work at all.

The expressions for $\vec{B_x}$, $\vec{B_y}$, and $\vec{B_z}$, get pretty complicated, as I found out when I began transforming them by hand to check against Mathematica’s TransformedField results. The Mathematica files containing some of my current work can be viewed here. The file named “transforming coordinates.nb” shows my attempts to use the TransformedField function to get the three Cartesian components of the general magnetic field equation, originally expressed in Spherical coordinates. The fact that a 3D vector plot of the resulting expressions shows nothing leads me to believe something more involved is necessary to convert these expressions between Spherical and Cartesian coordinates. I may try calculating the separate expressions for $\vec{B_x}$, $\vec{B_y}$, and $\vec{B_z}$ by hand, typing them all into Mathematica, and using these expressions to try to generate a 3D vector plot, but there may be easier and more informative ways of presenting the magnetic field information.

Professor Magnes suggested that I try looking at only a sample of representative points near the magnetic dipole, and evaluating the magnetic field expression,

$\vec{B} = \frac{\mu_0 m}{4 \pi r^3} (2 cos \theta \hat{r} + sin \theta \hat{\theta})$

at these points using the Spherical coordinates at first, and converting these points into Cartesian form before plotting a 3D vector plot. Because of the nature of plotting vector fields in 3D in Mathematica, this may or may not prove to be less complicated. Another option is presenting the field information in a different way, utilizing contour plots (ListContourPlot3D in Mathematica) instead of vector arrow plots. A contour plot will show equipotential surfaces within the magnetic field instead of the arrows representing the magnitude and direction of the magnetic field at certain points. However, the equipotential surfaces and vector arrows are intimately related: vector arrows are always perpendicular to equipotential surfaces. Therefore, this may be an easier way to compute and show the magnetic field of a magnetic dipole. Vector arrows can always be added on top of the contour plot to show the magnetic field in another way as well. There are a lot of factors to play with to see what presentation style will be the most effective.

The other file in the link to my Mathematica work so far contains the start of generating a list of representative points around the origin in Spherical coordinates and the start of converting them into Cartesian coordinates using the CoordinateTransform function in Mathematica. This file is currently quite preliminary. I still have a long way to go before I get a graph presenting some information about the magnetic field of a magnetic dipole.

Jenny MagnesYou really need some data. Also, post some visualizations.