@menu
* Introduction to fractals::
* Definitions for IFS fractals::
* Definitions for complex fractals::
* Definitions for Koch snowflakes::
* Definitions for Peano maps::
@end menu




@node Introduction to fractals, Definitions for IFS fractals, fractals-pkg, fractals-pkg
@section Introduction to fractals


This package defines some well known fractals: 

- with random IFS (Iterated Function System): the Sierpinsky triangle, a
Tree and a Fern

- Complex Fractals: the  Mandelbrot and Julia Sets

- the Koch snowflake sets

- Peano maps: the Sierpinski and Hilbert maps

Author: Jos@'e Ram@'{@dotless{i}}rez Labrador.

For questions, suggestions and  bugs, please feel free
to contact me at

pepe DOT ramirez AAATTT uca DOT es

@node Definitions for IFS fractals, Definitions for complex fractals, Introduction to fractals, fractals-pkg
@section Definitions for IFS fractals

Some fractals can be generated by iterative applications 
of contractive affine transformations in a random way; see 

Hoggar S. G., "Mathematics for computer graphics", Cambridge University
Press 1994.

We define a list with several contractive affine transformations, 
and  we randomly select the transformation in a recursive way. 
The probability of the choice of a transformation must be related 
with the contraction ratio.

You can change the transformations and find another fractal

@deffn {Function} sierpinskiale (@var{n})

Sierpinski Triangle: 3 contractive maps; .5 contraction constant and translations;
all maps have the same contraction ratio. Argument @var{n} must be great enougth, 10000 or greater.

Example:

@example
(%i1) load("fractals")$
(%i2) n: 10000$
(%i3) plot2d([discrete,sierpinskiale(n)], [style,dots])$
@end example

@opencatbox
@category{Package fractals}
@closecatbox

@end deffn

@deffn {Function} treefale (@var{n})

3 contractive maps all with the same contraction ratio.
Argument @var{n} must be great enougth, 10000 or greater.

Example:

@example
(%i1) load("fractals")$
(%i2) n: 10000$
(%i3) plot2d([discrete,treefale(n)], [style,dots])$
@end example

@opencatbox
@category{Package fractals}
@closecatbox

@end deffn

@deffn {Function} fernfale (@var{n})

4 contractive maps, the probability to choice a transformation must be related 
with the contraction ratio. Argument @var{n} must be great enougth, 10000 or greater.

Example:

@example
(%i1) load("fractals")$
(%i2) n: 10000$
(%i3) plot2d([discrete,fernfale(n)], [style,dots])$
@end example

@opencatbox
@category{Package fractals}
@closecatbox

@end deffn

@node Definitions for complex fractals, Definitions for Koch snowflakes, Definitions for IFS fractals, Top
@section Definitions for complex fractals

@deffn {Function} mandelbrot_set (@var{x}, @var{y})

Mandelbrot set.

Example:

This program is time consuming because it must make a lot of operations; 
the computing time is also related with the number of grid points.

@example
(%i1) load("fractals")$
(%i2) plot3d (mandelbrot_set, [x, -2.5, 1], [y, -1.5, 1.5],
                [gnuplot_preamble, "set view map"],
                [gnuplot_pm3d, true],
                [grid, 150, 150])$
@end example

@opencatbox
@category{Package fractals}
@closecatbox

@end deffn




@deffn {Function} julia_set (@var{x}, @var{y})

Julia sets.

This program is time consuming because it must make a lot of operations; 
the computing time is also related with the number of grid points.

Example:

@example
(%i1) load("fractals")$
(%i2) plot3d (julia_set, [x, -2, 1], [y, -1.5, 1.5],
                [gnuplot_preamble, "set view map"],
                [gnuplot_pm3d, true],
                [grid, 150, 150])$
@end example

See also @mref{julia_parameter}.

@opencatbox
@category{Package fractals}
@closecatbox

@end deffn



@anchor{julia_parameter}
@defvr {Optional variable} julia_parameter
Default value: @mref{%i}

Complex parameter for Julia fractals.
Its default value is @mref{%i}; we  suggest the  values @code{-.745+%i*.113002}, 
@code{-.39054-%i*.58679}, @code{-.15652+%i*1.03225}, @code{-.194+%i*.6557} and 
@code{.011031-%i*.67037}.

@opencatbox
@category{Package fractals}
@closecatbox

@end defvr





@deffn {Function} julia_sin (@var{x}, @var{y})

While function @code{julia_set} implements the transformation @code{julia_parameter+z^2},
function @code{julia_sin} implements @code{julia_parameter*sin(z)}. See source code
for more details.

This program runs slowly  because it calculates a lot of sines.

Example:

This program is time consuming because it must make a lot of operations; 
the computing time is also related with the number of grid points.

@example
(%i1) load("fractals")$
(%i2) julia_parameter:1+.1*%i$
(%i3) plot3d (julia_sin, [x, -2, 2], [y, -3, 3], 
                [gnuplot_preamble, "set view map"],
                [gnuplot_pm3d, true],
                [grid, 150, 150])$
@end example

See also @mref{julia_parameter}.

@opencatbox
@category{Package fractals}
@closecatbox

@end deffn

@node Definitions for Koch snowflakes, Definitions for Peano maps, Definitions for complex fractals, Top
@section Definitions for Koch snowflakes



@deffn {Function} snowmap (@var{ent}, @var{nn})

Koch snowflake sets. Function @code{snowmap} plots the snow Koch map 
over the vertex of an initial closed polygonal, in the complex plane. Here  
the orientation of the polygon is important. Argument @var{nn} is the number of 
recursive applications of Koch transformation; @var{nn} must be small (5 or 6).

Examples:

@example
(%i1) load("fractals")$
(%i2) plot2d([discrete,
              snowmap([1,exp(%i*%pi*2/3),exp(-%i*%pi*2/3),1],4)])$
(%i3) plot2d([discrete,
              snowmap([1,exp(-%i*%pi*2/3),exp(%i*%pi*2/3),1],4)])$
(%i4) plot2d([discrete, snowmap([0,1,1+%i,%i,0],4)])$
(%i5) plot2d([discrete, snowmap([0,%i,1+%i,1,0],4)])$
@end example

@opencatbox
@category{Package fractals}
@closecatbox

@end deffn

@node Definitions for Peano maps,  , Definitions for Koch snowflakes, fractals-pkg
@section Definitions for Peano maps

Continuous curves that cover an area. Warning: 
the number of points exponentially grows with @var{n}.

@deffn {Function} hilbertmap (@var{nn})

Hilbert map. Argument @var{nn} must be small (5, for example).
Maxima can crash if @var{nn} is 7 or greater.

Example:

@example
(%i1) load("fractals")$
(%i2) plot2d([discrete,hilbertmap(6)])$
@end example

@opencatbox
@category{Package fractals}
@closecatbox

@end deffn

@deffn {Function} sierpinskimap (@var{nn})

Sierpinski map. Argument @var{nn} must be small (5, for example).
Maxima can crash if @var{nn} is 7 or greater.

Example:

@example
(%i1) load("fractals")$
(%i2) plot2d([discrete,sierpinskimap(6)])$
@end example

@opencatbox
@category{Package fractals}
@closecatbox

@end deffn

