Electric Potential Mapping

Enter each charge as a list:  {charge, xposition, yposition}

v[x_, y_, charges_] := Sum[charges[[i, 1]] / Sqrt[(((x - charges[[i,2]]))^2) + (((y - charges[[i, 3]]))^2)], {i, 1, Length[charges]}]

Single Positive Point Charge

pcharge = {{1, 0, 0}};

Plot3D[v[x,y, pcharge], {x, -1, 1}, {y, -1, 1}, PlotRange->{-30,30}, ImageSize->Scaled[0.8] ,Mesh->True]

ContourPlot[v[x,y, pcharge], {x, -1, 1}, {y, -1, 1}, Contours -> Table[v, {v, 0, 4, 0.2}], ImageSize->Scaled[0.8]]

Epcharge[x_, y_] = -Grad[v[x, y,pcharge], {x, y}]

VectorPlot[Epcharge[x, y], {x, -1, 1}, {y, -1, 1}, AspectRatio->1, PlotLegends->Automatic, Frame -> True, FrameLabel->{"x (m)", "y (m)"}, LabelStyle->Larger, ImageSize -> Scaled[0.8]]

Single Negative Point Charge

ncharge = {{-1, 0, 0}};

Plot3D[v[x,y, ncharge], {x, -1, 1}, {y, -1, 1}, PlotRange->{-30,30}, ImageSize->Scaled[0.8] ,Mesh->True]

Encharge[x_, y_] = -Grad[v[x, y,ncharge], {x, y}]

VectorPlot[Encharge[x, y], {x, -1, 1}, {y, -1, 1}, AspectRatio->1, PlotLegends->Automatic, Frame -> True, FrameLabel->{"x (m)", "y (m)"}, LabelStyle->Larger, ImageSize -> Scaled[0.8]]

Dipole

dipole = {{1, -0.25, 0}, {-1, 0.25, 0}};

Plot3D[v[x,y, dipole], {x, -1, 1}, {y, -1, 1}, PlotRange->{-30,30}, ImageSize->Scaled[0.8] ,Mesh->True]

ContourPlot[v[x,y, dipole], {x, -1, 1}, {y, -1, 1}, Contours -> Table[v, {v, -4, 4, 0.25}], ImageSize->Scaled[0.8]]

Edipole[x_, y_] = -Grad[v[x, y, dipole], {x, y}]

VectorPlot[Edipole[x, y], {x, -1, 1}, {y, -1, 1}, AspectRatio->1, PlotLegends->Automatic, Frame -> True, FrameLabel->{"x (m)", "y (m)"}, LabelStyle->Larger, ImageSize -> Scaled[0.8]]

Oppositely charged plates

L = 5.0;
pcharges = Table[{1, -1, y}, {y, -L, L, 0.2}];
ncharges = Table[{-1, 1, y}, {y, -L, L, 0.2}];
charges = Join[ncharges, pcharges];

Plot3D[v[x,y, charges], {x, -1, 1}, {y, -(L+2), (L+2)}, PlotRange->{-20,20}, ImageSize->Scaled[0.8] ,Mesh->True]

Eplates[x_, y_] = -Grad[v[x, y, charges], {x, y}];

VectorPlot[Eplates[x, y], {x, -1, 1}, {y, -(L+2), (L+2)}, AspectRatio->1, PlotLegends->Automatic, Frame -> True, FrameLabel->{"x (m)", "y (m)"}, LabelStyle->Larger, ImageSize -> Scaled[0.8]]

ContourPlot[v[x,y, charges], {x, -1, 1}, {y, -(L+2), L+2}, Contours -> Table[n, {n, -20, 20, 2}], ImageSize->7*72]