22.7: Sample problems and solutions
- Last updated
- Nov 7, 2023
- Save as PDF
- Page ID
- 89801
( \newcommand{\kernel}{\mathrm{null}\,}\)
Exercise 22.7.1
A square loop of wire with side length, L, carries current, I, as shown in Figure 22.7.1. What is the magnetic field at the center of the loop?

- Answer
-
The square loop is simply made of four straight sections of wire of length, L. The magnetic field from each section of wire is into the page, which you can easily verify with your right-hand (with your thumb in the direction of current, your fingers curl in the direction of the resulting magnetic field).
The magnetic field at the center is just four times the magnetic field produced by a single segment, which we determined in this chapter. The magnetic field at the center of the loop is thus four times the magnetic field at a distance, h=L2, from a wire of length, L:
B=4×μ0I2πL2L/2√L24+L24=2√2μ0IπL
Exercise 22.7.2
Helmholtz coils are an arrangement of two parallel loops of current which produce a nearly uniform magnetic field. Helmholtz coils are formed by two identical circular loops of radius, R, carrying the same current, I, where the centers of the coils are separated by the distance, R, as illustrated in Figure 22.7.2. Determine the magnetic field as a function of z, along the axis of symmetry of the coils, where the origin is located half way between the two coils. Make a plot of the magnetic field as a function of z from each coil, as well as the total electric field to show that it is close to uniform between the coils.

- Answer
-
We know that the magnetic field at a distance, h, from the center of a loop of current, along its axis of symmetry is given by:
B(h)=μ0I2R2(R2+h2)32
For the two coils in the Helmholtz configuration, the magnetic field from each coil will be in the same direction. The center of the two coils are located at z=±R2. Thus, if we are located at position, z, along the z axis, one coil will be at a distance of z+R2, and the other at a distance z−R2. The total magnetic field as a function of z is then given by:
Btot(z)=B(z+R2)+B(z+R2)=μ0I2R2(R2+(z+R2)2)32+μ0I2R2(R2+(z−R2)2)32
We can plot this function, as well as the two individual terms using python. For information, we show the code below. In order to make the plot, we need to choose some reasonable values for the radius of the coils and the current through the coils, for example:
- R=0.3m
- I=0.1A
Python Code 22.7.1: Numerical integration of a function
01
#Import the modules that we need:
02
import
numpy as np
03
import
pylab as pl
04
05
#Define some constants:
06
mu0
=
4
*
np.pi
*
1e
-
7
#4 pi
07
I
=
0.5
08
R
=
0.3
09
10
#Define the values on the z axis, from -2R to +2r, in 100 increments
11
z
=
np.linspace(
-
2
*
R,
2
*
R,
100
)
12
13
#Determine the magnetic field from the coils at those values of z
14
#The coil at z=-R/2:
15
B1
=
(mu0
*
I)
/
2
*
R
*
*
2
/
((R
*
*
2
+
(z
+
R
/
2
)
*
*
2
)
*
*
(
3
/
2
))
16
#The coil at z=+R/2:
17
B2
=
(mu0
*
I)
/
2
*
R
*
*
2
/
((R
*
*
2
+
(z
-
R
/
2
)
*
*
2
)
*
*
(
3
/
2
))
18
#The sum:
19
B
=
B1
+
B2
20
21
#Make the plot
22
p1.figure(figsize
=
(
10
,
6
))
23
p1.plot(z,B1,label
=
'Coil at z=-R/2'
)
24
p1.plot(z,B2,label
=
'Coil at z=+R/2'
)
25
p1.plot(z,B,label
=
'Total'
)
26
p1.legend()
27
p1.xlabel(
'z position [m]'
)
28
p1.ylabel(
'Magnetic field [T]'
)
29
p1.show()
Output 22.7.1:
Figure 22.7.3: Magnetic field from each coil, as well as their sum, for two coils in the Helmholtz configuration.
As advertised, we see a region between the Helmholtz coils where the magnetic field is nearly uniform.