I wanted to plot vector field of 12 positive charges Standing in a circular way with a positive charge at the center all same magnitude. I do not know how to start. Can you please help me Thanks.
2 Answers
$\begingroup$ $\endgroup$
7 Electric field lines for 12 negative (left) and 12 positive (right) charges located on a circle
p = Table[{Cos[x], Sin[x], 0}, {x, 0, 2 Pi - Pi/6, Pi/6}]; U[x_, y_, z_] := Sum[1/Sqrt[({x, y, z} - p[[i]]).({x, y, z} - p[[i]])], {i, Length[p]}] Efield = Grad[U[x, y, z], {x, y, z}]; StreamDensityPlot[{Efield[[1]], Efield[[2]]} /. z -> 0.1, {x, -1.5, 1.5}, {y, -1.5, 1.5}, ColorFunction -> "Rainbow", StreamStyle -> LightGray, StreamPoints -> Fine] StreamDensityPlot[{-Efield[[1]], -Efield[[2]]} /. z -> 0.05, {x, -1.5, 1.5}, {y, -1.5, 1.5}, ColorFunction -> Hue, StreamStyle -> LightGray, StreamPoints -> Fine] Electric field lines for 12 negative (left) and 12 positive (right) charges located on a circle + one in the center
p = Table[{Cos[x], Sin[x], 10^-3}, {x, 0, 2 Pi - Pi/6, Pi/6}]; U[x_, y_, z_] := Sum[1/Sqrt[({x, y, z} - p[[i]]).({x, y, z} - p[[i]])], {i, Length[p]}] + 1/Sqrt[{x, y, z}.{x, y, z}] Efield = Grad[U[x, y, z], {x, y, z}]; StreamDensityPlot[{Efield[[1]], Efield[[2]]} /. z -> 0.1, {x, -1.5, 1.5}, {y, -1.5, 1.5}, ColorFunction -> "Rainbow", StreamStyle -> LightGray, StreamPoints -> Fine] StreamDensityPlot[{-Efield[[1]], -Efield[[2]]} /. z -> 0.05, {x, -1.5, 1.5}, {y, -1.5, 1.5}, ColorFunction -> Hue, StreamStyle -> LightGray, StreamPoints -> Fine] - $\begingroup$ Many thanks🙏, how is it like when a same charge is placed at the center? $\endgroup$Elahe Lashgari– Elahe Lashgari2019-10-09 07:35:58 +00:00Commented Oct 9, 2019 at 7:35
- $\begingroup$ @ElaheLashgari Do you ask or answer? $\endgroup$Alex Trounev– Alex Trounev2019-10-09 11:38:19 +00:00Commented Oct 9, 2019 at 11:38
- $\begingroup$ I asked what if we put a charge with same magnitude and positive right at the center of each circle, how the field looks like then? So imagin we have 13 positive charges instead of 12 $\endgroup$Elahe Lashgari– Elahe Lashgari2019-10-09 12:53:24 +00:00Commented Oct 9, 2019 at 12:53
- $\begingroup$ @ElaheLashgari See update to my answer. $\endgroup$Alex Trounev– Alex Trounev2019-10-09 15:43:37 +00:00Commented Oct 9, 2019 at 15:43
- $\begingroup$ Thanks, just a question, what does this line mean? What is P[[i]] here?Sum[1/Sqrt[({x, y, z} - p[[i]]).({x, y, z} - p[[i]])], {i, Length[p]}] + 1/Sqrt[{x, y, z}.{x, y, z} $\endgroup$Elahe Lashgari– Elahe Lashgari2019-10-11 06:01:46 +00:00Commented Oct 11, 2019 at 6:01
$\begingroup$ $\endgroup$
2 This is beginning you can do the rest!
or = Graphics[{PointSize[Large], Point[{0, 0}]}]; g1 = ParametricPlot[{Cos[t], Sin[t]}, {t, 0, 2 Pi}]; pp = Table[{Cos[t], Sin[t]}, {t, 0, 2 Pi, Pi/6}]; g2 = ListPlot[pp, PlotStyle -> {Black, PointSize[Large]}]; Show[g1, g2, or] - $\begingroup$ Great,many Thanks it is a big help🙏 $\endgroup$Elahe Lashgari– Elahe Lashgari2019-10-07 05:41:42 +00:00Commented Oct 7, 2019 at 5:41
- $\begingroup$ This is exactly what I wanted to plot it’s electric field vector. Can you please help me with that. $\endgroup$Elahe Lashgari– Elahe Lashgari2019-10-08 03:17:28 +00:00Commented Oct 8, 2019 at 3:17



VectorPlotorVectorPlot3Ddepending on whether it's in the plane or in space. $\endgroup$