0
votes

I've created a mandelbrot in php but the mandelbrot is looking a bit strange. How can I improve it? enter image description here

You can find a live example here: http://www.phpdevpad.de/index.php?id=190.

Update: Mandelbrot-Zoom with 900 iterations:

enter image description here

Update: I use this method of computing the mandelbrot:

double Re_factor = (MaxRe-MinRe)/(ImageWidth-1);
double Im_factor = (MaxIm-MinIm)/(ImageHeight-1);

double newMinRe = MinRe + (Re_factor* x1);
double newMaxRe = MinRe + (Re_factor* x2);
double newMinIm = MinIm + (Im_factor* y1);
double newMaxIm = MinIm + (Im_factor* y2);

// and then I compute c - real and c- imag values

  for(unsigned y=0; y<ImageHeight; ++y) 
{ 
  double c_im = newMinIm - y*Im_factor;
  for(unsigned x=0; x<ImageWidth; ++x)
    {
      double c_re = newMinRe + x*Re_factor;

      // ComputeMandelbrot();

     }

 }
  1. http://warp.povusers.org/Mandelbrot/
2
Can you post a link to the source? Or include the relevant bits here? - ethrbunny
@ethrbunny: Done. Read my update. - Micromega
In the tutorial on Julia sets... A connected Julia set always contains the point 0+0i. A disconnected one does not contain that point. So by testing the point 0+0i for different values of K you can create a map of connected julia sets. This map IS the Mandelbrot set for that family of Julia sets. Mandelbrot discovered this shape quite literally by mapping julia sets. - phkahler

2 Answers

1
votes

1) You need to increase the maximum number of iterations. The black areas are too large.

2) You can change the palate to something more interesting. The abrupt change to "blue" is weird.

3) The default picture of a woman should be larger and....

1
votes

I'm guessing a few things are going on:

  1. As mentioned before, 60 iterations on a fractal like this will get you nowhere. Try 6000.
  2. You're likely running into the limits of precision of a double. That will eventually lead to blocky, and possibly incorrect renderings, especially as you zoom. You will need an exact number type. PHP does not offer a real exact data type natively, so you will have to either except minor inconsistencies related to the nature of floating point numbers or do some fun math yourself as integers or bytes.