3 magnets + 40,000 pendula + 2 hits of acid = wow

Movie here. Psychedelic!

visualising the motion of 40,000 pendula under the influence of 3 magnets using Haskell. Shiny.

What’s going on here? OK, so it’s not 40,000 pendulums “all going at once”, because obviously they’d bounce off each other. ;-) What we have is a 200×200 grid (ie 40,000 pixels), and for each pixel we define a pendulum. At a given time, a given pixel’s colour represents the corresponding pendulum’s distance, at that time, from each of the 3 magnets (the pixel’s RBG components represent the three distances). Each pendulum’s movement is affected only by the magnets, ie the pendula are independent of each other. Hey presto, psychadelica-a-go-go.