NextFractal

In this example you will learn how to create the Mandelbrot set of Magnetism equation II from book The Beauty of Chaos.

fractal { // Set region margins and declare state vector as [x,n] where x and n are built-in variables orbit [2.0 - 1.5i,+5.0 + 1.5i] [x,n] { loop [0, 200] (re(x) > 1000 | im(x) > 1000 | mod2(x) > 40) { ta = x * x; tb = x * ta; tc = w - 1; td = w - 2; zn = x * ta + 3 * x * tc + tc * td; zd = 3 * ta + 3 * x * td + w * w - 3 * w + 3; if (mod2(ta) < 0.000000000000000001) { ta = <0.000000001,0>; } z = zn / zd; x = z * z; if (mod2(x - 1) < 0.00000000000001) { stop; } } } // Set background color to alpha=1, red=1, green=1, blue=1 color [(1,0,0,0)] { // Create palette with 200 colors and name gradient palette gradient { [#FFFF0000 > #FFFFFFFF, 15]; [#FFFFFFFF > #FFFFFFFF, 185]; } // Apply rule when n > 0 and set opacity to 1.0 rule (n > 0) [1] { // Set color to element n - 1 of gradient (gradient has 200 colors starting from index 0) gradient[n - 1] } } }

Execute the script above in NextFractal and you will get the image below:

Download NextFractal and start creating your own fractal images. NextFractal is free software, available for Mac, Windows and Linux. The latest release of NextFractal and the source code are available on GitHub.