Having established the magnetic field of the simplest cases, straight wires, we must go through some calculus before analyzing more complex situations. In this section we shall generate an expression for the small contribution of a segment of a wire to the magnetic field at a given point, and then show how to integrate over the whole wire to generate an expression for the total magnetic field at that point.
Consider a randomly shaped wire, with a current I running through it, as shown below.
This equation is quite complicated, and is difficult to understand on a theoretical level. Thus, to show its applicability, we will use the equation to calculate something we already know: the field from a straight wire. We begin by drawing a diagram showing a straight wire, including an element dl , in relation to a point a distance x from the wire:
Now that we have an expression for the contribution of a small piece, we may sum over the whole wire to find the total magnetic field. We integrate our expression with respect to l , with limits of integration from ∞ to - ∞ :
When we plug infinity into our expression we find that l , implying that plugging in a value of infinity yields the value 1/x 2 . When we plug in our negative infinity, we get -1/x 2 in a similar manner. Thus:
This is the equation we saw earlier for the field of a straight wire, implying that our calculus equation derived earlier is correct. The math that accompanies this kind of calculation is difficult, and rarely used, but it is essential for deriving the formulae we will encounter in the next section.