PHYS 220 — Lab #8 [Solution]

This lab is a two-part sequence that will address certain topics in electromagnetism. In this part you will numerically integrate the Biot-Savart law to find the B-field for a solenoid. By doing this you'll be obtaining results off-axis, results that cannot be obtained in closed form analytically. I'll provide you with a visualization script for your solution. The assignment is due at the beginning of lecture on Monday, 13 April. Your solutions should include a code listing and plots based on my visualization script. HW #7 will be in support of this lab.


  1. The solenoid you'll be modeling comprises N turns, height h, radius 1 and a current 4π/μo flows through it. It is centered in the x-y plane and it's axis is along the z-axis. The coil begins at (1,0,h/2) and spirals down to (1,0,-h/2). The current flows downward in the z-direction.
  2. For each of the following parameters, find the vector B at (0,0,0) and (0,0,±h/2). Compare your results with the theoretical values B = Bz = 4πN/h in the center and B = Bz = 2πN/h at the ends. Δθ = π/10 will provide you with sufficient resolution.
    In the table below, I list Bz/Bz,theory for each of the conditions and locations. Note that as N & h get large, the solenoid acts more like an ideal one.
    z = 0 z = +h/2 z = -h/2
    N = 80, h = 2 0.7071 0.8950 0.8939
    N = 100, h = 10 0.9806 0.9975 0.9925
    N = 1000, h = 100 0.9998 1.003 0.9975


  3. Using N = 150 and h = 2, use my visualization script to image the B-field in the x-y and x-z planes.

Your figure should look something like the one below. You'll assess the results in HW #8.