Friday, January 09, 2009

Apophysis, Sierpinski's Triangles, and The Chaos Game In Excel

I continue to study fractals as it relates to Apophysis.
What follows are my summary notes of the whole process I went thru recently, so I can remember what I did and what I learned.

I worked through the Apophysis tutorials here.
UPDATE 22 Apr 11:
Dead links. Tutorials can be found here.

I liked how the 2nd tutorial related MCRM and Sierpinski's Triangle (Gasket) to Apophysis. (Those right triangles in the Transform Editor within Apophysis.)

Sierpinski's Gasket is an example of an iterated function system (IFS), and of a Multiple Copy Reduction Machine (MCRM).
The tut says Apophysis's Transform Editor shows the first two iterations of an MCRM.
So the 1st iteration is the base triangle (dotted line stationary triangle in Apophysis transform editor.)



For the 2nd iteration, start with a new blank flame, create 3 triangles/transforms (linear variations), scale down by 200, and arrange them inside the base triangle (dotted line stationary triangle) so it looks like the 2nd iteration of a Sierpinski's triangle.



Wiki has a transparent png and an svg image of the Sierpinksi Interations on an equilateral triangle. There is also an animated gif showing the progression of the iterations.

It's important to see the transparency, because otherwise, it is not readily apparent that these iterations have holes in them.
Instead of posting a transparent png here, I'll post a screenshot of the image done within Paint Shop Pro. I think it illustrates the transparency better than having my blog background show through.



The Apophysis fractal result is what those triangles look like after many iterations.
Below is a low resolution screenshot result.



The tutorial on weights and noise says Apophysis uses the chaos game to generate fractals. (This helped me understand the noise problems a little better.)

That got me thinking...
Could I create such a thing in an Excel spreadsheet.
Googling...
Ah yes, somebody already did that, of course.
At themathplace.org.
Look for the Chaos Game Video and pdf file there. The pdf file explains the formulas.
Also, check out Fractal Drawing Video and pdf file. That's interesting too.
He must use different versions of Word (Fractal Drawing) and Excel (Chaos Game) than I have because I cannot display a grid in Word nor can I use that conditional Excel formula he used.
I could do the same thing in Paint Shop Pro that he did in Word.
And I came up with a formula that works in my version of Excel (Excel 97) that does the same thing and generates the Sierpinski's triangle.
He generates random numbers with formulas and plots them on a scatter chart.
(He must have had his calc on manual in Excel.)



Here's the formulas in plain text format for copy/paste.

This formula works:
=IF($A6=1,(B$2+B5)/2*1,0)+IF($A6=2,(B$3+B5)/2*1,0)+IF($A6=3,(B$4+B5)/2*1,0)

This formula did not work:
=(B$1+B4)/2*($A5=1)+(B$2+B4)/2*($A5=2)+(B$3+B4)/2+($A5=3)

This formula is okay:
=INT(RAND()*3)+1

And viola, you get a Sierpinski's triangle fractal on a scatter chart.
Cool.



So why am I going thru all of this?
It helps me learn how Apophysis works so I can make better fractals, hopefully.

4 comments:

Chris W said...

I have been on a similar journey to understand the flam3 algorithm used by Apophysis and other such projects. I appreciate the clear way you demonstrated that the triangles represent the linear transforms of an IFS or flam3 system. Thanks for your post. This have been very helpful.

Marilyn said...

Chris W:
Thanks for the comment.
I noticed the tutorial links are dead, so I hunted down their current location.
Update in main post area. ~M

Craig said...

I've enjoyed reading your Apophysis posts. I was already familiar with the interface. I just needed to know how it all worked. The manual linked to above is a great start. Now to process it all and apply it. Your fantasy mountain landscape in another post inspired me to try something. Then I used Sqirlz Water Reflection to make a little animation with it. Also, I made my first fractal animation today from reading through that manual. Thanks.

Unknown said...

How can you make the square in excel?