Matter & Interactions

3D lecture-demo programs for E&M

Creative Commons License
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.
Install VPython to use these programs.

These programs work with Python 2.7 plus VPython 6.11.
You can also run equivalent GlowScript VPython versions in your browser at

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.

13-fields A general utility that can display electric and magnetic fields; visualize potential difference, Gauss's law, and Ampere's law

13-Efield-point Electric field of a point charge in 3D

13-E-point-charge-drag Electric field throughout space around a charge; can drag the source charge

14-mobile-electrons Electrons moving through a positively charged lattice

15-E-ring-demo-dE Add up electric field of pieces of a ring to make electric field of a ring

15-E-disk-add-rings Add up electric field of rings to make field of a disk

15-E-sphere-outside-rings Add up electric field of rings to make the field outside a sphere

15-E-sphere-inside-rings Add up electric field of rings to make the field inside a sphere

15-Edisk Electric field near a uniformly charged disk

17-mobile-electron-current Electron current: mobile electrons driven by an electric field

17-cross-product 3D view of the cross product

17-cross-product-area 3D view of the cross product, with a parallelogram whose area is the magnitude

17-Bwire-with-r Magnetic field of a wire

17-B-loop-with-r-dB Magnetic field of a ring, one step at a time

17-B-loop-xy-xz Display magnetic field of a ring, in two planes

17-toroid Magnetic field of a toroid

18-Erings Electric field near a line of rings with linearly varying charge

18-SurfaceCharge Distributions of surface charge and electric field, electrostatics and circuits (currently GlowScript only)

19-RCcircuit Graphs of charge and current in an RC circuit, calculated iteratively

20-spark-mean-free-path Mean free path in a gas; relevant for Ch. 20 discussion of sparks

21-Gauss A qualitative introduction to Gauss's law

22-Faraday-coil Curly electric field associated with the changing magnetic field of a coil

22-Faraday-magnet Curly electric field associated with the changing magnetic field of a moving magnet

23-fieldlines Field lines of a point charge

23-radiate2D-fieldline-kink The kink in the field lines of an accelerated charge

23-pulse-plane-wave A pulse train of electromagnetic radiation

23-radiate2D A 2D slice of lectromagnetic radiation spreading out from an accelerated charge, by Joe Heafner

23-radiation-3D Radiative E and B spreading out in 3D from accelerated charge, by Joe Heafner

23-sinusoidal-plane-wave A plane wave of sinusoidal radiation

23-sinusoidal-wave-wavelength The meaning of wavelength

23-wavefront Rays and wavefronts at the boundary between two materials with differing index of refraction

23-lens Interactive ray tracing through a converging or diverging lens

S3-interference-constructive Constructive interference of two sources of electromagnetic radiation

S3-interference-destructive Denstructive interference of two sources of electromagnetic radiation

S3-interference-both Constructive and destructive interference of two sources

S3-crystal-planes Planes in crystals relevant for x-ray diffraction

S3-powder-xrays Powder x-ray diffraction

S3-standing-wave A standing wave produced by interference of leftward-going and rightward-going waves

At is a an equivalent set of VPython demos for use with an installed Python.