Talk:Mandelbrot set

From Rosetta Code


Like the picture! --Paddy3118 10:42, 23 March 2010 (UTC)

Better description

I think we could use a better description here. I'm no mathemetician, but it looks like most of the Mandlebrot images we see (including most of the code attached to this task page) are stackings of the point sets each iteration. (Makes me wish I had a voxel view) Does that sound correct? --Michael Mol 20:19, 14 August 2010 (UTC)

I don't understand your description, but what usually determines the color is the number of iterations until the point leaves the circle of radius 2 (one can prove that if it ever leaves that circle, it ultimately goes to infinity; of course the reverse holds, too).
The simplest way to draw the set (and the only one which would fulfill a strict definition of "drawing the set") would only use two colors: One color for the points in the set (usually, black is used for those points), and another for points outside the set (the natural choice would be white). Of course, what you can draw is only an approximation of the set (because you only do a finite number of iterations; to actually decide if a point is in the Mandelbrot set you'd need an infinite number of iterations, which isn't possible, of course).
However, the algorithm gives you some more information: It not only tells you whether the point ever left the circle, but it also tells you when it left the circle. And since colored pictures look more interesting than black/white ones, usually that information is used to color the image. --Ce 21:02, 14 August 2010 (UTC)

More complex version of JavaScript code

I've improved the JavaScript code to provide several choices of coloring (standard [the one I've already put on RosettaCode], smooth, relief and none [i.e.just the black set on white background]), a possibility to keep the aspect ratio (i.e. if you give a rectangle which doesn't have the same aspect ratio as the canvas, one dimension is extended to give the correct aspect ratio again), and tests for the main cardioid and the first bulb to improve calculation speed. However that complicates the code (e.g. due to the relief code, I have to go through the image in diagonals). Now I see several possibilities:

  • Just leave the page as it is and don't put the advanced code here (maybe put it online elsewhere).
  • Replace the current code with the new one.
  • Add the new code after the current one.
  • Make a new page for the additional implementation, put the extended code there, and link to that page after the existing code.
  • Make a new page, and put both the existing code and the new version there.

Which option do you think I should choose? --Ce 08:15, 22 August 2010 (UTC)

making C version work

What assumptions need to be filled to make the C version work?

I tried building it under cygwin, with the glut runtime and dev installed, using

<lang bash>CFLAGS='-L/usr/lib/w32api -lgl -lGLU32 -lopengl32 -lglut -lm' make mandelbrot</lang>

And that failed for me with lots of failures to link to various entry points which seem to be defined in /usr/lib/libglut.a

It's been years since I have mucked about with makefiles and linker options, and knowing what is supposed to be happening here might help. --Rdm 12:59, 28 July 2011 (UTC)

Does the linker fail to find libglut or does it fail to find function that libglut calls? On my system the program needs,, and libm.a, all of which should be portable. Can you ldd those? --Ledrug 21:11, 28 July 2011 (UTC)
Try putting your flags in the correct order. The -l flags must be after the .c file, and libraries must go in order with -lglut before its dependencies. (ELF shared libraries might already know about their dependencies, but other kinds of libraries might not.) Try this:
<lang bash>make mandelbrot LDLIBS='-L/usr/lib/w32api -lglut -lGLU32 -lopengl32 -lgl -lm'</lang>
If you have missing entry points, please post their names; then we might know which library is missing. If anyone has no err.h, try deleting the #include <err.h> line; I deleted it from this wiki page. --Kernigh 22:08, 28 July 2011 (UTC)
Using LDLIBS rather than CFLAGS worked. Thanks. --Rdm 13:07, 29 July 2011 (UTC)

Task description !!!!

Hi. Some programs make ASCII image on the screen, some make colur image to bmp, some to ppm file. I think that it makes comparisen very difficult ( ? impossible ). Regards --Adam majewski 07:47, 26 November 2011 (UTC)


Hi. Haskell version works, but what means "\" in line

mandelbrot a = iterate (\z -> z^2 + a) 0 !! 50

????? Regards. --Adam majewski 07:53, 26 November 2011 (UTC)

\ is how you write an anonymous function in Haskell (also known as lambda in some other functional languages). The symbol \ is supposed to resemble the letter λ (lambda), which is used to write anonymous functions in lambda calculus. --Spoon! 10:59, 26 November 2011 (UTC)

"One liners"

Some nice contributions made in Haskell have been submitted as quoted code squashed, for some reason, into a "one-liner" format.

A Rosetta line consists of 80 chars at most. Perhaps drop the "one-liner" framing, which costs legibility without adding value ?

Ormolu is a good standard formatter.

(and Hlint helps to iron out many marked or unexpected formulations). Hout (talk) 09:07, 1 August 2021 (UTC)


It works.--xarilaos (talk) 14:37, 20 January 2022 (UTC)