Share your repls and programming experiences

← Back to all posts
Mandlebrot Fractal V 1.01 - BETA
CalebCarlson (33)

Mandlebrot Fractal V 1.0

This program renders the mandlebrot set and saves it as an image that you can download. The image will be found in the Mandelbrot.png file.


What is the mandlebrot set?

To put it simply, the mandlebrot set is a fractal which is plotted on the complex plane. To tell if a certain point is in the mandlebrot set you iterate over this equation:

z = z^2+c

Where z starts at 0 and c is a complex number in the form of x + iy.

If the absolute value of z ever goes over 2 (escapes), then it is Not in the set. Colors are rendered according to how soon they escape the set.

How to use:

Simply wait for the image to generate, then click on the spot where you want to zoom in on.

Features:

Now has zoom capabilities.
Allows you to download the current view of the Mandelbrot fractal
improved calculation speeds

Commentshotnewtop
Nettakrim (272)

you can effectively half the rendering time by flipping the top half upsidedown

CalebCarlson (33)

@Nettakrim
I thought about doing that already, but this would make zooming in a bit more complicated.
But, yes that would half the time it takes to load the entire fractal.
Edit:
I think I will try doing that after I get the code right for zooming in and such, Thanks for pointing that out!

CodeABC123 (93)

The math is SO confusing. Can you help me understand?

CoolestDoggo (71)

insanely slow but cool as hell

EthanCulp (14)

Oh my gosh! This looks so cool! But aren't fractals infinite? How were you able to do this? And I am trying to understand your code, but jeez that math is way above me

CalebCarlson (33)

@EthanCulp
yes, fractals are infinite. And because of that I am working on a method to zoom in on it. (:

maazzubair99 (112)

If the mandlebrot set is in the complex plane, how do you plot it on a x-y plane?

CalebCarlson (33)

@maazzubair99
That is a good question, You would represent the complex plane by plotting it on the real plane. you plot points on the complex plane by using complex numbers in the form of x + iy,
x and y being real numbers, and 'i' the imaginary part.
so what you can do, is take the 'real' parts from the complex number ('coordinates' on the complex plane)
and use those for x,y coordinates.

maazzubair99 (112)

@CalebCarlson so the x-axis represents the real part, and the y-axis is the coefficient of the imaginary part?

CalebCarlson (33)

@maazzubair99
Yes... I think
I'm not an expert on imaginary numbers (I'm only 14) and the complex plane, but I think that you are right.

Giothecoder (122)

@CalebCarlson yes both of you are right. The y axis becomes the i axis and the x axis becomes the real axis.