A Fractal is an irregular geometric shape, each part of which is statistically similar to the whole

NextFractal

ABOUT

My name is Andrea. I first read a book about fractals in 1994 when I was a jung student. Immediately I decided to write my own software to render fractals. Since then I have been spending part of my time to implement software which everybody can use to enjoy fractals. NextFractal is my new project started in 2014 which aims to provide a modern and powerful tool for creating and exploring fractals.

The beauty of chaos

NextFractal is an application for creating amazing fractals. The fractals are generated from scripts in M language which is a DSL designed for creating Mandelbrot and Julia sets. NextFractal supports continuous zooming of Mandelbrot and Julia sets and supports exporting of images as PNG.

NextFractal is a free software hosted by GitHub.

Requirements

NextFractal requires Java SDK 8 or later and a computer with a multi-core CPU and 1Gb of RAM. NextFractal is available for Mac, Windows and Linux.

DOWNLOAD

The M language

The M language is a Domain Specific Language designed to create Mandelbrot and Julia sets. With the M language you can define the orbit equations and the color algorithm. You can define intermediate values to use in your color algorithm. You can define one or more palette of colors and you can define one or more orbit traps to terminate the iteration loop.

Grammar

Please read the documentation of the M language grammar or download the PDF.

Download PDF

Tutorial

The simplest fractal you can create is the Mandelbrot set of equation x(n) = x(n - 1) * x(n - 1) + w where w is a complex number, n is a positive integer number, x is the state variable, and the initial state is x(0) = 0. The Mandelbrot set is defined by the points of the complex plane which are not attracted by the infinite attractor. When you try to represent the Mandelbrot set on a computer screen you have to take discrete samples mapping the pixels of the screen to the points of the complex plane and assigning a color depending of the value of n when |x(n)| > 2 or n = N.

How do we define the Mandelbrot set in M language?

The code is very simple and you can easily recognize the orbit equation, the termination condition and the color rules which assign a black pixel when n = 0 and assign a gray pixel when n > 0:

fractal {
	orbit [<-2.5,-1.5>,<0.5,1.5>] [x,n] {
		loop [0, 200] (mod2(x) > 4) {
			x = x * x + w;
		}
	}
	color [(1,0,0,0)] {
		rule (re(n) = 0) [1.0] {
			1,0,0,0
		}
		rule (re(n) > 0) [1.0] {
			1,0.9,0.9,0.9
		}
	}
}
				

The resulting image is:

For a complete explanation of this script please read the full article about creating a Mandelbrot set with two colors

The image we created so far has just two colors, but we can easily add a gradient and make the image more interesting:

fractal {
	orbit [<-2.5,-1.5>,<0.5,1.5>] [x,n] {
		loop [0, 200] (mod2(x) > 4) {
			x = x * x + w;
		}
	}
	color [(1,0,0,0)] {
		palette gradient {
			[(1,0,0,0) > (1,1,1,1), 20];
			[(1,1,1,1) > (1,1,1,0), 180];
		}
		rule (re(n) = 0) [1.0] {
			1,0,0,0
		}
		rule (re(n) > 0) [1.0] {
			gradient[re(n)]
		}
	}
}
				

The resulting image is:

For a complete explanation of this script please read the full article about creating a Mandelbrot set with a gradient

The image is getting more interesting, in particular when we zoom closer to the frontier of the Mandelbrot set. You can execute the script in NextFractal and zoom the frontier to see more details:

Please visit the Facebook page if you are interested to more examples.