The iteration
This project originally aimed at reproducing the fractal that appears on a poster about the Lambert W function. This poster is available at orcca.on.ca/LambertW/pic/bg/LambertW.jpg and more information about the Lambert W function can be found on Wikipedia or in the Corless, Gonnet, Hare, Jeffrey and Knuth paper from 1993.
- The Parallel Computing Toolbox must be installed. If you do not have the parallel computing toolbox install you may modify the code slightly by changing any
parfor
loops tofor
loops. - All contents (files and subfolders) of the
src
directory must be in your Matlab working directory.
The main function used for producing images is the iteratedExponential
function.
It is called as
iteratedExponential(workingDir, options);
The workingDir
is the location where images will be saved.
When the function is called, it will create the working directory if it does not already exist.
A README.txt
file will be written containing information about the image produced.
The images are named as Image-k.png
where k
is a positive integer to ensure images are never overwritten.
A cmap
option). When this option is used, a point in the complex plane with cycle length L
will use the L mod m
color from the colormap.
Option Name | Default | Details |
---|---|---|
margin |
[-1-1i, 1+1i] | Must be a struct with keys:
|
height |
1000 (pixels) | The height (in pixels) of the grid to be used. The width is determined from the margin such that each grid point is square. |
nPre |
500 | Number of iterations to run before starting to search for cycles, a larger number will make finding the cycle lengths easier and lead to less false cycles being found. |
maxLength |
500 | The maximum cycle length to search for. |
tol |
1e-4 |
Tolerance to use when searching for cycles. |
cmap |
A 5-color colormap that looks nice. | A m x 3 vector of values in [0,1] that specify the colors to be used for the image. Each row is an rgb triple. |
backgroundColor |
[0, 0, 0] (black) |
Set this to a vector with 3 values representing the rgb values (between 0 and 1) to use for the background color. The background is regions where the iteration either diverged, overflowed or underflowed. |
workingDir = '~/CoolFractal/';
margin = struct('bottom', -2, ...
'top', 2, ...
'left', -3, ...
'right', 1);
options = struct('margin', margin, ...
'height', 800, ...
'nPre', 2000);
iteratedExponential(workingDir, options);
Output image: