Mandelbrot set of Magnetism equation I

fractal {
	// Set region margins and declare state vector as [x,n] where x and n are built-in variables
	orbit [2.5 - 2.5i,+7.5 + 2.5i] [x,n] {
		loop [0, 200] (re(x) > 1000 | im(x) > 1000 | mod2(x) > 40) {
			zn = x * x + w - 1;
			zd = 2 * x + w - 2;
			if (mod2(zd) < 0.000000000000000001) {
				zd = <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]
		}
	}
}

Magnetism equation I from book The Beauty of Chaos


Follow NextFractal on Facebook