I'm trying to plot some of the mandelbrot set. My implementation is
discouragingly slow, are there any faster implementations in J?
NB. pixelx0, pixely0, pixelx, pixely, pixelx2, pixely2, iterations
NB. functions to extra parts
ext_x0y0 =: 0 1&{
ext_xy =: 2 3&{
ext_x0 =: 0&{
ext_y0 =: 1&{
ext_x =: 2&{
ext_y =: 3&{
ext_x2 =: 4&{
ext_y2 =: 5&{
ext_it =: 6&{
ext_x2y2 =: 4 5&{
sum_sq =: +/@:*:
next =: ext_x0y0 , (ext_x0 + ext_x2 - ext_y2) , (ext_y0 + +: @: (*/) @:
ext_xy) , 0 , 0 , >:@:ext_it
next2 =: 4&{. , (*:)@:ext_xy , {:
main =: (]`(next2@:next) @. ((sum_sq @: ext_x2y2 < 4:) *. ((<&1000) @:
ext_it)) f.)"1
fmt =: ((4&$) , *: , 0:)"1
load 'viewmat'
NB. main^:50 means iterating 50 times, so maximum of 50 "shades"
viewmat 100 100 $ {:"1 main^:50 fmt"1 ;<"2 (,"0 0"0 1)~ 100 %~ i. 100
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm