Musings of a Recovering Lutheran: Stumbling through mathematics: The chaos game (Part 1)
I heard the voice of the Lord, saying, 

Whom shall I send, and who will go for us?

Then said I, Here am I; send me.

Isaiah 6:8 (KJV)

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:

Joy said...

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:)

Recovering Lutheran said...

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