Register to reply 
MATLAB  Image Processing  Douday's rabbit fractal 
Share this thread: 
#55
Aug711, 07:20 AM

Sci Advisor
P: 2,751

Mystery solved !!!
Ok once I got the python code running it didn't take long to figure out what was happening. In the end it turned out to be fairly simple, the gnuOctave I'm using thinks infinity > sqrt(5), as do I, but Matlab and Python think otherwise. Well actually it's the way the respective programs handle numerical overflow. There are regions on the map that begin with z>2, so not surprisingly when you keep repetitively squaring this you soon get a numerical overflow, (((2^2)^2)^2)^…, it only takes about 10 iterations to exceed even a double precision floating point capability. When this happens Octave returns "+inf" for the absolute value, while matlab and python return "nan" (not a number). So that's it. All the lovely shading that Greenprint (and his matlab textbook) have been getting in their images have been purely the result of bad programming and a glitch in the way the matlab handles numerical overflow. 


#56
Aug711, 06:40 PM

PF Gold
P: 3,098

Ah, thanks.
Numpy has a hack around for the overflow that (efficiently) forces NaN's to zeros: http://www.scipy.org/Numpy_Example_L...21e560ab316ef3 So that



#57
Aug1111, 03:42 PM

PF Gold
P: 3,098

PythonNumpy comparison with Matlab:
http://www.scipy.org/NumPy_for_Matlab_Users 


Register to reply 
Related Discussions  
Image Processing  Science & Math Textbooks  2  
Image Processing  Programming & Computer Science  4  
Matlab Image Processing Help (Image Segmentation)  Math & Science Software  1  
Matlab Image Processing.  Math & Science Software  1  
Image processing matrix image rotation  Engineering, Comp Sci, & Technology Homework  1 