How can we find the magnetic field strength at an arbitrary point relative to a solenoid? I'm writing a program which simulates a solenoid and its magnetic field, and I need to be able to calculate the magnitude and direction of the magnetic field at an arbitrary point in relation to the solenoid(s). I've looked here; http://hyperphysics.phy-astr.gsu.edu/hbase/magnetic/curloo.html, which is a great resource, but I need an equation that can calculate the magnitude and direction of the magnetic field at these arbitrary off-axis points as well.
Equations would be wonderful!
 A: This may not be the most efficient method, but for a wire carrying a constant current $I$ the Biot-Savart Law reads
$$
\mathbf{B}(\mathbf{r}) = \frac{\mu_0}{4\pi} \int \frac{I \, d\mathbf{l}' \times (\mathbf{r}-\mathbf{r}')}{|\mathbf{r}-\mathbf{r}'|^3}
$$
where $\mathbf{r}$ is where you measure the field, $\mathbf{r}'$ is the vector that traces the current distribution, $d\mathbf{l}'$ is an infinitesimal vector and the prime tells you have to integrate only over the primed variables. Note that since $\mathbf{B}$ is a vector, there are really 3 equations above, one for each component of $\mathbf{B}$.
If your current distribution is not one-dimensional but rather two-dimensional (a surface), than simply replace $I \, d\mathbf{l}'$ by $\mathbf{K}(\mathbf{r}') \, da'$, where $\mathbf{K}$ is the surface current density and $da'$ is the surface element. At last, if the charge distribution is a volume, then replace $I\, d\mathbf{l}'$ by $\mathbf{J}(\mathbf{r}') \, dv'$, where $\mathbf{J}$ is the (volume) current density and $dv'$ the volume element.
