Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathematica How do I plot a vector field with 1 variable?

I cannot figure out how to plot a vector field with only 1 variable. Maybe Mathematica doesn't support this. For example:

 r(t) = cost j + sint i

same as

 <cost, sint>

This doesn't work:

VectorPlot[{cos t, sin t}, {t, 0, 2 Pi}] 

As a bonus how to take the derivative of a vector?

like image 457
user968102 Avatar asked Dec 01 '25 08:12

user968102


1 Answers

An easy workaround would be to use a 2D-VectorPlot with a dummy variable like this:

VectorPlot[
  {Cos[t], Sin[t]}, {t, 0, 2 \[Pi]}, {s, -1/2, 1/2},
  AspectRatio -> Automatic,
  VectorPoints -> {15, 3}, 
  FrameLabel -> {"t", None}
]

VectorPlot with dummy variable

Or what probably makes more sense is to discretize the curve that you get when you follow the vector while increasing t. This is e.g. useful for Feynman-style Action-integrals in quantum mechanics.

Module[
  {t, dt = 0.1, vectors, startpoints, startpoint, vector, spv, spvs},
  vectors = Table[dt {Cos[t], Sin[t]}, {t, 0, 2 \[Pi], dt}];
  startpoints = Accumulate[vectors];
  spvs = Transpose[{startpoints, vectors}];
  Graphics[Table[Arrow[{spv[[1]], spv[[1]] + spv[[2]]}], {spv, spvs}]]
]

Feynman 1D-vectorplot

like image 80
Thies Heidecke Avatar answered Dec 04 '25 01:12

Thies Heidecke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!