## Chapter 15: EField

Although Animator and EField have many superficial similarities, their design philosophies are different. EField is based almost entirely on potential energy, whereas Animator is based on forces. EField version 1 was conceived to show the relationship between a scalar field and its gradient. In electrostatics, this is the relationship between a potential and the associated electric field. The potential that is shown on the screen can be specified by both an external function and embedded point charges. Test charges, that is charges that move under the influence of the field but are too small to affect the field, were added in version 2 of EField.

Since much of the computational machinery necessary to move charges and draw objects was in place in the basic applet, it was straightforward to extend EField to include other topics in a typical electricity and magnetism course. Cylindrical as well as spherical charges, electric flux calculations, and magnetic fields (albeit only in the z direction) are now supported. Nevertheless, at its core, this Physlet does its calculations using the potential energy and its gradient. Interested readers may wish to investigate the Poisson Physlet for another approach to presenting electric field and potential problems to students.

A potential function can be defined in EField in one of two ways. The most direct way is to call the setPotential method.

potStr="1/(x*x+y*y)";
document.efield.setPotential(potStr,xmin,xmax, ymin,ymax);

The potential string can be any analytic function of x and y. The horizontal range will be set to xmin and xmax, but the vertical range will vary depending on the embedded size since the applet enforces a 1:1 aspect ratio for the two axes. Potentials may also be defined by using the addObject method to add charge.

param="q=1";

Both of the above examples will produce the same potential. The first uses a parser to evaluate the string, while the second uses a predefined formula. Either method will then cause potential to be evaluated on a grid in the (x,y) plane. This grid is then used to generate the contour and field plots.

Notice the use of so-called dimensionless units for charge. The Coulomb constant has, in effect, been set equal to one. Because of the strength of the electrostatic interaction-two unit charges interacting with a one meter separation does, after all, produce quite a large force in MKS units-it is often desirable to scale problems so that results are of the order of unity. When authoring problems in MKS units, we often phrase the text as if distance were in mm and the charge in mC.

Also note that the field from a charge can be changed from a 1/r2 point charge dependence to a 1/r cylindrical charge dependence if the PointChargeMode embedding parameter is set to false or if the setPointChargeMode method is called. Cylindrical mode is, in fact, a very natural interpretation for a simulation since a circle on a two-dimensional computer screen naturally represents the cross section of an object that extend in the z direction. However, since most textbook problems are stated in terms of point charges and not cylinders, point charge mode is the default.

#### Figures:

 Fig 59:  Embedding EField