Your Assignment:
1) Execute the entire notebook.  Experiment if you like. 
2) Generate plots as described at the end of this Notebook.
3) Hand in the plots.

Suggestion: if you want to save this file on you disk, CUT the graphics first so it will fit. (Graphics take up over 1MB.)

**********************************
Initialization Stuff:
(Just execute this, don't read it!!!)

Packages

You may wish to turn off the spell checker before starting this chapter:

Clear["Global`*"];
Off[General::spell ]; 
Off[General::spell1];

Load package:

Needs["Graphics`PlotField`"]

3. Monopole

Monopole::usage="Monopole[q,{x0,y0,z0},{x,y,z}] 
computes the potential due to a monopole of charge q 
located at position {x0,y0,z0} in {x,y,z} coordinates.";

Monopole[q_:1,r0_:{0,0,0},r_:{x,y,z}]:= 
   q/Sqrt[ Sum[(r0[[i]]-r[[i]])^2,{i,1,Length[r0]}] ];

5. VEPlot

VEPlot::usage= 
"VEPlot[potential,xlim:{x,-2,2},ylim:{y,-2,2}] 
plots the electric field and equipotential surfaces 
xlim and ylim.";

VEPlot[potentialIN_,xlim_:{x,-2,2.1},ylim_:{y,-2,2.1}]:=
Module[{plot1,plot2},

  potential=potentialIN /.{z->0} //Evaluate;

  plot1=PlotGradientField[-potential 
            ,xlim,ylim
            ,Graphics`PlotField`ScaleFunction->(1&)
            ,DisplayFunction->Identity];
            
  plot2=ContourPlot[potential 
            ,xlim,ylim
            ,ContourShading->False
            ,ContourSmoothing->True
            ,DisplayFunction->Identity];
            
  Return[  Show[plot1,plot2
               ,DisplayFunction->$DisplayFunction]
         ]
];

Protect[{Monopole,VEPlot}];
Off[Clear::wrsym];

**********************************
Single Charge: Monopole

The Monopole[q,{x,y,z}] function places a single charge q 
  at position {x,y,z}.  An example would be:  Monopole[+1,{1,0,0}]
Let's look at the field due to a single charge located at the origin, {x,y,z}={0,0,0}. 

The function VEPlot automatically plots the electric field vector and the equipotential lines in the {x,y} plane. 
(This automatically plots the region from {-2,2}.)

Monopole[+1,{0,0,0}]

VEPlot[ Monopole[+1,{0,0,0}] ];

**********************************
Two Charges: Dipole

We can create a dipole from two Monopole functions:
(Notice that the signs are opposite)

dipole= Monopole[+1,{1,0,0}]+Monopole[-1,{-1,0,0}]

VEPlot[dipole];

**********************************
Your Assignment:

1) Modify the dipole solution above for the case where the two charges are the same sign. 

2) Make a configuration of charges of your own choice. Plot the fields. 

3) Hand in the plot of the fields for 1) and 2). 

(Hint: Use the PRINT SELECTION command from the FILE menu to print only the parts you want.)