1 ( --- Complex arithmetic --- )
3 ( Location of floating point. )
16 ( Redefine multiplication. Yay forth! )
19 : c* ( x1 y1 x2 y2 -- x3 y3 )
20 swap -rot ( x1 x2 y1 y2 )
21 2dup * negate ( x1 x2 y1 y2 -y1y2 )
22 4 pick 4 pick * + ( x1 x2 y1 y2 (x1x2-y1y2))
23 4 roll 2 roll * ( x2 y1 (x1x2-y1y2) x1y2 )
24 3 roll 3 roll * + ( (x1x2-y1y2) (x1y2+x2y1) )
27 : c+ ( x1 y1 x2 y2 -- x3 y3 )
36 : conj ( x y -- x -y )
40 : cmagsq ( x1 y1 -- mag )
44 ( --- Mandelbrot set calculations --- )
46 : iterate ( cr ci zr zi -- cr ci z'r z'i )
52 : inSet? ( cr ci -- res )
55 true ( flag indicating set membership )
69 ( Clear z and c, leaving set membership flag )
76 ( Draw the Mandelbrot Set!)
77 : mandeldraw ( x1 y1 x2 y2 -- )
79 0 pick 3 pick - ysteps /
82 2 pick 5 pick - xsteps /
100 ( Clean up - hide non-standard multiplication def. )
105 -2 0 >scaled -1 0 >scaled 0 5 >scaled 1 0 >scaled
109 .( Enter 'mandel' to draw the Mandelbrot Set.)