Application Center - Maplesoft

App Preview:

Visualizing the electric field of a dipole

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application



Visualizing Electric Dipole Fields

by Waterloo Maple, 2001

Let us assume there is an electric dipole with a unit positive charge at (0,0) and a unit negative charge at (.25, 0) . We plot the potential function , the equipotential lines and the electric field of the dipole. To conclude the demonstration, we show an animation of how the electric field evolves as the charges move closer together.

> restart: with(plots):

Warning, the name changecoords has been redefined

The potential function for this dipole is 1/sqrt(x^2+y^2)-1/sqrt((x-.25)^2+y^2) . However, visualization of the electric field is problematic because of the singularities at the two poles. To help visualization, we add a small constant epsilon to the denominators of both terms.

> epsilon := .01;

epsilon := .1e-1

Define the potential function

> pot := 1/sqrt(x^2+y^2+epsilon)-1/sqrt((x-.25)^2+y^2+epsilon);

pot := 1/(sqrt(x^2+y^2+.1e-1))-1/(sqrt((x-.25)^2+y^...

Graph the potential function

> plot3d( pot, x=-.1..(.35), y=-.25..(.25), shading=zhue, orientation=[50,70], axes=boxed);

[Maple Plot]

The equipotential lines, i.e. contours, of the potential function

> contourplot( pot, x=-.1..(.35), y=-.25..(.25), thickness=2, contours=15);

[Maple Plot]

The electric field of the dipole, which is just a plot of the gradients of the potential function at various points in the plane.

> gradplot( pot, x=-.1..(.35), y=-.25..(.25), thickness=2, grid=[15,15], color=pot );

[Maple Plot]

Finally, let's create an animation showing how the electric field changes as the negative charge approaches the positive charge, starting from the point (.5, 0)

> n := 40;

n := 40

> for i from 1 to n do
pot[i] := 1/sqrt(x^2+y^2+epsilon)-1/sqrt((x-.5*(1-i/(n+.1)) )^2 + y^2 + epsilon);
pic[i] := gradplot( pot[i], x=-.1..(.6), y=-.25..(.25), thickness=2, grid=[15,15],color=pot[i] );
end do:

display( seq(pic[i], i=1..n), insequence=true);

[Maple Plot]