Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I read this question and I don't understand the answer: Especially how can I aim for the center of the pixel like so:

  for(unsigned SX = SMin; x < SMax; ++x) {
     double k = (double(SX + 0.5) - SMin) / (SMax - SMin);
     double IX = (k * (IMax - IMin)) + IMin;

Is k then the real factor and ix the imaginary factor?

I've made an example here: but how can I find the corner pixel when I want to zoom into it like so:

 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);

In my example the zoomed image is a bit tall in the y-axis. Why is this?

Update: IX is the x-value in the imaginary space hence my first question is answered.

share|cite|improve this question
up vote 1 down vote accepted

I would use Im_factor = Re_factor (assuming square pixels on your screen). In other words, $(MaxRe-MinRe):(MaxIm-MinIm)$ should equal $(ImageWidth-1):(ImageHeight-1)$.

share|cite|improve this answer
Do you mean 16:10? How would I do this? Because the default mandelbrot image seems to work and I use exactly the same real and imaginary steps with the formula in the linked post? – Betterdev Nov 29 '12 at 19:35
Thank you. That seems to work. But how can zoom out the area? – Betterdev Nov 29 '12 at 21:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.