algorithmic art workshop

Viitaniemen koulu, 16...17 March, 2017

by Risto A. Paju

Number of functions

Generally, you need more than one function to make a decent IFS graph.

However, too many functions in an IFS are harder to handle. I often use just 2 functions, but sometimes up to 4.

Stable functions


def lin(x, y):
    x, y = rotate(x, y, 45)
    return x/2, y/2
The key to stability here is "x/2, y/2" as it makes the picture smaller. Conversely, "2*x, 2*y" will blow up after a few iterations, as the size doubles every time. So it is generally better to keep the factors less than 1.

Note that rotation does not affect stability — it doesn't make the picture bigger or smaller.

Linear functions

The above example is called a linear function, because it works like the equation of a straight line: f(x) = a*x + b. These are easy to understand, but you can still make interesting art if you use a few different functions together. For example, see some of mine made with four linear functions each.

Nonlinear functions

Anything with powers or special functions is nonlinear. These can get very interesting, but they are more difficult when it comes to stability. One linear and one nonlinear function is often a good combination.

Sin and cos are generally OK in IFS, because their output is always between -1 and 1, so the picture does not blow up. For example:

def liss(x, y):
    return math.sin(2*x), math.cos(3*x)
(Named so because it is related to Lissajous curves — nice examples of math art themselves.)

Square roots are similarly OK. However, remember that they won't work for negative numbers. But you can use them along with the absolute value, for example

def sroot(x, y):
    return math.sqrt(abs(x)), math.sqrt(abs(y))

back to main page