Algosim documentation: VectorField


Creates a planar vector field plot.



The VectorField function creates a plot of the vector field f in the rectangular region [xmin, xmax] × [ymin, ymax] with a sampling distance of δx in the first dimension and δy in the second dimension. The sampling distance is the distance between arrows. If omitted, a reasonable default value is used (typically producing a plot with about 20 arrows along each direction).

The plot is shown in the current diagram and a reference to the plot is returned.


D ≔ diagram("vector field");
sf ≔ heatmap((x, y) ↦ x^2 + y^2, ❨−10, 10❩, ❨−10, 10❩, '("white", "red"));
vf ≔ VectorField((x, y) ↦ ❨2⋅x, 2⋅y❩, ❨−10, 10❩, ❨−10, 10❩)

Image 1

See also