Optimization of Mandelbrot calculation



On 4/30/09, Maximilian Kreuter <maxx at 2097.com> wrote:

>             for i:1 step 1 thru iterations while absZ < 4 do [
>                 reTemp:reZ^2 - imZ^2 + x,
>                 imZ:2*reZ*imZ + y,
>                 reZ:reTemp,
>                 absZ:reZ^2+imZ^2
>             ],

Enclosing the loop body in [ ] is valid Maxima syntax,
although the effect might be a little different than you expected.
block(a, b, c) or (a, b, c) group together expressions to be
evaluated sequentially, while [a, b, c] constructs a list.
Maxima evaluates list elements in order, so in this case
for ... do [a, b, c] has the same effect (fortuitously) as
for ... do (a, b, c). My advice is to write (a, b, c) unless you
really mean to construct a list.

best

Robert Dodier