The Force on a Dipole p positioned between to point charges

Problem:  A dipole p is oriented along the x axis ((OverVector[p]) = - p (OverHat[x]);  p >0) between two point charges -q1 and + q2 (where q1>0 and q2 >0 are the magnitude of the charges:  |q1| and |q2|) each a distance s from the dipole as shown here:
						

Find the force on (OverVector[p])

(a) In an input cell write down an equation for the amplitude of the E field vs. x along the x axis (treat as a 1D problem) for points on the axis near x = 0.

(For the geometry shown, we agree that the field due to the two point charges along the x axis is given by:  (OverVector[E])[x] = E[x] (OverHat[x]); i.e., depends only on x and points in either the + or - x direction.  E[x] is the amplitude of the vector  (OverVector[E])[x].

We put the dipole at the origin as in the drawing above.  We use Coulomb’s Law for the E field due to the two point charges -q1 and q2 (the magnitudes q1 and q2 are +;  therefore, the left hand charge is always negative and the right hand charge is always positive).

ClearAll["`*"]
EE[x_] := ((- k q1)/(((s + x))^2)) - ((k q2)/(((s-x))^2))   (*  using Coulomb's Law;  k = (1/(4πϵo)); note carefully the SIGNS of each term  *)
EE[x]

(b) What direction does the E field point at the position of the dipole?

(Enter answer in this text cell)

For the charges shown and their given signs (the charge on the left is negative; the charge on the right is positive), both E1 and E2 (the fields from the two charges) at the dipole (0,0) point in the -x direction.

Therefore the total field at the origin,  Etotal = EE[x= 0] = E1 + E2,  is in the - x direction.

(c)  Given the geometry of this problem write down the Force on the dipole due to these point charges.

(Enter answer in this text cell)

We will use the equation we derived for the force on a dipole in a E Field (derived by considering the potential U of a dipole in an E-Field). 

	    F = - ∇(p · E) = - ∇(- p (OverHat[x]) · (-EE(x)  (OverHat[x])) = -p  (∂_x) EE[x]     [SIGNS CRITICAL]

		 FYI:   (∂_x)  =   (∂/∂x ) = (d/dx)
 
NOTE:  we take the derivative first THEN let x-> 0

(d) Use M to find an equation for F

(*  input cell  *)
F = -  p (∂_x) EE[x];   (* fyi:  for the derivative could also use EE'[x] or D[EE[x],x] *)
F = F/.x-> 0    (* this evaluates the force on the dipole located at x = 0 *)

Therefore:   (OverVector[F]) =  -p (((2 k q1)/(s^3))-((2 k q2)/(s^3)))  (OverHat[x])

(e) Comment on the direction of the force  (OverVector[F]) on (OverVector[p]).

remember q1 and q2 are the magnitudes of the charges:  

If q1 > q2, (OverVector[F]) is in the -x direction;  If q1 < q2, (OverVector[F]) is in the +x direction.

(f) Examine the slopes of EE[x] (by plotting EE[x] vs. x) near x = 0 For q1 > q2;  I take q1 = 2; and q2 = 1 for an example where q1 > q2.

Note that the Sign of the slope =  the Sign of (Subscript[Grad, x])(EE[x]  = Sign of (∂_x) EE[x]

k = 1; s = 1; q1 = 2; q2 = 1;
(∂_x) EE[x]/.x->0
 Plot[ EE[x],{x,-s/2,s/2},AxesLabel->{x,"EE[x]"},PlotLabel->"EE[x] vs. x"]

From the Plot we see that the Slope at x = 0 is +; Likewise, (∂_x) EE[x]/.x->0 = +2 which is positive,

(g) Deduce the direction of (OverVector[F]) on (OverVector[p]) from the slope of EE[x] at x = 0.

with - sign in the expression for the force (- p(∂_x) EE[x] ), F is in -x direction for q1 > q2

(h)  Repeat  (f) and (g) for   q1 = 1; q2 = 2;   i.e., for q1< q2

q1 = 1; q2 = 2;
(∂_x) EE[x]/.x->0
 Plot[ EE[x],{x,-s/2,s/2},AxesLabel->{x,"EE[x]"},PlotLabel->"EE[x] vs. x"]

From the Plot we see that the Slope at x = 0 is -; Likewise, (∂_x) EE[x]/.x->0 = -2 which is negative.

For q1< q2 slope reverses, Force reverses direction:   F is in the +x direction.

(i)  Using Manipulate, show the changes in slope (~Grad[EE[x] =  (∂_x)EE[x]) and resulting force on the dipole (~ - Grad[EE[x] = - (∂_x)EE[x]) due to various q1 and q2

I.e., Display {A Plot of EE[x], and the Resulting Force [should be a number]} while manipulating q1 and q2.

Clear[q1, q2]
 k=1; s =1;
Text[Style["Plot of EE[x] and the Resulting Force (note SIGN).  You can Manipulate q1 and q2.",18,Red,Bold]]
Text[Style["Remember, the dipole is located at x = 0:",18,Blue,Bold]]
Manipulate[{Plot[ ((- k q1)/(((s + x))^2)) - ((k q2)/(((s-x))^2)),{x,-0.2, 0.2},AxesLabel->{x,"EE[x]"},PlotLabel->"EE[x] vs. x"],-p (((2 k q1)/(s^3))-((2 k q2)/(s^3)))},{{q1,0},0,2,.1,Appearance-> "Open"},{{q2,0},0,2,.1,Appearance-> "Open"}]

Summary:  

The SIGN of the Slope of EE[x] at x = 0 determines direction of force.  (remember the - sign:  F = - Grad[p.E])

i.e., if q1 > q2, (∂_x) EE[x] is positive, F is in the -x direction;  If q1 < q2, (∂_x) EE[x]  is negative, F is in the +x direction.  Note the shape of the curve when for a given q1 you sweep q2 past q2 = q1; i.e., note the SLOPE of the curve at the position of the dipole (x = 0), as you do so.

The magnitude of the force ~ (1/(s^3))