Thursday, May 30, 2013

Stumbling through mathematics: The chaos game (Part 1)

The Chaos Game is as follows: plot a point inside a regular n-gon (a polygon with n number of sides). Then plot a second point by calculating the distance between the original point and a vertex picked at random, and plotting the second point some fixed percentage of that distance towards the vertex. Repeat this process for as many points as you wish.

I wrote a Matlab program using the corners of an equilateral triangle as the vertices and letting the percentage be 50% (or 1/2). For 100 points the result was following plot:

For 1000 points:

For 10,000 points:

For 100,000 points:

Surprisingly the result is not a set of random points. The plot is the SierpiƄski Sieve, which is a fractal. The results from the Chaos Game is sometimes (but not always) a fractal.

2 comments:

  1. I must say my weakest side is math. This is too complicared for me:)
    Thanks for dtopping by in my blog: joysupsanddowns.blogspot.com.
    I share also how God works in my life in one of my blogs: willyouhearfromme.blogspot.com. hope you come again and visit me there:)

    ReplyDelete
  2. Thank you for visiting my blog! May God bless you and your family!

    ReplyDelete