NextFractal

**NextFractal** is an application for creating amazing **fractal images** and other **algorithmically generated images**. Images are generated processing a script and some user provided parameters depending on the selected grammar. The grammar defines the domain specific language used to compose the script.
NextFractal is currently able to interpret **M scripts** and **CFDG scripts**. The M scripts are based on a **domain specific language** which is designed for creating **Mandelbrot** and **Julia** sets. The CFDG scripts are based on a **context-free grammar** designed for creating geometric shapes iteratively. NextFractal provides also tools for exploring Mandelbrot and Julia sets, browsing images, creating **time based and events based animations**, and **rendering images and videos**. NextFractal exports to formats PNG, AVI and Quicktime.

NextFractal is free software, available for Mac, Windows and Linux. **NextFractal requires Java SDK 8 or later**. We recommend a computer with multi-core CPU, modern graphics card, and 2Gb of RAM. Download the software archive for your platform and decompress the archive in your preferred location. The latest release of NextFractal and the source code are available on GitHub.

The M language is a domain specific language designed to create **Mandelbrot** and **Julia** sets. Using M language you can define the **orbit** algorithm and the **color** algorithm for generating a fractal image. You can define multiple **color palettes** and multiple **orbit traps**. You can use expressions to activate rules and compute colors, and you can set the opacity to compose rules.

We have created a tutorial by examples for learning the M language. The tutorial shows how to implement various techniques for generating orbits and colors with an increasing level of complexity. We also provide a general introduction to the Mandelbrot set and the Julia sets in the next sections of this site.

NextFractal accepts few keyboard commands when focus is on rendering area:

Press keys 1, 2, 3, 4, 5 to change zoom speed

Press key T to show/hide traps

Press key O to show/hide orbit

Press key P to show/hide preview

Please read the **grammar specification** of the M language which provides the exact definition of all the lexical tokens and syntactic rules you can use in any M script. The grammar specification is also available in PDF format for download.

The CFDG language is a domain specific language designed to create **geometric shapes** iteratively. Using CFDG language you can define a set of shapes where each shape can be a simple shape or a composed shape. Composed shapes might include other shapes with some modification such as geometric transformations or color adjustments.

NextFractal is able to interpret CFDG scripts since version 2.0 and it supports the same grammar as ContextFree 3.0.10. Just copy & paste or drag & drop a CFDG script. Please note that *the CFDG engine is still under active development and it might present bugs or it might be incomplete*. Please report any issue found to help improving the product.

You can find a comprehensive documentation of the CFDG grammar on **www.contextfreeart.org**.

Please read the **grammar specification** of the CFDG language which provides the exact definition of all the lexical tokens and syntactic rules you can use in any CFDG script. The grammar specification is also available in PDF format for download.

We want to share with you some beautiful images generated with NextFractal. The scripts for all images are available as part of NextFractal distribution. Download the application and start exploring these beautiful fractals on your computer.

Fractals are fascinating objects that we can encounter in geometry. A Fractal can be described as an object with an irregular geometric shape each part of which is statistically similar to the whole. To simplify we can say that a Fractal object contains copies of the whole object at different scale level. The interesting aspect of Fractals is that they have some common properties which make them very special. Moreover some of them exist in the real world. The shape of a sea cost is a fractal, some trees and vegetables are fractals, just to name a few. But who did find them? Why they are called fractals? Who is Mandelbrot?

The Mandelbrot set is one of the most fascinating objects that we can encounter in geometry. The discovery of this fractal object in 1979 is attributed to **Benôit Mandelbrot** who founded the new branch of **Fractal Geometry**. Mandelbrot introduced the word Fractal from latin Fractus, which means irregular, to describe a new class of objects which have similar properties. Fractals have an irregular shape and present a property called **self-similarity**. Benôit Mandelbrot defined the attributes these objects including the **fractal dimension** which measures the irregularity.

The Mandelbrot set is defined as the set of points of the complex plane which generate orbits of a not linear system that don't converge to any attractor for that system. The simplest Mandelbrot set you may create is the set of equation x ^ 2 + w which represents the not linear system x(n + 1) = x(n) * x(n) + w, where x and w are complex numbers, n is a positive integer, and the initial state is x(0) = 0. Even a simple equation like x ^ 2 + w generates a complex object with unexpected properties. One of the most surprising property is that the Mandelberot set is totally connected, which means that given two points of the set you can always connect them with a line contained in the set.

