# What is the $B$-field on the axis of a finite Iron-Core Solenoid, a Given Distance Beyond The Tip?

I am building a solenoid electromagnet with a core of known permeability $$\mu$$. The core needs to stick out slightly beyond the ends of the coils. Let's assume that the magnet is oriented with its core axis aligned to the z-axis. I can easily calculate the B-field of that solenoid anywhere along the z-axis so long as I'm within the core, and I'm assuming that the B-field at the very ends of the core is the same as in the center.

The problem is, that the parameter I need to be able to calculate and optimize is the B-field 4.5 mm away from the end of the core along the z-axis. (i.e. 4.5 mm beyond the end of the electromagnet).

For the air-cored case, this is very simple (see, for example, Griffith's E&M problem 5.11 from 4e). I think my case is a lot harder though. I don't think I can just replace $$\mu_0$$ with $$\mu$$, since the magnetic medium does not extend all the way to the point in question. (There are 4.5 mm of air between the end of the core medium and the point of interest. Does anyone have any ideas on how to determine the B-field at this point?

Well, I'm an experimentalist, so I decided to just do an experiment. Assuming the core is positioned from $z=0$, to $z = L$, and that the coil has an average radius $r$, I found that:
$B \propto \frac{z}{\sqrt{r^2 +z^2}}+\frac{L-z}{\sqrt{(L-z)^2 + r^2}}$.
$B_z(z) = \frac{\mu N I}{2L}\Big[\frac{z}{\sqrt{r^2 +z^2}}+\frac{L-z}{\sqrt{(L-z)^2 + r^2}}\Big]$. To derive this, I'm told, you start with, e.g. Griffith's E&M equation 5.41 (4e), and integrate from $0$ to $L$. I'm not sure how to do that though, so if anyone wants to derive that for me, I'd be super-happy!
You can't just put in $$\mu$$. The end effect at the end of the core is important. Also $$\mu$$ isn't usually constant for an iron core. It becomes a problem in "Magnetic Circuits", where you have to know the magnetic properties of the core.