Fractals Programming Python

Fractals in 10 minutes No. 1 – LStrings

Lately it started to be quite fun to find some fun mathematical formula, and just code it in python, and plot the result. Fractals are such fun. LStrings is an example of that. For those who don’t know – lstrings are simple strings with three letters, ‘f’ for forward, ‘l’ for left, ‘r’ for right. An iteration of an lstring is replacing all occurrences of ‘f’ with the original string.

During high-school I recall long lessons when I would draw complicated iterations of some simple lstring just to see the result. Sometimes I still draw them. A few days ago I just wanted to see how long it would take me to program one. It actually was quite short. What really took me time is blogging about it ;)

The source and the results are available here.

This post is going to be the first in a series of posts about some fractals. I will continue to write other examples of simple code that (hopefully) generates beautiful results. Stay tuned for more.

Do you know any elegant\short\simple pieces of code that generate fractals?

One reply on “Fractals in 10 minutes No. 1 – LStrings”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.