Thanks a lot, now I have a quite fast program to compute Fractals :D. Nevertheless, I want to comment some more doubts. <br><br>The speed at which some points tend to infinite is huge. Some points, after 10 steps, reach a NaN. This is not problem in my Mac Book, but in the PC the speed is really poor when some infinities are reached (in the mac, the program takes 3 seconds to run, meanwhile in the PC it takes more than 1 minute). In order to solve this, I have added a line to set to 0 the points who have reached 2.0 (so they are already out of the Mandelbrot set):<br>
<i><br>for n in range(1,ITERATIONS):<br>  print "Iteration %d" % n<br>  z *= z<br>  z += c<br>  fractal[(fractal == 1) & (abs(z) > 2.0)] = float(n) / ITERATIONS<br><br># This is the new line to avoid series in some points to reach infinite, which causes problems in my PC<br>
  z[abs(z) > 2.0] = 0<br></i><br>This solves the problem for PC, but delays the calculation...<br><br>On the other hand, the number of calculations that <b>really need</b> to be done (of points who have not yet been excluded from the Mandelbrot set) decreases rapidly. In the beginning, there are, in a given example, 250000 points, but in the final steps there are only 60000. Nevertheless, I'm calculating <b>needlessly</b> the 250000 points all the time, when only 10% of calculations should need to be done! It is a waste of time.<br>
<br>Is there any way to save time in these useless calculations? The idea should be to perform the update of z only if certain conditions are met, in this case that abs(z)<2.<br><br>Thanks.<br><br><div class="gmail_quote">
2009/6/9  <span dir="ltr"><<a href="mailto:numpy-discussion-request@scipy.org">numpy-discussion-request@scipy.org</a>></span><br><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<a href="http://mentat.za.net/numpy/intro/intro.html" target="_blank">ttp://mentat.za.net/numpy/intro/intro.html</a><br>
<br>
We never used it, but I still like the pretty pictures :-)<br>
<br>
Cheers<br>
St?fan<br></blockquote></div><br>-- <br>Juan José Gómez Navarro<br><br>Edificio CIOyN, Campus de Espinardo, 30100<br>Departamento de Física <br>Universidad de Murcia<br>Tfno. (+34) 968 398552<br><br>Email: <a href="mailto:juanjo.gomeznavarro@gmail.com">juanjo.gomeznavarro@gmail.com</a><br>
Web: <a href="http://ciclon.inf.um.es/Inicio.html">http://ciclon.inf.um.es/Inicio.html</a><br>