init:
z = #pixel
float b = 1/@bailout
float b2 = b*b
complex zz = z
loop:
complex oz = z
complex zd = 1
int i = 1
WHILE (i < @numi)
i = i + 1
zd = 2*zd*z + 1
z = sqr(z) + oz
IF (|zd| > @bailout)
i = @numi
ENDIF
ENDWHILE
; z is now m(oz) and zd is m'(oz), with m(x) = (x^2+x)^2+x...
z = oz - (z/zd) ; Apply Newton's method once
IF (@zeroinside)
IF (|z| < b2)
z = zz ; Trap z
ENDIF
ENDIF
bailout:
|z - oz| > b
default:
title = "Mandelnewton Julia sets"