This is a read-only archive!

More Clojure Mandelbrot Goodness

After my brief stint in the world of fractal geometry and Clojure, I decided to make a real Mandelbrot set viewer. The resulting source code is here. Here's a simple output (click for bigger version):

/clojure/mandelbrot/thumbs/mandelbrot-smooth.png

It's a pretty naive implementation, barely 100 lines of code, but even with my brute-force approach, given a liberal sprinkling of type hints it runs fast enough. Programming Swing from Clojure couldn't be easier (though I doubt programming Swing from any language is ever really enjoyable, it's a painful bunch of libraries).

There's a discussion of different coloring algorithms on Wikipedia, but even after reading that, getting this thing to look good was difficult. I don't know enough math for it. I ended up cheating and I colored a couple of them in the GIMP, so I could use them as desktop wallpapers.

/clojure/mandelbrot/thumbs/mandelbrot-rainbow.png /clojure/mandelbrot/thumbs/mandelbrot-rainbow-2.png /clojure/mandelbrot/thumbs/mandelbrot-rainbow-3.png

/clojure/mandelbrot/thumbs/mandelbrot-rainbow-4.png /clojure/mandelbrot/thumbs/mandelbrot-rainbow-5.png

There are some more PNGS over here including one that's 16000x16000 (producing it almost melted my CPU last night).

This post is related to Clojure: ASCII Mandelbrot Set
May 20, 2009 @ 4:39 PM PDT
Cateogory: Programming

1 Comment

Adam
Quoth Adam on May 10, 2011 @ 9:09 PM PDT

Hi. Thx for this article. I was trying to run ypur program : java -cp ~/.clojure/clojure.jar clojure.main ~/clojure/m/mandelbrot-swing.clj WARNING: partition-by already refers to: #'clojure.core/partition-by in namespace: mandelbrot, being replaced by: #'clojure.contrib.seq-utils/partition-by WARNING: frequencies already refers to: #'clojure.core/frequencies in namespace: mandelbrot, being replaced by: #'clojure.contrib.seq-utils/frequencies WARNING: shuffle already refers to: #'clojure.core/shuffle in namespace: mandelbrot, being replaced by: #'clojure.contrib.seq-utils/shuffle WARNING: reductions already refers to: #'clojure.core/reductions in namespace: mandelbrot, being replaced by: #'clojure.contrib.seq-utils/reductions WARNING: partition-all already refers to: #'clojure.core/partition-all in namespace: mandelbrot, being replaced by: #'clojure.contrib.seq-utils/partition-all WARNING: group-by already refers to: #'clojure.core/group-by in namespace: mandelbrot, being replaced by: #'clojure.contrib.seq-utils/group-by WARNING: flatten already refers to: #'clojure.core/flatten in namespace: mandelbrot, being replaced by: #'clojure.contrib.seq-utils/flatten

I have found no image. Can you help me ?

Regards