Pages

Wednesday, 30 September 2009

Fractals And The Mandelbrot Set In Nature!

Recently I have been working a lot on fractal programming, here are a few examples (just click the images to view their respective articles):




Anyway, I just had a browse to see what kinds of examples I could find of fractals present in nature and some of the images I found were unbelievable! Just check out some of the images below (click for full size). I find the images of rivers and streams are the closest in appearance to the Mandelbrot set, although some other patterns are also found, like the spiral shape of the tornado.

Coastal Fractal


Cauliflower Fractal

River Fractals

Tornado Fractal

Cactus Fratal


I'll leave you with a thought - Is the mathematics intrinsic to nature and nature has arisen because of it, or is the way we see mathematics dependant what exists in the natural world?

More Emergence - The Mandelbrot Set


The image to the right is one amazing example of emergence. It is the fractal pattern known as the Mandelbrot Set, named after the mathematician BenoƮt Mandelbrot.

The rules that govern the Mandelbrot set are very simple - anyone with a basic understanding of complex number theory should be able to make it work. Understanding why, and how it works is a much harder question, and something that I won't go into. I'm just here to make some pretty pictures!

So how does the mandelbrot set work? Imagine the image to the right is made up of points, set co-ordinates. Each point is described by one number which tells us where it lies vertically, and another which tells us where it lies horizontally. Mandelbrot mapped the vertical location to imaginary space, and the horizontal location to real space - in other words he mapped the co-ordinates to complex space (for mathematicians out there - a pixel is pretty much equivalent to a point on an Argand diagram).

Complex space is made up of complex numbers of the form a + ib, where a and b are both real numbers.

We can calculate the square of a complex number using:

 (a + ib).(a + ib) = a*a - b*b + 2iab

The real component of the new number is now (a*a-b*b), and the imaginary component is 2ab.

The Mandelbrot set arrises when the number of iterations for the value of a*a+b*b is calculated to be greater than some threshold value for each pixel. The colour variation you see on the diagram depends on the number of iterations for the prior calculation for that particular starting number.


For lower iterations the detail in the image does not appear as much. Where as for higher iterations (the demo below is set to 500 iterations per pixel) the detail achieved will be far greater.

One issue arrises in the way that computers - in this case flash - handles numbers. Floating point numbers will not achieve the required accuracy when the amount of zoom on the graph is too high. Unfortunately this results in an infinite amount of zoom being impossible on this platform.


Just click on the image to the right to launch the mandelbrot set program. Enjoy it, and have a play around going down several routes. To the left of the main cardioid bulb is a region dubbed seahorse valley. It is one of my favourites!

For some more interesting articles on the Mandelbrot Set and some incredible zooms visit:

University of Utah

Mandelbrotset.net

Enjoy!

Tuesday, 29 September 2009

Population Growth Model

I got into making this kind of stuff a few years ago after reading a book called "Critical Mass - How One Thing Leads To Another" by Philip Ball (ex-editor of the Nature journal). The book discusses the application of Physics to some social phenomena, and takes you on a journey through some amazing social science discoveries that have been made. My favourite chapters concentrated on crowd dynamics, and population growth/movement.

I wrote a small program in flash which took some of the points mentioned in the book on population growth - which incidentally can be compared to bacterial growth and many of the shapes produced on a large scale are very similar! These similarities can be explained by a process called emergence, whereby complex patterns - for example the shape of a city - can arise from simple mathematical rules - for example people prefer to live near water. To the right is a nice image showing some outcomes of emergence.

Back to the flash side of it - I wrote some software which models two populations. The populations could be bacteria, they could be human, or animal - it doesn't really matter. On the screen any red pixels represent some kind of natural resources. The populations spread onto the red pixels whenever they can. If a population encounters another population they cross breed, creating hybrids of the two.

If you run the program you'll notice the button on the bottom left can be set to various modes - obstacle creates physical blockades which block populations from growing, and immigration allows new populations to randomly appear across the screen.

Of course there are lots of other factors that could be taken into account like populations dying, different populations, one population having genetic advantage and so on - but I've found the best way to build up a model is to start simple with only a few rules and then build up more rules until you have a fit that matches real world observations.

Just click below to run the app:



Enjoy!