2. General Physics

Legal Notice, Disclaimer, and Book Ordering Information:

Null

Setup

\($DefaultFont = {"Courier", 12}; 
Off[General::spell]; 

    Off[General::spell1]; 
PageWidth -> 70; \)

Needs["Calculus`VectorAnalysis`"]

Needs["Graphics`PlotField`"]

Needs["Graphics`PlotField3D`"]

Clear["Global'*"];

<< "D:\Mma\Inits\ch2init.m"

2.4 Problems

2.4.3  Electricity and Magnetism

Problem 3:  The Electric Dipole

Part (a)  Find the potential and plot the equipotential lines in the y=0 plane.  Make a 3-D plot of the electric field.

\(dipole = 
      monopole[\(+q\), {0, 0, \(+d\)/2}]
				\ \ \ \ \  + 
          monopole[\(-q\), {0, 0, \(-d\)/2}] // Simplify\)

values = {q -> 1, d -> 1}

\(\(ContourPlot[
      Evaluate[\(dipole /. values\) /. y -> 0]
, {x, \(-2\), 2}, {z, \(-2\), 
        2}
, PlotPoints -> 45
	, Contours -> 11
	, ColorFunction -> Hue

      	, Axes -> True
	, AxesLabel -> {"X-axis", "Z-axis"}]; 
    \)\)

\(\(PlotGradientField3D[
      Evaluate[\(-dipole\) /. values]
, {x, \(-1\)/2, 1/2}, {y, \(-1\)/2, 
        1/2}, {z, \(-1\), 1}
\ \ , PlotPoints -> 6
	, 
      ColorFunction -> Hue
\ \ , VectorHeads -> True
	, 
      Graphics`Common`GraphicsCommon`ScaleFunction -> \((1&)\)]; \)\)

Part (b) Express the potential in spherical coordinates and expand in d/r, keeping only the leading-order term.  Calculate the electric field.

sphere = CoordinatesToCartesian[{r, θ, ϕ}, Spherical]

x2rRule = Thread[{x, y, z} -> sphere]

potential = dipole /. x2rRule

potential = potential // Simplify

dipoler = Series[potential, {r, Infinity, 2}] // Normal

electricField = -Grad[dipoler, Spherical[r, θ, ϕ]]

Part (c) Animate the electric field of a rotating dipole.

\(rotdipole = 
      monopole[\(+1\), 1/2 {\(+Sin[θ]\), 0, \(+Cos[θ]\)}]

        \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  + 
        monopole[\(-1\), 1/2 {\(-Sin[θ]\), 0, \(-Cos[θ]\)}]\)

\(frames = 8; 

    Do[PlotGradientField[Evaluate[\(-rotdipole\) /. {y -> 0}]

        	, {x, \(-2\), 2}, {z, \(-2\), 2}
\ \ , PlotPoints -> 14
	, 
        ColorFunction -> Hue
\ \ \ , VectorHeads -> True
	, 
        Graphics`Common`GraphicsCommon`ScaleFunction -> \((1&)\)]

      	, {θ, 2  π/frames, 2  π, 2  π/frames}]; \)