Random Art

Suppose we take an expression in x and y, built by nesting simple primitives: product, average, sin(pi*_), and cos(pi*_). These four operations map arguments in the range -1 to 1 to results in this same range. Thus, at any point with -1 <= x,y <= 1, our expression built from these primitives will return a value between -1 and 1. By scaling the answer to a grayscale value 0-255, we can plot the function in this 2-by-2 square. (From three such expressions, we can get red, green, and blue values for each point.)

7 thoughts on “Random Art”

I think most of the patterns in the samples are aliasing ‘artifacts’ of the high frequency components of the functions, in other words, Moiré patterns.

Essentially, any pixel plot of a continuous function is a discrete sampling, and frequency components of 2 x sampling frequency are folded into the < 2 x sampling frequency area.

I remember doing these in the mid 80’s on my first computer in BASIC. Of course, the idea didn’t originate with me; I got it from some computer magazine. I wonder how many times it has been rediscovered since then.

Some beautiful pics! Reminds me of the demo scene – very transcendental :]

In the image gallery it would be nice to have a link to the expression for that pic.

This almost demands a dedicated website and a javascript implementation to create these patterns in the browser then upload them and vote up the best ones. I can see it getting kids interested in math.

[ The math expressions/formulae tend to be long, but look like they have several recurring motifs – so maybe some kind of factoring into reusable components? lisp is great for building these up obviously (probably one can write some heuristics to reduce the existing ones, too). Perhaps working in higher level motifs might give intuition.. so the scheme scripts would give you a palette from which to compose interacting patterns. Just a random thought ]

I wrote it in CL, and generated a nice wall paper in some 10 or 20 minutes. That’s very expensive calculations we have here, and memoizing doesn’t help because of the precision. Also most pictures I build are smooth. No abrupt gradient…
Finally, I save pictures in pgm, and embedd the formula as a comment in it. Nice (but not space friendly).