NB. J script to duplicate Fig 3 from
NB. Views of Fibonacci Dynamics
NB. by Cliff Reiter
NB. Requires Jsoftware and the image3 addon.
NB. www.jsoftware.com

NB. change path if addon is installed elsewhere
load 'addons\image3\view_m.ijs'

NB. the Golden ratio
gr=:-:1+%:5

NB. Binet formula
fib=: [: (%%:5)&* gr&^ - (-%gr)&^

NB. Function to give rectangular region of complex values
zl_cccr=: 4 : 0
w=.--/y.
({.y.)+w*((i:%j.) +/ (i:%])) <.-:x.
)

NB.  The escape time algorithm
ESC=:1 : 0     NB. fct arg is "T"
sigs=.(>:@{. , u.@{:) :: (>:@{. , _:)
sigl=.sigs^:(({. < 512"_)*. ( |@{: < 1e10"_))^:_
({.@sigl@(0:,]) f. )"0
)

NB. A pallete
pal=:0,Hue ^&0.5 (i.%<:)4095

NB. compute the array of z values
z=:200 zl_cccr 0 6

NB. compute the array of escape times
et=:z2=:(*512&~:) fib ESC z

NB. create and view image
view_image pal;et