Inspiration

Fractals are cool, there are tons of videos on YouTube, zooming into the Mandelbrot, showing the patterns that emerge as you zoom in. While there are many examples of these, they all use the exact same equation that defines the Mandelbrot set, with fixed values for everything. However, if there's anything university math has taught us, it's that if there's any letters in the alphabet not in your equation, you don't have enough variables. Taking inspiration from this, we added several variables to the equations of a few fractals, so you can see how the fractal changes with slight changes to the how the fractal's created.

What it does

The classic equation for the Mandelbrot set is x_{n+1} = x_n^2+ *x_1. We've added 4 variables to it, changing the equation to x_{n+1} = a*x_n^{power} + b*x_1 + c instead. Each of these variables can be changed, with the fractal being quickly generated with whatever's chosen. We've also implemented the Buddhabrot (somewhat of an inverse of the Mandelbrot set), and Newton's fractal for quartic polynomials. When users find a fractal pattern that they like, we have a feature to download it as an image in various aspect ratios. This will allow users to use their fractal creations as wallpapers, profile pictures or whatever else they want.

How we built it

The entire project was done in JavaScript, with some HTML and CSS for a webpage. The page is currently only locally hosted, using python's http.server module to host the directory.

Challenges we ran into

One major class of challenges was math errors in the fractals. When dealing with so many variables, one small error can completely corrupt the image, and tracking down some of those issues was challenging.

Another challenge was web design, since neither of us were very experienced with graphic design. As a result, the site has just enough functionality to create the fractals, but not much additional design.

Finally, there was a lot of trouble with Chrome and Web Workers. The chrome implementation of Web Workers is currently not the best, with an unknown issue causing the multithreading of Web Workers to leave performance the same, if not worse, as running it on the main browser thread. Updating to the most recent version of chrome minimized this problem, but it still exists and is something to look into at a future date. The best fix was switching to Firefox, where using web workers results in a significant speed up to render times.

Accomplishments that we're proud of

Getting so much done in a group of 2 people was awesome. We weren't sure if we would be able to implement Newton's Fractal in time, but we managed to figure it out and get our implementation working.

What we learned

We learned that Web Workers are way weirder than initially anticipated. Thomas was also not as well versed in JavaScript, so there was a lot of learning JavaScript's quirky behavior. We also learnt that tweaking the variables in the Mandelbrot set does result in really cool patterns!

What's next for Fractal Playground

Add some more color gradients for the Newton's Fractal and Mandelbrot set, as well as refining the user interface. A potential addition would be the usage of webGL or webGPU to render the images on a GPU, which should speed things up more than Web Workers do.

Share this project:

Updates