Archive for the ‘Mathematical’ Category

Old flame (attraction from the past)

Tuesday, October 6th, 2009

Attraction

I was digging around on the Wayback Machine today, and stumbled across a lost piece of code from December 2004. It’s a Strange Attractor Generator, from the pages of Clifford Pickover’s book Computers, Pattern, Chaos and Beauty (p 165).

As the equation wanders through its orbit, each pixel hit is darkened by a shade. This reveals the features in a way that would have been hidden by a simple drawing of the graph. The only addition I made (beyond introducing the code to Processing) was to enact this process over time, which makes for a lovely sense of a landscape etching its way into existence.

Click on the applet area to generate new, very different orbits. Pickover describes this well:

A “strange attractor” has an irregular unpredictable behaviour. Its behaviour can still be graphed, but the graph is much more complicated. With “tame” attractors, initially adjacent points stay together as they approach the attractor. With strange attractors, initially adjacent points eventually follow widely divergent trajectories. Like leaves in a turbulent stream, it is impossible to predict where the leaves will end up given their initial positions.”

The Wayback Machine is great for HTML docs, but many Java applets and Flash movies have disappeared, vanishing in the uniquely permanent way electronic media can. Processing, however, encourages the source code to be made available and distributed in the act of publishing. This meant the code could be copied and pasted, and run as if it were new.

Joining the queue

Monday, October 5th, 2009

Queue 1

Queues are comprised of customers joining, waiting and then being served. There are two random processes here: arrivals, and serving time, which in this case are both Poisson processes. There can be one or more servers. A handy notation for this is: M/M/n, where the first M describes customer arrival, the second M server processing time, and the n the number of servers.

In this applet, there are 150 queues, each one M/M/5, with a customer arrival rate \lambda of 20 per second, and a server rate \epsilon of 3 per second.

As each customer gets served, their dot turns red, and all the customers shuffle up one. When serving is finished, the dot disappears. As the server has become free, the next customer is served.

This first attempt demonstrates the variation that can occur. Currently, the queues move to the right if serving outpaces arrival. The next step is to have them wait at a particular point, and then moving off when a server is free, with those behind moving up to fill the space.

More queue models to follow, though not sure what their arrival rate will be…

A long line of Parisian revolutions and mathematicians

Sunday, June 14th, 2009

sho_p_timeline

Timeline of mathematicians and the history of Paris

Simulating the Poisson process

Saturday, May 30th, 2009

Simulating poisson

A simulation of the Poisson process, built using Processing.

TheĀ  process models random events occuring in continuous time given that:

  1. Events occur on their own
  2. The average rate of events happening remains constant
  3. Future events have nothing to do with ones which have happened

A process has average rate such as \lambda = \frac{1}{4} per minute. Number of events in t minutes is the discrete random variable X, where X \sim Poisson(\lambda t). The time you have to wait between events follows an exponential distribution T \sim M(lambda).

The simulation works by obtaining a waiting time between each event, through making independent observations on the random variable T \sim M(\lambda). We can do this by solving:

F(t) = u

where u is a random observation on the uniform distribution U(0,1). With the exponention distribution this means solving

1-e^{-\lambda t}=u

which ends up with

t=-\frac{1}{\lambda} log(1-u)

Each time an event is fired, t is recalculated.