Electric Fields for Three Point Charges

Manipulate[Show[Quiet@StreamPlot[{EX[x,y,Q1[[1]],Q1[[2]],q1]+EX[x,y,Q2[[1]],Q2[[2]],q2]+EX[x,y,Q3[[1]],Q3[[2]],q3],EY[x,y,Q1[[1]],Q1[[2]],q1]+EY[x,y,Q2[[1]],Q2[[2]],q2]+EY[x,y,Q3[[1]],Q3[[2]],q3]},{x,-20,20},{y,-15,15},AspectRatio->.75],Graphics[{RGBColor[{Boole[q1<0],0,0}],Opacity[Sign[Abs[q1]]],Thick,Circle[{Q1[[1]],Q1[[2]]},1.25],Text[Style[N[q1],10,Bold],{Q1[[1]],Q1[[2]]}],RGBColor[{Boole[q2<0],0,0}],Opacity[Sign[Abs[q2]]],Thick,Circle[{Q2[[1]],Q2[[2]]},1.25],Text[Style[N[q2],10,Bold],{Q2[[1]],Q2[[2]]}],RGBColor[{Boole[q3<0],0,0}],Opacity[Sign[Abs[q3]]],Thick,Circle[{Q3[[1]],Q3[[2]]},1.25],Text[Style[N[q3],10,Bold],{Q3[[1]],Q3[[2]]}]
}],ImageSize->{575,375}],
{{q1,-1,"(Subscript[q, 1])"},-2,2,.1,Appearance->"Labeled"},
{{q2,2,"(Subscript[q, 2])"},-2,2,.1,Appearance->"Labeled"},
{{q3,-1,"(Subscript[q, 3])"},-2,2,.1,Appearance->"Labeled"},{{Q1,{-10,0}},{-20,-15},{20,15},Locator,Appearance->None},{{Q2,{0,0}},{-20,-15},{20,15},Locator,Appearance->None},{{Q3,{10,0}},{-20,-15},{20,15},Locator,Appearance->None},ContinuousAction->False,TrackedSymbols:>True,Initialization:>(EX[x_,y_,xq_,yq_,qn_]:=(((x-xq) qn)/((((((x-xq))^2)+(((y-yq))^2)))^(3/2)));EY[x_,y_,xq_,yq_,qn_]:=(((y-yq) qn)/((((((x-xq))^2)+(((y-yq))^2)))^(3/2))))]

THIS NOTEBOOK IS THE SOURCE CODE FROM

"Electric Fields for Three Point Charges" from The Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/ElectricFieldsForThreePointCharges/

Contributed by: S. M. Blinder

A full-function Wolfram Mathematica system (Version 6 or higher) is required to edit this notebook.
GET WOLFRAM MATHEMATICA »

© The Wolfram Demonstrations Project & Contributors   |   Terms of Use   |   Make a new version of this Demonstration »