Showing posts with label function. Show all posts
Showing posts with label function. Show all posts

26.12.08

With a great lack of industriousness and an excess of curiosity I decided to implement a random walk algorithm.  

This algorithm, specifically called diffusion limited aggregation, places a "seed" somewhere on an N x N matrix, typically the center.  Next a "particle" is placed on a random edge of the matrix and allowed to "diffuse" about.  Once the particle is immediately adjacent to the seed it "sticks".  This process is repeated for as many particles as you like where a particle only sticks if it is next to another particle that is already stuck.  To the left is the result.  For more info go here.

Recursion

Playing around with recursion.  For a definition see here.
This is an example of an iterated function.  With an iterated function you run the function a certain number of times and use the output of one iteration as the input for the next.  Simple but beautiful.