r.mandelbrot - A Perl-script to compute the mandelbrot set within a XY-location.
(GRASS 6 Raster Program)


r.mandelbrot map=result [-2rp] [iterations=255] [cols=3000] [rows=3000]


The r.mandelbrot script computes the Mandelbrot set.
If no parameters are provided, r.mandelbrot calculates the generic Mandelbrot set using a minimum number of iterations (15) for a default region displaying the whole mandelbrot-set.
The iterations-parameter defines the number of iterations for the current mandelbrot (sub-)set.
The cols- and rows-parameters define the resolution to be used.
Without the raster_name-parameter the script defaults to write its results to the raster map "mandelbrot".
The script can be used in several runs to interactively zoom into the mandelbrot set. Once an image has been calculated, use d.zoom to zoom in on interesting features. The regions' setting will be kept for the next run of r.mandelbrot. Alternatively, the -r flag can be used to return to the original settings. Previous content will be overwritten.


Reset to default region and number of iterations.
Print the current settings and exit.
Double the number of iterations.


Name of the raster to be used. If no name is provided, the default is 'mandelbrot'.
Number of iterations to be calculated for the current region.
Number of columns.
Number of rows.


The script can only be executed in a xy-location.
A GRASS monitor is crucial to judge the computations progress since this is an excercise in visual mathematics and requires the use of d.zoom.

Navigating within the Mandelbrot-set tends to be an iterative process by itself. The following procedure is recommended:
(1) Initialize a session by using r.mandelbrot without any parameters. The Mandelbrot set will be displayed in sufficent resolution in the monitor.
(2) Use d.zoom to choose an area of interest.
(3) Now re-run r.mandelbrot, but provide the iteration parameter and possibly also a specific name for the raster file.
Repeat steps (2) and (3) as necessary.

It is always possible to revisit previous mandelbrot-regions, as the raster_name-parameter stores both the raster map and its region.
So to re-use the raster_name setting of "foo" one should change to its region by "g.region region=foo", followed by "d.rast foo".

The NVIZtool is quite handy to visualize the resulting maps of the Mandelbrot-set.

Mind you

The described script is an excercise in things GRASS was not originally ment for. So do not expect it to match the speed of C code.



Publications by Benoit Mandelbrot, Peitgen et al., etc. etc.


Peter Lwe

Last changed: $Date: 2007/07/16 05:45:34 $