After solving for field strength and potential, the background can be turned into a contour
based color map by assigning colors to set values of the field strength, and
interpolating
for in between values.
Point charges are scattered using a
random number generator
to pick x-y pairs. For each x-y
pair picked, the field strength is determined and used to create a probability that an iron
filing would "stick" to that point. A third
random number
is created to see if the
filing sticks. If the filing does not stick, then a new x-y pair is generated.