Questions tagged [mandelbrot]

The Mandelbrot set is a fractal in the complex plane.

Many programmers write their own Mandelbrot generators as a way of sharpening their coding (and, to a lesser extent, maths) skills; there are interesting programming challenges to be solved, and a beautiful visual journey as you explore the depths of the set.

The algorithm

At its heart, plotting the Mandelbrot set is a question of complex maths:

  1. Map a grid of pixels to a region of the complex plane
  2. For each complex point, apply the formula Zn+1 = Zn + C, where:
    • C is the point's complex co-ordinates
    • Z0 = 0
  3. Iterate each point until the point is distance greater than 2 from the origin, or until you get bored (often a fixed iteration limit).
  4. If a pixel did not escape, it is part of the Mandelbrot set and traditionally represented by a black pixel; otherwise, apply your choice of colouring algorithm to decide what colour to paint the pixel.

Challenges

In the process of writing a non-naive Mandelbrot set plotter there are a number of algorithmic and architectural challenges to be solved.

On deep zooms it is possible to reach the limit of precision of the double type, leading to the question of how one might go further; arbitrary-precision arithmetic is one answer, while some brave souls implement their own fixed-point types.

Creating a plot is a very CPU-intensive process, so optimisation rapidly becomes important in order to be able to generate a plot in a reasonable time. As individual points do not depend on each other (with most plotting algorithms), it is possible to parallelise the work - which is itself a further challenge.

There is also the question of whether and how the user interacts with the plotter.

Further reading

  • Wikipedia has a detailed description of the fractal, its history, pseudo-code for the basic algorithm and descriptions of a number of extensions.
  • Wolfram has a purely mathematical description of the fractal and many links to related work.
361 questions
0
votes
2 answers

Mandelbrot, html variable to javascript

I have a problem, I need to configure a code. Which makes the mandelbrot fractal on a canvas, and I need to make a variable from html form, convert it to javascript variable, but there's my problem. And i need to get the minimum and maximum of the…
0
votes
1 answer

Smooth coloring\Normalized Iteration with Julia set - Python

I've been working on making a julia set code with python. I didn't write the original code, but I modified it slightly and it achieves what I want it too... except smooth coloring! I've read on how to do it, but I'm still confused. Code…
Lillz
  • 283
  • 2
  • 5
  • 19
0
votes
1 answer

vhdl - incrementing a vector in the complex plane by a fractional amount

I am working on a project that will generate and display the Mandelbrot set on a 640 x 480 vga display (other higher resolutions are planned). Mapping the VGA x coord to the complex plane is fairly straightforward - If I take the Mandelbrot x region…
John Horstkamp
  • 87
  • 1
  • 1
  • 10
0
votes
3 answers

C# Case statement not entering

I am currently working my way through a Wrox C# book. However, following one of the tutorials that displays a Mandelbrot set, I am able to execute my program without error, however nothing is being displayed in the console. I am putting this down to…
IronAces
  • 1,857
  • 1
  • 27
  • 36
0
votes
1 answer

Converting smoothened values from Mandelbrot to an int[] array from the setRGB() method

I have a list of double values that range from 0 to 1 as a result of my mandelbrot generator. These are resultant values from using a smooth algorithm to smooth out the values. I am in the process of drawing them onto a BufferedImage, however, the…
theGreenCabbage
  • 5,197
  • 19
  • 79
  • 169
0
votes
1 answer

I can't understantd something about mandelbrot fractal code

It is calculation function code. I heard "escape" should be 4(2^2). because if (z_r*z_r + z_i*z_i) is smaller than 4 it won't go infinity. but in this code escape is 1025^2. why ? why 1025^2? function computeRow(task) { var iter = 0;…
0
votes
1 answer

Julia Set Using JS Canvas

I'm new to Javascript. I'm working on a script to display a Julia set using canvas using the external distance estimation method This is the code I'm using to color it: distance_estimation: function(distance, max_distance, iteration,…
0
votes
2 answers

Mandelbrot Set GUI java

Hi so I've written these code to show a mandelbrot set but everytime I run it, it only shows black. I've been trying to see where my errors are but failed to find them so it would really helped if you guys can show them to me. Here's the code for…
Michael
  • 3
  • 2
0
votes
2 answers

Mandelbrot set in Scheme

I was wondering if anyone had any advice on writing the mandelbrot stream. I have wrote the following functions for myself to help: (define (make-complex a b) (cons a b)) (define (real-coeff c) (car c)) (define (imag-coeff c) (cdr c)) (define (c-add…
John Friedrich
  • 343
  • 5
  • 21
0
votes
1 answer

Mandelbrot Set outputting a single point

I've been bashing my head against this all day. I feel like this really should work! No matter what I do to tweak this it outputs a single dot. Any help will be very much appreciated! double x_init, y_init; //These will be the real and…
Ben Kushigian
  • 285
  • 1
  • 10
0
votes
1 answer

Suggestions for optimizing a fractal visualization method

I've written up a variation on Melinda Green's Buddhabrot method for visualizing the Mandelbrot set. Here it is: http://pastebin.com/RH6dD77F To create an animation I rendered hundreds of the individual images with slight variations. The variation…
Kabbotta
  • 15
  • 5
0
votes
1 answer

Haskell - Problems in the Mandelbrot drawer

So, as a beginner, I thought I would work on a horribly, awefully terrible version of the mandelbrot set project. In this pitiful case, the set is drawn with text (Shreik!) into a text file. Because I wanted some practice with some numerical coding,…
bimmo
  • 385
  • 2
  • 8
0
votes
1 answer

C X11 Segmentation Fault in MandelBrot Set Application

I can't for the life of me find this seg fault. It keeps occurring on the slave processes as soon as I launch. I have already developed a standard application that works perfectly but have come across this issue when I tried to implement a zoom…
Jarrod Cabalzar
  • 408
  • 1
  • 5
  • 24
0
votes
1 answer

How to fix my Pthreads code about Mandelbrot set?

I have the following Pthreads code about calculating and creating a picture of the Mandelbrot set. My code in C works just fine and it prints the resulting picture nicely. The point is that using the below code, I am able to compile the code and…
user1726549
0
votes
1 answer

Determining coordinates for mandelbrot zoom

I got a mandelbrot set I want to zoom in. The mandelbrot is calculated around a center coordinate, mandelbrot size and a zoom-level. The original mandelbrot is centered around real=-0.6 and im=0.4 with a size of 2 in both real and im. I want to be…
Stayfrosty555
  • 23
  • 1
  • 5