3D lecture-demo programs for E&M
The work below is licensed under a Creative Commons Attribution 4.0 License. Please read the license before downloading the software.
The initial number is the chapter of Matter & Interactions (3rd
edition) in which the program is most useful.
Read the text at the start of the program for how to use the program.
Install VPython to use these programs.
These programs work with either the Python 2.x series or the Python 3.x series, and with VPython 5.x or VPython 6.x.
Here are all of the programs listed below, in one zip file.
In these VPython programs, to rotate or zoom the "camera":
Right button drag or Ctrl-drag to rotate the camera to view the scene.
Middle button or Alt-drag to drag up or down to zoom in or out.
On a two-button mouse, middle is left + right.
program to demonstrate electric and magnetic fields, Gauss's law, Ampere's
Right-click dipoles.em to get a data file for a stack of dipoles, cap.em for a capacitor, and current_sheets.em that create magnetic fields.)
14_E_point_charge_drag.py (electric field throughout space around a charge; can drag the charge)
15_MobileElectrons.py (shift the electron sea back and forth with the mouse)
16_E_ring_demo.py (add up pieces of a ring to make electric field of a ring)
16_E_disk_add_rings.py (add up electric field of rings to make field of disk)
16_E_disk.py (electric field near a disk)
16_E_sphere_outside_rings.py (electric field outside a sphere, adding up rings)
16_E_sphere_rings.py (electric field inside a sphere, adding up rings)
18_crossproduct.py (croos product in 3D)
18_MobileElectronCurrent.py (continuous shift of mobile electron sea due to nonzero electric field in wire)
18_B_long_wire.py (magnetic field near a long straight wire)
18_Bloop_with_r_dB.py (magnetic field of loop, adding up segments of loop)
18_Bwire_with_r.py (magnetic field of wire, adding up segments of wire)
18_B_loop.py (magnetic field near a current-carrying loop)
18_solenoid_drag.py (drag mouse around inside and outside a solenoid to see magnetic field)
20_RCcircuit.py (numerical integration of an RC circuit)
21_helix_in_B.py (helical motion of a proton in a uniform magnetic field)
21_B_movingproton.py (magnetic field of a moving high-speed proton)
21_E_movingproton.py (electric field of a moving high-speed proton)
21_spark_mean_free_path.py (watch one atom move through a gas)
22_Gauss_2win.py (navigable 3D version of the diagrams in Chapter 21 on Gauss's law)
23_Faraday-magnet.py (Faradays' law: moving magnet)
23_Faraday-coil.py (Faradays' law: coil with time-varying current)
24_radiate0_fieldlines.py (nature of radiative field lines)
24_radiate_kink.py (development of kink in electric field of accelerated charge)
24_Radiation2D_showR.py (radiative E and B spreading out in a plane from accelerated charge)
24_Radiation3D.py (radiative E and B spreading out in 3D from accelerated charge)
24_pulse_sq.py (one pulse of radiative E and B fields)
24_sinusoidal_wave.py (sinusoidal wave displaying E and B, and wavelength)
24_plane_sinusoidal_wave.py (a phalanx of radiative E and B fields)
24_antenna.py (radiation spreading out from an antenna)
24_lens3.py (interactively show rays passing through a thin lens)
24_wavefront.py (change of wavelength as light passes into matter)
25_interf_constructive.py (constructive interference from two radiators)
25_interf_destructive.py (destructive interference from two radiators)
25_interf_both.py (both constructive and destructive interference from two radiators)
25_crystal_planes.py (show crystal structure and crystal planes)
25_powder_xray.py (aspects of powder x-ray diffraction)
25_standing_wave.py (two traveling waves add up to a standing wave)