**The Latööcarfian dream generator**

**The equations**

The Latööcarfian fractals are the dreams of an ancient race of mathematicians living on Jupiter’s moon Ganymede. Or so says Clifford A. Pickover in Chaos in Wonderland.

The image points are iterations of the following:

*x*_{1} = sin(*y*_{0} * *b*) + *c* * sin(*x*_{0} * *b*)

*y*_{1} = sin(*x*_{0} * *a*) + *d* * sin(*y*_{0} * *a*)

It is recommended that parameters be chosen from the ranges -3 < a, b < 3 and 0.5 < c, d < 1.5. But we can't always predict our dreams . . . .

Mutation alpha:

*x*_{1} = sin(*y*_{0} * *b*) + sin(*x*_{0} * *b*)^2 + sin(*x*_{0} * *b*)^3

*x*_{1} = sin(*x*_{0} * *a*) + sin(*y*_{0} * *a*)^2 + sin(*y*_{0} * *c*)^3

Mutation beta:

*x*_{1} = sin(*y*_{0} * *b*) + sin(*x*_{0} * *b*)^2

*x*_{1} = sin(*x*_{0} * *a*) + sin(*y*_{0} * *a*)^2

Mutation gamma:

*x*_{1} = |sin(*y*_{0} * *b*)| + sin(*x*_{0} * *b*)^2

*x*_{1} = |sin(*x*_{0} * *a*)| + sin(*y*_{0} * *a*)^2

The general approach is to find parameters for the equations that produce an interesting low-resolution image, then draw it at higher resolution and color it.

**First:** load an equation and some parameters. A number of presets are included. Then start incrementing the parameters. The spin buttons next to the parameter felds increment the last decimal place of the displayed number; for larger or smaller increments, add or remove a digit. When “auto” is checked, the script will automatically __quick draw__ a low-resolution image when a parameter is changed.

The equations only produce interesting images for certain parameters. If you hit an unproductive range of numbers, you can keep going; you may find another useful range.

Sometimes a low-resolution image looks incomplete. As the points are generated, they fill in the image in chaotic fashion, and it may take more points to complete some images.

**Next:** when you want to generate a higher-resolution image, set the desired size, oversample level, and density, and click __draw__. Oversampling starts with an enlarged array of image points, then reduces it to the size of the final image. The net effect is the recording of points at the subpixel level for increased resolution. This comes at the expense of processing time and computer memory; oversampling by 4 means 16 times as many points. (Note that JavaScript is not as fast as lower-level programming languages.) “Density” refers to how many points are generated; it is proportionate to the oversampled array size. Some images need more points than others; if necessary, increase the density field and click __add points__.

A high oversample level (16) and a low density (1-2) result in a finely-detailed, semi-transparent, three-dimensional “spun glass” appearance that often suggests motion; these images look best with simple color palettes. High densities and complex color palettes do not work as well with Latööcarfian attractors as they do with icons.

If the script is taking too long and you change your mind, click __abort__.

The information field displays the progress of the script. The final result consists of the number of generated points, the maximum number of hits that any subpixel received, the elapsed time, and histogram data showing how many subpixels got how many hits. The position of each histogram entry in the series is also given as a percentile of the total number of hits; the color palette is based on this number.

**Last:** apply a color palette. Several sample palettes are provided. Make your own by entering hex color and percentile pairs, one per line; then press __redraw palette__. A color picker is provided to find hex color values. Roll the mouse over the image and the percentile of the indicated point is displayed below; this can help to position colors in the palette. To apply the palette, press __recolor the image__; recoloring only takes a small fraction of the time that it took to render the image.

(The position numbers do not have to be percentiles; use any numbers and they will be normalized to 0-100. Omit the number and the color will be skipped. The entries do not have to be in order; you can reverse the numbers to reverse colors.)

Images differ in their pixel distributions; a given palette may need to be stretched in either direction for the best results.

When you are happy with the image, right-click the canvas to save it. Click __save__ beside the parameter field to write the parameter set to the parameter field; replace “name” with a name, then copy and save it to a text file. Paste a saved parameter set into the field and click __load__ to load it.