- Sums of Velocities
- More Nodes. Again
- Different Dimensions
- New Beginnings
- More Random
The following is a tiny guide to shepherding random numbers. Originally I used this as a part of a presentation, but it seemed like it would work well as a little text as well. It does not really deal with statistics or probability, it is simply a collection of a few useful tricks I've learnt for manipulating random numbers. Usually I use the following techniques as a part of a larger work.
You can click or tap all animations to restart them.
We start with something very simple: a single node that moves between random positions.
It is always useful to see what it looks like when we introduce more things. Here are multiple independent nodes that move in the same way as before.
The nodes still move at random. However, now they move relative to their previous position, that is: they move slightly up or down from where they are. As opposed to previously when they would move at random to a completely new position. One could say that they have developed a simple kind of memory.
This also makes it look as if all the nodes are very nervous about something.
When we look at this it can sometimes seem as if there is a pattern emerging from the behaviour. However, if you feel like you can see such a pattern it is entirely coincidental, since the nodes are completely unaware of each other.
Whenever a node reaches the edge of the canvas, we stop it's motion. The node will remain at the edge until it should be inclined to start moving in the opposite direction.
We now introduce the idea of velocity. Instead of moving relative to their previous position, nodes will now move according to their current velocity.
To make things a little more interesting we manipulate the velocity in the same way that we did node position in the previous example. That means that the velocities gradually will change. Velocities can be either positive or negative, as you can see indicated by the lines in the animation.
In this example all nodes start with a velocity of zero.
Sums of Velocities
Until now all the nodes have been completely independent of each other. So here is one possible way to change that. Each node now has two associated velocities. One is the regular velocity. This behaves exactly like in the previous example. The second is the special velocity. The special velocity is re-calculated for each frame, and it is the sum of all the current regular velocities of the nodes on it's left hand side.
If this seems a little arbitrary to you, it is probably because it is. There is no obvious reason to do this, other than the fact that it behaves rather pleasing.
The lines in the animation below indicate the special velocity.
More Nodes. Again
It is time to introduce even more nodes. Adding more things can help you see thing differently. In this case it makes it a little easier to see the total behaviour of the system of nodes.
For me the goal is frequently to make a static result. That is, something that will make a good image. While these animations are nice and informative, a snapshot of one of them is not really that interesting. A way of getting different results is by drawing behaviour over time. Showing the history of a behaviour like we do below can also be a nice alternative way of understanding what is happening.
So far we have looked at behaviour along a single axis, or dimension. Lets apply the exact same behaviour as before in two dimensions.
Things will look quite different if we change the initial distribution of nodes. Below we see what happens if we wrap the nodes along the circumference of a circle.
It is always a good idea to experiment with adding more randomness. One example is to distribute the nodes at random along the circumference. The important thing to keep in mind in this case is that since the behaviour is exactly the same as before, there is still the same relation between the nodes' velocities. It is just their initial position that has changed.
You can probably think of a few other things to try randomizing as well.