Raspberry Pi – Mandelbrot pictures

The Python book I’m using is Teach Yourself Python in 24 Hours, by Ivan Van Laningham. It’s been around since 2000, so it’s quite a standard on the subject. There are many example programs listed in the book, both running from the command-line as well as those using the Tkinter GUI.

Chapter 23 introduces us to the Mandelbrot Set and gives a 708-line Python program to calculate the familiar colourful graphs one sees in high school mathematics.

The partial program is as follows:

#!/usr/bin/python
from Tkinter import *
from Canvas import Line,Rectangle
import sys
import string
from colormap import *
from tkFileDialog import *
class Msize:
     def __init__(self,xr=400,yr=400,xs=-2.0,ys=-1.25,xw=2.6,yw=2.6):
          self.xresolution = xr
          self.yresolution = yr
          self.cxsize = self.xresolution
          self.cysize = self.yresolution
...
     def clacker(self,event=0):
          self.pop.post(event.x_root,event.y_root)
if __name__ == "__main__":
     if len(sys.argv)>1:
          ncolors=string.atoi(sys.argv[1])
     else:
          ncolors=32
     root=Tk()
     mandel=Mandel(ncolors,root)
     mandel.root.mainloop()

To avoid all this manual input, the author has generously published them all on his website:

http://www.pauahtun.org/TYPython

Here is how the program looks on the Raspberry Pi when choosing an area to expand and then after the calculations are finished:

Choosing an area

After the calculations

As you can see by the glyphs on the program window, the book’s author is a keen student of Mayan history and archeology.

“A thousand years ago, the Mayans who built a great civilization in the jungles of Central America believed that mistakes in calendrical calculations were the fault not of the scribes or the astronomers, but were the result of direct intervention by the gods.  I believe this too.  If you find any errors in this book, please notify gods A through Z of the Mayan pantheon.  Visit them at The Mayan Gods, or report to them directly at http://www.pauahtun.org/cgi-bin/tothegods.py.”

Here are some of the other beautiful Mandelbrot pictures produced on the Raspberry Pi:

2 thoughts on “Raspberry Pi – Mandelbrot pictures

  1. No-one is born a salesperson, any more than you are born a doctor as well as born a lawyer. Sales is a occupation. To be successful inside any profession one must learn not simply the basic techniques, but also how to use those techniques. Success in sales uses all the abilities you are born with, plus all those acquired through education and expertise.

  2. After looking over a few of the articles on your web site, I honestly like your technique of writing a blog.
    I saved it to my bookmark webpage list and will be checking back in the near future.
    Take a look at my website too and let me know how you feel.

Leave a comment