The basic algorithm for creating escape-time fractals with Maple V has the following general form:

```
> fractal := proc(x, y)
>    local c, p, m, z;   # with c & p being optional
>    p := evalf(a+I*b);  # optional
>    c := evalf(x+y*I);  # optional
>    z := evalf(x+y*I);  # obligatory
>    for m from 0 to max_iterations while condition(z) do
>       z := iteration_formula
>    od;
>    fn(m)
> end:

> plot3d(0, x_range, y_range, further plot options,
>    grid=[resolution, resolution],
>    color=fractal);

```
You can view various regions of the fractal by changing the values for 'x_range' and 'y_range' in the plot3d command.

To alter the accuracy of the fractal computation change the value of 'max_iterations'. Higher integers result in a more 'precise' fractal with more features and a corresponding longer computation time whereas lower values do the opposite.

With 'condition(z)' you can determine the bailout value dependent on z at which the loop is exited. For example in the Mandelbrot procedure if the value of z exceeds the range 2 it means that the point evaluated is not part of the Mandelbrot set. The range is determined by the formula of Pythagoras:

range := sqrt(Re(z)^2 + Im(z)^2) <= bailout

with m the return value of the procedure. m determines the color a point is set in the plot according to the number of iterations it took z to satisfy the condition and thus whether this point belongs to the fractal set or not. If 'm=max_iterations' after the completion of the loop then it is probable that the point z is part of the fractal set. For example, the red color of the Mandelbrot lake shows that this area constitutes the Mandelbrot set. (However the red border of the image is not part of it.) m can be modified by applying a function fn to it so that the color is different, e.g. 'ln(m)', 'm/2', or 'cos(m)'.

Change the iteration_formula in the loop on your own to create new fractals. For example I created the BIOMORPH2 fractal by adding 'cos(z)' to 'z:=z^2+c'. Certainly it is possible to create completely different formulas. The longer the formula the longer is its evaluation, especially `non-polynomial` functions can increase computation time.

Initialization is done by 'z:=evalf(x + I*y)'. x and y are values passed to the procedure with the call to plot3d and represent the coordinates of a point in the plane. You can also define one or more constants 'c' and/or 'p[n]' to be part of the iteration formula where c is a constant being assigned (x, y) with each call of the procedure fractal, and p[n] a fixed point defined by the coordinates (a, b) that never changes. An example of this modification is shown in the LAMBDAFN function:

```
> [...]
>    p1:=evalf(1+I*0.4);
>    m:=0;
>    to 100 while abs(z)<4 do
>       z:=sin(z)*p1;
> [...]

```
You can change the resolution of the plot by changing the values for the grid option in plot3d. The larger the values the better the resolution and the longer Maple V takes to complete the calculation. You should set them to smaller integers to avoid wasting time when experimenting with own formulas to create test images of your fractals and to determine whether it is worth plotting a more accurate image with larger values for the grid option. Sometimes a plot may be completely blank. Users of the Student Editions of Maple V must not exceed the built-in limitation of 5120 points in a grid, so the values of 'grid' cannot be greater than 71 x 71 elements.

You can also embed the image into the worksheet and save the worksheet to disk to avoid 'suffering' the complete computation again. (Maple V Release 4 embeds plots into the worksheet by default.)

MAPLE V FRACTALS Explanation #1.02 current as of May 23, 1999
Author: Alexander F. Walz, alexander.f.walz@t-online.de
Original file location: http://www.math.utsa.edu/mirrors/maple/mfrexpl.htm