# Magnetic field of an irregularly shaped permanent magnet?

1. Jul 27, 2008

### hyphenator

1. The problem statement, all variables and given/known data

How do I calculate the magnetic field of an irregularly shaped permanent magnet?

2. Relevant equations

Field of a magnetic point dipole:

$$\vec{B}(\vec{m},\vec{r}) = \frac{(\vec{m}.\vec{r})\vec{r}-\vec{m}\left\|\vec{r}\right\|^{2}}{\left\|\vec{r}\right\|^{5}}$$

where

$$\vec{m}$$ is the dipole moment (in Teslas, I think) and
$$\vec{r} = \vec{p} - \vec{b}$$ is the vector that points from the base $$\vec{b}$$ of the dipole to the point where the field is being evaluated

3. The attempt at a solution

I integrated this point dipole over a field of moments for a solid. The result was wrong because the integration treats the dipole field itself as a derivative.

The solid is a 1x1x1cm cube.

The moment field consists of unit vectors everywhere pointing along the Z-axis (only as a test, the field must be allowed to vary arbitrarily).
The surface field strength is supposed to be around 1.0 Tesla (within an epsilon), but the integration gave 5.7714e+10 Tesla, which tells me I did something very wrong indeed.

Note: I am using numerical integration without physical constants (because free space permeability is too small for machine precision), so I don't expect the results to be exact, just within a scalar multiple of the desired answer. I have adjusted the predicted results accordingly.

How can I use a field of moments for a solid to calculate the correct magnetic field?

I believe I need a "moment element" analogue of a volume element, but I have no idea how to make it.

Last edited: Jul 27, 2008