Accuracy in mandelbrot set

4 views (last 30 days)
Peter
Peter on 14 Jan 2015
Edited: Peter on 15 Feb 2015
Hi all,
I'm trying to write a matlab file which allows me to find nice coordinates in the mandelbrot set (see below). It works fine but if use it to zoom in to much, the images become very pixelated. My guess is that matlab should use more accurate numbers, but i can't seem to manage to solve the problem. You can duplicate my result by running the program below. It will give you the mandelbrot set and a option to click somewhere. It will then zoom in on that point. If you do this 24 times you will clearly see that the image becomes a bit "blurry".
So here is the code:
if true
format long
zoomfactor=4;
middle=-.7;
resolution=100;
startsize=5;
x=gpuArray.linspace(-startsize/2, startsize/2, resolution);
y=gpuArray.linspace(-startsize/2, startsize/2, resolution);
[X,Y]=meshgrid(x,y);
Max=2;
figure(1)
for m=0:inf
iterations=round(zoomfactor^(.12*m)*100);
Z0=(X-1i*Y)*zoomfactor^(-m)+middle;
Z=zeros(size(Z0));
B=gpuArray.zeros(size(Z0));
for n=1:iterations
Z=Z.^2+Z0;
B=B+(abs(Z)<Max);
end
B=log(B);
imagesc(B)
axis off
[a,b]=ginput(1);
m
middle=middle+((a-b*1i)/resolution-1/2+1i/2)*startsize*zoomfactor^(-m)
end
end
Does any of you know a way to solve this problem (without making the program ridiculously slow).
Thanks in advance, Peter
edit: I've done some more searching, and i've found that the error starts occurring at zooms of factor 10^15 (or looking at the 15th decimal). Apparently matlab doesn't compute the decimals beyond this point (this is double precision). Is there any way to get around this? I tried using vpa() but this slowed down my program significantly.
Thanks!

Answers (1)

Zoltán Csáti
Zoltán Csáti on 14 Jan 2015
Your problem is not with accuracy, but the resolution. Try to increase it. I also have a Mandelbrot viewer and I use 1000x1000 resolution. I don't increase the iteration count since it is not needed unless you look at extremely small scales. Take a look at this page, how to speed up GPU computation.
  1 Comment
Peter
Peter on 20 Jan 2015
Edited: Peter on 20 Jan 2015
Unfortunately, the resolution is not the problem. If i run the same program with resolution=1000, i get the same effect. Are you able to zoom in with a factor of 4^24 using your program without getting a pixelated view? If so, could you share your program with me?
Thanks in advance,
Peter
Edit, i have attached an image as an example of what i get when running above program

Sign in to comment.

Categories

Find more on Fractals in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!