The applet above implements what is known as the Vicsek model.1 Each speck indicates the position and direction of a bird in the model. This applet follows a total of 1000 individuals. The birds move with a fixed speed, and their position and the direction of their velocity updates at discrete steps in time. The flock exists in a two-dimensional rectangle with periodic boundary conditions: when a bird exits the right side of the red rectangle it reenters through the left side, and so on.
At each time step, a bird matches its velocity to the direction of the average velocity of the nearby birds. The nearby birds are simply defined as all those birds within a fixed interaction length. In this applet, the space is 40 interaction lengths long in both directions, and a bird moves half an interaction length at each time step. Note that in this model, there is no interaction which causes the birds to attract or keep a safe distance.
The velocity matching rule is not exact. At each step a birds velocity is modified by a random noise - the strength of which can be adjusted with the slider. For high noise, each bird moves in a random walk and there is no large scale motion. For low noise, the birds form flocks which move in a well defined direction.
The extent to which the motion is ordered can be quantified by considering the magnitude of the average velocity of all birds (shown in the "Order" field). If all birds are moving in the same direction, the velocities add up coherently, and the (rescaled) order parameter is 1. If the velocities are randomly oriented, they will tend to have no net direction, and the order parameter is near 0.
The increase in order as the noise is decreased indicates a phase transition which is closely analagous to phase transitions in unrelated physical systems such as magnets