1

Be able to input (x,y) and Coulombs of point on plane and generate electric field plot. Also be able to add as many points as possible.

Thanks This is what I want, but not random points:

Electric Field Plot

SeedRandom[1234567];
q = RandomReal[{-1, 1}, 6];
r0 = RandomReal[{-3, 3}, {6, 2}]
q = q - Total[q]/6;
phi = Sum[
   q[[i]]/Sqrt[({x, y} - r0[[i]]).({x, y} - r0[[i]])], {i, 1, 6}];
f = -Grad[phi, {x, y}]

Show[StreamPlot[Evaluate[f], {x, -4, 4}, {y, -4, 4}, 
  StreamColorFunction -> "Rainbow", 
  StreamColorFunctionScaling -> False], 
 Graphics[Table[
   If[q[[i]] < 0, {Blue, PointSize[.1*Abs[q[[i]]]], 
     Point[r0[[i]]]}, {Red, PointSize[.1*Abs[q[[i]]]], 
     Point[r0[[i]]]}], {i, 1, 6}]]]
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
LightninBolt74
  • 207
  • 1
  • 4
  • 1
    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](http://tinyurl.com/4srwe26

    – Dunlop Feb 04 '20 at 05:35
  • 1
    Please be more precise in what you are asking. Can you show code of what you have tried? – Dunlop Feb 04 '20 at 05:35
  • 1
    https://mathematica.stackexchange.com/questions/197715/electric-field-plot How do I do what the person who answered did, but be able to add my own specific points? – LightninBolt74 Feb 04 '20 at 06:45
  • 1
    @TarangJanawalkar you just put the points how & where you want them. It’s quite simple if you understand how the code works—q dictates how much charge each point has and r0 creates their physical location. I would recommend you ask for clarification on the question in particular. Now, if you wanted to ask how to make a dynamic manipulate type of thing from this, I think that would make for a good question. Think something like clicking to add points then moving them around as you please? – CA Trevillian Feb 04 '20 at 07:02
  • 1
    @CATrevillian thanks for that, yes I know it's simple but I am learning the Wolfram Language, so I don't really know that much. Can I move them around easily? or will that take too much time? – LightninBolt74 Feb 04 '20 at 07:11
  • Update your question with what specifically you’d like to ask & then make an attempt at code. I will see about giving an answer akin to what I referenced if no one else has beaten me to it by tomorrow after work/classes. I recognize learning the language is a slope at first, but if you can take a look at how the random points are outputted & then change them to the coordinate positions you want, along with the charges you would like, I think it will be really helpful for learning the language. It would not be difficult to move them around easily & not take too much time. – CA Trevillian Feb 04 '20 at 07:16

0 Answers0