Vector Field Images

September 24, 2023

Vector fields are found in many apsects of physics, but they also form the basis of some great math art. One well-known vector field are the magnetic field lines formed around a magnet. Many of us did this experiment in school, where iron filings on a piece of paper are moved around by a magnet underneath, as shown in this image¹.

Magnetic field

This is a physical vector field, which can be described using a mathematical transformation, a simple equation that takes an (x, y) coordinate and returns a modified (x, y) coordinate.

Start with a very basic vector transformation:

x ↦ x + 0.5

y ↦ y + 0.5

Each point just moves up and to the right by 0.5 units.

(In this notation, ↦ is the "maps to" operator. The current x and y values map to new x and y values.)

Simple vector field

To make math art, we need something more interesting. Sine and cosine functions usually work well, and give chaotic (interesting) results. Here is an example:

x ↦ x - 0.4 sin(y + sin(0.4y))

y ↦ y - 0.4 sin(x + sin(-2x))

Complex vector field

Now that we have a nice vector field, let's see what happens to a single point that moves through the field. Here are 25 iterations of the starting point (0, 2).

Single point traversing vector field

This can generate some fun curves, but sometimes we want more than a single curve for math art purposes. Let's try plotting several curves over a range initial starting points. Here, we plot 10 points evenly spaced around the circle (x-2)² + (y-1)² = 2².

Ten points traversing field

It's interesting, but 10 points isn't enough. Try plotting 10,000 or more points evenly spaced around the circle. Make each line slightly transparent so the different paths blend together a bit, and fade the color from one color at the start of the line to another color the end. Now we've got something fun!

Easley01 Image

Click here to see more vector field images

Animation

If you're in to animations, a final step is to change some parameter of the image for each frame of the animation. Here, the vector field stays constant, while the initial circle moves left to right.

Vector Field Animation
  1. Newton Henry Black, Harvey N. Davis (1913) Practical Physics.
Back