# Project Plan – Modeling the Magnetic Field of Magnetic Dipoles using Mathematica

Sources and Resources

My main source will be Griffiths Introduction to Electrodynamics (Fourth Edition), especially pages 253-255, where the magnetic dipole is first introduced and some equations are derived.  Especially important is Eq. 5.88,

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

which gives the magnetic field of a pure dipole in spherical coordinates.  In this equation, $m$ is the magnetic dipole moment, as defined in Eq. 5.86 in Griffiths

$\vec{m} \equiv I \int d\vec{a}$

Mathematica 9 will be my main tool for modeling and presenting my results.

Initial Plans

I plan to start with modeling a single magnetic dipole, whose magnetic field (in spherical coordinates) is given by Eq. 5.88.  Mathematica 9 only works in Cartesian coordinates for 3D vector fields, so the Transformedfield function in Mathematica is important for converting from spherical to Cartesian coordinates.  I will also perform this conversion by hand as a check.

One potential problem I notice already is the visibility of a 3D magnetic field model.  Perhaps it is just for ease in printing textbooks, but most magnetic fields shown in Griffiths are only shown in 2D with magnetic flux lines.  As I begin to make some models, I will experiment with the different visibilities when using 3D vs. 2D vector fields, as well as using vector arrows vs. magnetic flux lines.  It may be that a 3D vector field of arrows is too complicated to actually get a sense of what is going on.  Changes in colors, arrow sizes, and arrow density will also help visibility.  I plan to model a small loop at the origin to represent the magnetic dipole itself, but this may just crowd the model even more.

After the single magnetic dipole model is a bit more set, I will move on to superimposing many magnetic dipoles together to create bigger shapes, such as a bar magnet or horseshoe magnet.  I don’t understand much about how this will work in Mathematica, but the result will be the numeric approximation of what the magnetic fields of these bigger shapes look like.  I know that looping structures in Mathematica will be important, but I have to learn more about how these work and how they will work for my benefit.

Collaborators

I am collaborating with Ramy Abbady and Tewa Kpulun, whose projects are very similar to mine in that they are modeling electric and/or magnetic fields of relatively simple geometries (spheres, cylinders, etc.).  We will compare our techniques and presentation styles to see what the best way to present our results is, as well as support each other in learning some more intricate parts of Mathematica 9 coding.

Timeline

Week 1 (4/7-4/13):  I plan to begin modeling the magnetic field of a single dipole and trying out different presentation styles.

Week 2 (4/14-4/20):  I plan to finish my model of a single dipole and decide which presentation style works best.  I also plan on starting to work out Mathematica looping structures and how they can be used to model complex combinations of magnetic dipoles in my project.

Week 3 (4/21-4/27):  I plan on finishing my Mathematica looping education, and beginning to model bar magnets of different sizes and horseshoe configurations.  If at all successful, preliminary results of more complex configurations of magnetic dipoles will be posted to the blog.

Week 4 (4/28-5/4):  I plan on finishing my complex models, and beginning preparation of my finalized results for the blog.

Week 5 (5/5-5/11):  I plan on finishing my final results for the blog and reading and commenting on the results of my peers’ projects.

## 2 thoughts on “Project Plan – Modeling the Magnetic Field of Magnetic Dipoles using Mathematica”

1. brdeer Post author

As I quickly found out, even the initial models of a magnetic dipole are pretty complicated to model in Mathematica. My motivation for choosing this method is mostly the simple fact that even modeling a single dipole is hard enough, but after the initial model is complete (in some form), multiple fields can be added together quite easily (in theory).

2. Jenny Magnes

I will be interested in even seeing your initial models of a magnetic dipole. What is your motivation for choosing this method to model a bar magnet?