Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 1.85 KB

README.md

File metadata and controls

60 lines (42 loc) · 1.85 KB

Mandelbrot

Sample implementations of Mandelbrot set calculations.

Mandelbrot set image

The Mandelbrot set is defined by a set of parameterized functions,

fc(z) = z2 + c

where z and c are complex numbers. For any complex number c, we can then ask whether the repeated application of fc starting from z = (0, 0) stays bound or diverges. The points c on the complex plane for which repeated applications of the corresponding map fc remain bound make up the Mandelbrot set.

Scala implentation

As a programming exercise, I am attempting to code the Mandelbrot set in Scala. I want to see how efficient this is, both in lines of code and in runtime speed. I also want to see if it makes sense to program in a purely functional style.

Further, this gives an opportuntity to use Scala to call some Java graphics commands to render the Mandelbrot set as an image.

Actors

This calculation is often used as an MPI demo, since the calculation of each point is decoupled, hence an embarassingly parallel algorithm is possible. This should easy to implement using Actors, and it might be a fun benchmark for testing diffent sizes for the Actor pool.

Actors have not been implemented yet.

Build and Compile

Build with

scalac -cp scalatest_2.9.0-1.8.jar MandelbrotTest.scala Mandelbrot.scala

Run unit tests with

scala -cp scalatest_2.9.0-1.8.jar org.scalatest.run MandelbrotSuite

Run code to generate 1280x800 image.png using

scala -cp . MandelbrotArtist