Version 2 still has problems...

The hi-res zone idea helped, but not enough. There are two main problems:

No fixed resolution is good enough

For example, if |x| is 1/100, then |d/dz(sqrt(z))| at x is 5. Adding a double-resolution bitmap at the problem zone reduces the scale factor to 2.5, but it's still more than 1.

I didn't do anything in the pre-image of the hi-res zone.

The hi-res zone may have a lot of pixels in it, but those pixels can only be drawn if we can "get there" from some other place. But that other place is probably outside the hi-res zone, and so it has normal pixel density. There just aren't enogh pixels here to properly fill the hi-res bitmap.

The solution

The second version hints at the next step to take: since we never draw the hi-res bitmap to the screen, it doesn't need to be a real bitmap. All it needs to do is implement getpixel, setpixel, and clear functions. Instead of a normal bitmap, use something with a different coordinate system that doesn't cause the sqrt function to have a large derivative anywhere. A log scale will do nicely. This is probably best thought of in polar coordinates:

r.eit -> log(r)+it

sqrt(r.eit) -> log(sqrt(r)) + it/2 = (log(r)+it)/2

Taking the square root of reit just divides log(r) and t by 2. In these transformed coordinates, the derivative of the square root function is always 1/2. (There's another square root of course, but it is similarly unproblematic)


Diagram of the transformation z -> rlog(z). This maps a circle of radius r (and circumference 2*pi*r) to a rectangle of height 2*pi*r. The transformation has a scale factor of 1 at the boundary of the circle. Inside the circle, the scale factor is higher. In fact, it is infinity at the centre of the circle- the actual implemenation cuts the centre out at a very small radius. The effective resolution at z increases as z approaches the centre of the circle.


The problem points are c, c2+c, (c2+c)2+c... At each of these points, a transformed bitmap is used to increase the effective resolutino at the centre.

Some sets with rendering trouble at the centre

(0,0.75)
(0,1) The julia set at c=i is known to contain zero and have no interior. This is in some sense the worst possible case.
(-2,0) Vastly improved. This is now starting to look like a viable way of drawing a line segment. :)
(-1.31,0) No problems, because it doesn't get very close to the centre.

Newer, More Improved Applet

Source code

Julia3.java Complex.java
Part 4... Back