When you round numbers, interesting things can happen. For example, consider the fraction 6/11, 0.54545454… When rounded to the nearest whole number, it rounds up to 1. But when rounded to the nearest tenth, it rounds down to 0.5. Nearest hundredth? Up. Nearest thousandth? Down. And so on. Of course, numbers can be rounded in other ways. Say, for example, 1/3, 0.33333… It rounds down to the nearest whole number (0), up to the nearest half (0.5), down to the nearest quarter (0.25), up to the nearest eighth (0.375), etc.
The program Ultra Fractal, which I use for almost all of my fractal work, uses complex numbers and has a rounding function. It rounds each part of the complex number (real and imaginary) to the nearest integer (positive, negative, or zero). This can be used to round to any other number (say, nearest 2, nearest 0.5, or nearest π) by:
- Decide on a rounding base. For example, 1 for the nearest integer, 0.5 for the nearest half, or 3.14159... for the nearest π.
- Multiply the number to be rounded by the rounding base.
- Find the nearest complex integer for the scaled number found in step 2.
- Divide the integer in step 3 by the rounding base.
Given all this goodness, there are lots of ways to create an image. If the rounded number is different from the unrounded number, then there’s a rounding error at each iteration. These can be accumulated and the image drawn according to some aspect of that total. Larger rounding bases will generally have larger rounding errors (rounding 47 to the nearest 100 will have an error of 5, but rounding to the nearest 100 will have an error of -47), so the errors can be scaled by the rounding base before adding up. You could just keep track of the direction of the rounding, say by adding 1 to a total if the number were rounded up and subtracting 1 if the number were rounded down. Or, just color by the final rounded and transformed number, irrespective of what happened along the way.
The image at the top of the page begins with a rounding base of 0.0000152587890625 (2-16) and doubles the base every iteration. After rounding, the complex number is rotated by 31 degrees (not 30 or 32—31 is just right).
In the image above, the same rounding parameters are used, but this image is colored according to the relative rounding error (the image at the top uses the adding/subtracting 1 method). And for this image, the complex number was rotated by 1 radian (about 57.3 degrees) each iteration.
This final example (above) uses the scaled increments and transforms the rounded number using the Mandelbrot set formula (z = z2 + c). This gives rise to the appearance of low-iteration Mandelbrot set fractal structures.