[comp.terminals.tty5620] How much precision does Mandelbrot need

wcs) (03/03/90)

How much precision does it take to calculate Mandelbrot sets correctly?
Do I need to use infinite-precision fractions, or is
single-precision or double-precision floating point enough?
Is it worth doing fixed-point with scaled integers, since the
numbers never get very big?  Since Mandelbrot sets depend very
strongly on initial conditions, it would seem that loss of precision
would quasi-randomly cause different results near any boundaries.
Is this the case?

The choices I have for computing equipment are basically an 8-MIPS
3B2 with decent IEEE floating point, or to use my AT&T 630 terminal
(<1 MIPS 68010, but its CPU isn't all that busy most of the time.)
If I really need DP, I'll do it down on the 3B, but it would be a
nice hack to have a Mandelbrot tool in my terminal.

			Thanks;  Bill
-- 
# Bill Stewart AT&T Bell Labs 4M312 Holmdel NJ 201-949-0705 erebus.att.com!wcs
# Fax 949-4876.  Sometimes found at Somerset 201-271-4712
# He put on the goggles, waved his data glove, and walked off into cyberspace.
# Wasn't seen again for days.

doug@xdos.UUCP (Doug Merritt) (03/04/90)

In article <8602@cbnewsh.ATT.COM> wcs@cbnewsh.ATT.COM (Bill Stewart 201-949-0705 erebus.att.com!wcs) writes:
>How much precision does it take to calculate Mandelbrot sets correctly?
> [...] Since Mandelbrot sets depend very
>strongly on initial conditions, it would seem that loss of precision
>would quasi-randomly cause different results near any boundaries.

That's precisely the case. The net effect is that the deeper you zoom
into the set, the more precision you need. If your zoom factor is only
1x, then you need very little precision. Using fixed point works fine
up to a certain point. I haven't figured it out precisely, but I guess
a rough rule of thumb might be that you need

	# bits of precision = log_base_2(zoom * screen_res * iterations)

This guess gives a maximum zoom factor of about 4K for a 1K (per edge) pixel
screen at 1K iterations using 32 bit scaled integers, which seems like
it's in the right general ballpark.

Note that the number of iterations required for good resolution also
increases as you zoom in further. 256 iterations is ok for a zoom of 2x,
but 1K is needed for deeper zooms, and even more for really deep zooms.
An extremely crude rule of thumb for this might be something like

	iterations = log_base_2(zoom) * 128 + 128

This is all just to give you a general feel for it; there are probably
far better estimates available.
	Doug
-- 
Doug Merritt		{pyramid,apple}!xdos!doug
Member, Crusaders for a Better Tomorrow		Professional Wildeyed Visionary

gwyn@smoke.BRL.MIL (Doug Gwyn) (03/04/90)

In article <8602@cbnewsh.ATT.COM> wcs@cbnewsh.ATT.COM (Bill Stewart 201-949-0705 erebus.att.com!wcs) writes:
>How much precision does it take to calculate Mandelbrot sets correctly?

That depends on the algorithm and on the resolution.
With the most straightforward method, over thousands of iterations,
I get the right results even at fairly high enlargements using normal
double-precision floating-point hardware.  If you think about the way
that rounding errors would accumulate, that's not too surprising.

>Since Mandelbrot sets depend very strongly on initial conditions,
>it would seem that loss of precision would quasi-randomly cause
>different results near any boundaries.

It doesn't have a noticeable effect on the images, though.

I would think that the software floating-point emulation of the 630
CCS would suffice.  While I'm a fan of scaled fixed-point for such
systems, I haven't tried applying that to Mandelbrot image generation.
It would probably work, though.