0

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; //iteration
var c_i = task.i; //
var max_iter = task.max_iter; // = 1024
var escape = task.escape * task.escape; //task.escape=1025
task.values = [];
for(var i = 0; i <task.width;i++) {
    var c_r = task.r_min+(task.r_max - task.r_min) * i/ task.width;
    var z_r = 0, z_i = 0;

    for(iter = 0; z_r*z_r + z_i*z_i < escape && iter < max_iter; iter++) {
        // z->z^2 + c                   ▲ i wonder about this
        var tmp = z_r*z_r - z_i*z_i + c_r;
        z_i = 2*z_r*z_i+c_i;
        z_r = tmp;
    }
    if(iter == max_iter) {
        iter = -1;
    }
    task.values.push(iter);
}
return task;}
MZaragoza
  • 10,108
  • 9
  • 71
  • 116
  • Escape should be 2, but you need to understand first the calculation basics. I have written an summary of the most important parts here: http://stackoverflow.com/questions/9253208/having-trouble-calculating-mandelbrot-set-iterations/9941874#9941874 – karatedog Apr 13 '14 at 07:32
  • Is this your own code? Just because you are asking questions about it. You use the "task" object as argument, but there is no info about it – karatedog Apr 13 '14 at 07:33

1 Answers1

0

I heard "escape" should be 4(2^2)

Escape radius should be greater then 2 so any value > 2 is good. It can change shape of level sets and shape of numerical aproximation of Mandelbrot set. Square of escape radius should be greater then 4.

See also this question

HTH

Community
  • 1
  • 1
Adam
  • 1,254
  • 12
  • 25