Code Samples :: Overview
The following pages depict some of Agena's main features:
The procedure mandelbrot determines whether a point [x, y] in the complex domain is part of the famous Mandelbrot set by determining whether it leaves a certain radius after a given number of iterations.
As can be seen in this example, the function first checks whether its first two arguments x and y are numbers. If the number of iterations iter has not been passed, the if unassigned .. statement sets the default to 128.
The procedure then converts the numbers x and y to the complex number z (sixth line of the procedure), sets a fixed point c (seventh line), and iterates z until either the stop value iter is reached or the while condition abs(z) < 2 evaluates to false.
The number of iterations conducted is returned (last but one line of the procedure).
The point [0, 0] is part of the Mandelbrot set ...
... even after 1024 iterations: