Let's consider the following system;

$$x_{n+1} = \sin(a \times y_n) + \cos(b \times x_n) - \cos(c \times z_n)$$ $$y_{n+1} = \sin(d \times x_n) + \cos(e \times y_n) - \cos(f \times z_n)$$ $$z_{n+1} = z_n + 0.1 $$

In this system, $a,b,c,d,e,f$ are constants and the sequences $x_n,y_n,z_n$ can run forever. Let's have $z_0 = x_0 = y_0 = 0$.

Given this setup, can we imagine what the plot of $(x,y)$ will look like?


To demonstrate this I've written a small app with canvas that does exactly this. You can draw the values of $a,b,c,d,e,f$ manually or press the randomize button to select random values. Once you use one of the sliders the pattern will be drawn in bulk. If you're interested in a more visual effect, you can also press the stream points button.




Usually a lot of these generated images contain a lot of noise but after a few random tries one might be suprised of how beautiful some of the results can be. You might be tempted to think that randomness plays a part here. Don't be fooled though, you are merely looking at sines, consines and recursion.

To show diverse this sytem can be, I've kept track of some of my favorite outcomes.

Symmetry, more or less

You may notice that each image has a form of symmetry. That is because of the relationship between $x_n, y_n$, they influence eachother and the effect of $z_n$ is constant in comparison. Notice that $z_n$ is not influenced by $x_n,y_n$. If I were to change that, then the images show very different behavior. You will still be able to recognize repitition but the symmetry tends to leave if $z_n$ is dependant on $x_n$ and $y_n$.

$$z_{n+1} = x_n y_n$$
$$z_{n+1} = \arctan(x_n + y_n)$$
$$z_{n+1} = \frac{x_n^2}{x_n + y_n}$$
$$z_{n+1} = (x_{n+1} - x_n)^2 + (y_{n+1} - y_n)^2 $$

It is worthwhile to note that before I had the issue of 'too much noise' when generating images I have the issue of 'too much convergence' when sampling sequences where $z_n$ is dependant.


These wondrous graphics are a result of dynamical systems. If $z_n$ simply increasing the recursive sines and cosines create a repetitive, yet counterintuitive, pattern which makes for pretty plotting. If this is not the case then the sequences still seem to follow an attractor pattern. Other systems that have more exponential aspects or more stocahstics in them might not have the same effect.

The "art" of finding appropriate values for $a,b,c,d,e,f$ comes down to wanting enough variation such that there are a lot of states but not so much that the results appear to be somewhat uniformly random.

I'll look into making a VR demo or something 3d/WebGL/Unity of this to occur some time in the future. It seems like a fun experience to input a formula and tweak the parameters of such a system in real time in 3d.