Worksheet 7

PHY201, 2000
Donev Aleksandar

Electrostatic potential of a system of charges

This problem is quite interesting and can be solved in many ways, some efficient and well-structured, others quick and sloppy. I will follow the recommendations given in the assignment, which make this look similar to the corresponding Fortran 90 code.

First we choose positions for the 4 charges and their magnitudes, and enter them as matrices (nested lists in Mathematica):


The electrostatic potential at a given point with position R is simply the sum of the potentials from the four individual charges. Each of the individual forces is given with U(R)=[Graphics:Images/index_gr_2.gif]. I define the potential as a function of the position R where the potential is measured, using the standard Mathematica constructor:
Function[x_]:=Expression with x
Just to make sure there are no numerical singularities, we add a small number to the denominator:


Now we can plot this function by setting R={x,y}:




Notice that the potential becomes singular near the four charges, but is otherwise fairly smooth in-between. So it is probably better to plot the coutours of the potential surface:




And here is the electric field:




Converted by Mathematica      December 12, 2000