Vector field of charges

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.

• Look up VectorPlot or VectorPlot3D depending on whether it's in the plane or in space. Oct 3, 2019 at 14:40
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Oct 3, 2019 at 17:40
• can you upload sketch hand draw of what you mean!? Oct 3, 2019 at 18:04

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]


• Many thanks🙏, how is it like when a same charge is placed at the center? Oct 9, 2019 at 7:35
• @ElaheLashgari Do you ask or answer? Oct 9, 2019 at 11:38
• 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 Oct 9, 2019 at 12:53
• @ElaheLashgari See update to my answer. Oct 9, 2019 at 15:43
• 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} Oct 11, 2019 at 6:01

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]


• Great,many Thanks it is a big help🙏 Oct 7, 2019 at 5:41
• This is exactly what I wanted to plot it’s electric field vector. Can you please help me with that. Oct 8, 2019 at 3:17