1
$\begingroup$

does anybody knows how can I plot one or two vectors? (I don't want to plot the vectorial field)? My target is to plot the electric field produced by a circle on a point and show how the point moves. To reach that target I thought to use "Manipulate" to move the point. I'm at base level, so please don't be too complicate :D. That's what i want to produce: My task:

$\endgroup$

2 Answers 2

6
$\begingroup$

In your case, you have some arrows that are all drawn in the same style. This allows you to put all of them into a single Arrow command. For several differently colored arrows you would then have groups of Arrow commands for each different style:

Manipulate[
 Graphics[{Black, Thick, Circle[{-x, 0}, r], PointSize[.03], 
   Point[{0, 0}],
   Red,
   Line[{{{-x, r}, {0, 0}}, {{-x, -r}, {0, 0}}}],
   Arrow[{{{0, 0}, e {x, r}/Norm[{x, r}]}, {{0, 0}, 
      e {x, -r}/Norm[{x, r}]}}],
   Darker[Green],
   Arrow[{e {{x, r}, {2 x, 0}}/Norm[{x, r}], 
     e {{x, -r}, {2 x, 0}}/Norm[{x, r}]}],
   Brown,
   Arrow[{{0, 0}, {2 e x/Norm[{x, r}], 0}}]
   }, PlotRange -> {{-3.5, 3.5}, {-1.5, 1.5}}],
 {{x, 1.5}, 1, 2}, {{r, .5}, .1, 2}, {{e, 1.6}, .3, 2}
 ]

manipulate

Here, the point is at the origin, and x is the distance to the center of the circle. The arrows are given a length e, and I assume you want the brown arrow to correspond to their sum (even though the sketch in the question didn't quite draw it that way - my way makes more sense to me).

$\endgroup$
0
0
$\begingroup$
Graphics[{Arrow[{{x1,y1},{x2,y2}}], Arrow[{{x3,y3},{x4,y4}}]]

For example:

Graphics[{{Red, Arrow[{{0, 0}, {1, 3}}]}, {Green, Arrow[{{2, 6}, {4, 3}}]}}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.