Array Programming the Mandelbrot Set
jcmorrow.com·3h·
Discuss: Hacker News
Flag this post

Array Programming the Mandelbrot Set

home

Years ago, when I was learning the J programming language I wrote the mandelbrot set:

load 'viewmat'

mandelbrot =. ([ + ^&2)
mandel_iter =: (|)@:(mandelbrot/\.)@:([ # ])
range =. (i.@:(1&+)@:(*&2) - ])
grid =. ({. (,"0)/ {.)@:(range "0)@:(2&#)

pixels =. (2&>)@:(25&mandel_iter)@:(-&0.5)@:j./@:(0.01&*) L:0 <"1 grid 100

viewmat > +/ L:0 pixels

As is often the case with array programming, I revisited this last week only to realize I couldn’t read it. I considered revisiting it to brush up on J, but in more recent times I’ve been doing my array programming in Uiua. While I’m also rusty at Uiua these days, I thought that a translation would be a more i…

Similar Posts

Loading similar posts...