NextFractal

In this example you will learn how to create the image of Newton-Raphson equation.

fractal { // Set region margins and declare state vector as [x,n] where x and n are built-in variables orbit [<-1.5,-1.5>,<1.5,1.5>] [x,n] { begin { s = 0; if (~julia) { x = w; w = 1; } } loop [0, 200] (s = 1) { ta = x * x; tb = x * ta; tc = tb - w; if (mod2(tc) < 0.0000001) { x = x - w; stop; } tc = 2 * tb + w; td = 3 * ta; if (mod2(td) < 0.000000000000000000000001) { td = <0.000000000001, 0>; } x = tc / td; } } // 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.