In order to represent the Mandelbrot set of equation x ^ 2 + w on the screen of your computer, you have to map the pixels of the screen to the points of the complex plane. For each point p = (px,py) set w = px + py i, and iterate the system equation from 0 to n <= N, where |x(n)| > 2 or n = N, and N is the maximun number of iterations. You will generate a sequence x(0), x(1), x(2), ..., x(n) for state variable x, which represents the orbit of point p. Finally color the pixel with a color derived as function of the state values and/or iteration n.

The M script for generating the Mandelbrot set of equation x ^ 2 + w is very simple. You can easily identify the region [<-3.0,-1.5>,<0.0,1.5>], the iteration interval [0,200], the loop condition |x| > 2, the system equation x = x * x + w, the background color (1,0,0,0), and the color rule which sets the color to element n - 1 of linear gradient when n > 0:

fractal { orbit [<-3.0,-1.5>,<0.0,1.5>] [x,n] { loop [0, 200] (|x| > 2) { x = x * x + w; } } color [(1,0,0,0)] { palette gradient { [#FFFF0000 > #FFFFFFFF, 10]; [#FFFFFFFF > #FF000000, 190]; } rule (n > 0) [1.0] { gradient[n - 1] } } }

The script above generates the image below when executed in NextFractal. You can see that the Mandelbrot set has a irregular frontier with many tentacles which depart from the central bulb. You can't immidiately see it but the tentacles are very thin and actually they spread all around.

You may change the region and zoom close to the frontier of the Mandelbrot set to see more details. The more you zoom, the more details you find and you may also find copies of the whole Mandelbrot set. The amount of details depends on the maximun number of iterations N, the higher is the value of N the more details you see. This richness of details makes the Mandelbrot set the most complex object in mathematics.

NextFractal provides tools for zooming, moving and rotating the images to discover new details. Unfortunately decimal numbers provided by a computer CPU have a finite resolution, so you cannot continue to zoom the Mandelbrot set over a certain limit using floaitng point numbers. You may use a software library which provides decimal numbers with higher resolution but usually these libraries are not suitable for realtime application.

The Julia sets and the Fatou sets are fractal objects derived from the Mandelbrot set. They are generated from the same equation of the Mandelbrot set but with a different initial state. Actually the Mandelbrot set is a map of all possible Julia and Fatou sets. Each point inside the Mandelbrot set generates a Julia set, and each point outside the Mandelbrot set generates a Fatou set. Basically Julia and Fatou sets differ for one property, that all Julia sets are totally connected as the Mandelbrot set and on contrary all Fatou sets are not connected. For that reason Fatou sets are also called fractal dusts.

In order to represent a Julia or a Fatou set on the screen of your computer, you have to map the pixels of the screen to the points of the complex plane. Given a constant w = wx + wy i, for each point p = (px,py) set x = px + py i and iterate the system equation from 0 to n <= N, where |x(n)| > 2 or n = N, and N is the maximun number of iterations. You will generate a sequence of state values like x(0), x(1), x(2), ..., x(n), which represents the orbit of point p. Finally color the pixel with a color derived as function of the state values and/or iteration n.

The M script for generating a Julia or a Fatou set is very similar to the script for generating the Mandelbrot set. They differ for the initial values of w and x. For Julia and Fatou sets w is a constant and x is a variable. The constant w determines the shape of the fractal:

fractal { orbit [<-1.5,-1.5>,<1.5,1.5>] [x,n] { begin { x = w; w = <0.28,0.53>; } loop [0, 200] (|x| > 2) { x = x * x + w; } } color [(1,0,0,0)] { palette gradient { [#FFFF0000 > #FFFFFFFF, 10]; [#FFFFFFFF > #FF000000, 190]; } rule (n > 0) [1.0] { gradient[n - 1] } } }

The script above generates the image below when executed in NextFractal. NextFractal provides tools for generating a Julia or Fatou set for a specific constant w. Usually you don't need to insert the begin statement in your script unless you want to force a specific value of w as in the example above.

Remember that Mandelbrot set and Julia and Fatou sets are deeply interconnected by the system equation. You can observe that the shape of the Julia or Fatou set for constant w = wx + wy i reflects the shape of Mandelbrot set around the same point w of complex plane.

NextFractal provides a tool for generating a preview of Julia or Fatou set for any point of Mandelberot set. You can use the Mandelbrot set to predict the shape of the Julia or Fatou set. Because Julia and Fatou sets are basically the same from the point of view of the computing algorithm, NextFractal doesn't distinguish Julia sets from Fatou sets.