This program creates fractals, among other things. The user submits the proportions of the graph and the recursive function they want visualized. Then, the program generates the graph, coloring pixels darker if they diverge faster and black if they dont diverge at all when the submitted function is applied recursively starting with that point. This sort of process is how the iconic mandelbrot set is generated. In fact, running the preset settings will generate the Mandelbrot in all its glory.

Domain:

[,]

The domain and range of the graph. Place the minimum value first, and the maximum value last.

Size:

This is how many pixels each "1" of the doman and each "1" of the range take up. In other words, how many pixels are between 0 and 1 on the graph. Keep the domainScale and rangeScale equal for an even (not stretched or squished) graph, increase this values to zoom in.

Gridlines:

Places a gridline every ___ units. For example, a graph with a domain [-2,3] and a domain gridline at every 1/2 will have a total of 11 gridlines including the boundaries.

Function:

This is the most important part: The Recursive Function. It accepts 4 inputs: a and b, which are the coordinates of the previous iteration of the function (initially equal to c and d in the first iteration), and c and d, which are the inital coordinates of the function. Basically, at point (c,d), the program plugs in the coordinate to the function and is returned a new coordinate. This new coordinate is again plugged into the function as a and b, which along with the original c and d are combined to get a new point, upon which the cycle repeats. NOTE: The mandelbrot set generally uses an initial value of (0,0) for (a,b), but this method produces the same shape. To generate a julia set corresponding to (c,d), replace (c,d) in the preset formulas with the specific values.

You might be more used to seeing fractals generated through imaginary values. Zn = f(Zn-1, Z0). In this format, the equation for the mandelbrot is Zn = (Zn-1)2 + Z0. However, javascript doesn't natively support imaginary numbers. Instead, we define a and b, where a+bi=Zn-1, and we define c and d where c+di = Z0. Then the two function inputs are just the real part and imaginary part of the full complex function f(Zn-1, Z0). Finding the real and imaginary part of a complex function can be tricky, but for the mandelbrot function, it is easy and is seen above (The real part provides the x-output and imaginary part provides the y-output). If you want to keep the complex nature of fractals, you can imagine that a = Re(Zn-1) and so on.

Parameters:

These values dictate how the function is applied. Threshold is the minimum distance for which the program decides that the coordinate has diverged and doesn't need to be recursed on anymore. For example, if threshold is 5 and at a coordinate the function returns (6,0), the program will stop iterating the function, graph the point, and continue.

Iterations is the amount of times the program is run on a point. The more iterations, the more accurately the program will be able to check if a point diverges or not. When zoomed in, it is generally necessary to increase this value. However, this is another computationally intensive value, so don't go overboard.

Output:

If the value inside is "1", the program will color every single pixel, and the color will depend on the rate at which the function diverges. If the value is "0", the program will only color the pixels that don't diverge.

Bonus

If you hold your mouse and move it around, you will see the point returned by each iteration of the recursion. For places in the fractal, there will either be infinite oscillation or the iterations will converge to a single point. For places outside the fractal, the iterations diverge (return increasingly far-off points).

If you put your mouse over an area and press z, the graph automatically zooms into that area