I had never explored the Mandelbrot set before, it was quite a revelation to see how the basic initial pattern (that we see here) repeats millions number of times as we zoom in into the set. The pattern continues to appear clearly all the way to 2**45 magnification with this viewer (getting close to the limit of precision of double floats where pixelization appears), and I presume this continues into infinity. The Wiki article provides more information on the mathematics of the Mandelbrot set.

**Run the Mandelbrot set viewer.**

Usage notes:

- Single clicks in the image centers on the point and doubles the magnification.
- Single clicks outside the image shifts it without changing the magnification.
- Current parameters are given at the top; clicking there brings a popup that allows cut&paste.
- Plus and minus buttons on the left doubles or halves the magnification respectively.
- Keyboard shortcuts:
- plus/minus keys: doubles/halves the magnification;
- up/down arrows: increase/decrease max iterations ("maxit") by a factor of 1.33;
- left/right arrows: zoom backward/forward 4 zoom levels (16x);
- letters: some patterns I looked at (A-O are the 15 examples at the bottom of the math.hws.edu link above, and P-V are a few more I've added). Note that some of those have very high max iterations and can be slow to draw.

Maximum iterations ("maxit" in the parms area) of the algorithm increase as one zooms in, but possibly not quite enough (keyboard up arrow can be used to increase it, but it will slow the algorithm down significantly).

Magnification is possible up to about 2**45 (~ 10**14); going much further shows pixelization, we have reached the precision limit of double floats.

I've tried various things for the colors. I've tried to show colors that are mathematically meaningful (as opposed to aesthetically pleasing). With the current version, pixels considered to be in the set come out yellow, and pixels that come close to max iterations become reddish. In a previous version, colors were based on the last x,y inside the circle before escaping to set the color. At the right is an example of what this looked like.

Drawing a new frame in the Mandelbrot set can take quite a bit of time (tens of seconds), esp. with high maximum iterations (up arrow or some letter patterns), and/or if the frame contains a lot of pixels that are in the set or close. With Safari on MacOS, I have no issue in such cases, but Chrome may complain that the page is taking too long to display, but nonetheless allows one to continue.

The web assembly code is here. In theory, web assembly (wasm) is supposed to run at near native speeds. On my two Macs, performance of this little app is nearly three times slower on Chrome when compared to Safari. That is quite surprising. Clearly it's not near-native speed on Chrome! Playing with some flags (near chrome://flags/#enable-webassembly-baseline -- I didn't take notes) cut times by a factor of two. It could also be related to developer tools. But it's still significantly slower. Firefox is comparable to Safari. I also compared the Safari times with an equivalent C program (compiled with -O3), and the times are very close, so this little app on Safari does seem to run at near-native speeds. It's worth trying all browsers you have access to if you wish to explore the Mandelbrot set with this page. Note also that web assembly is fairly new technology, it might not work as expected in your environment...

This viewer is based on this blog on programming using web assembly by Alexander Curtis.