julia1=:4 : 0
scale=.1.5
jx=.scale*((-:DIM)-x)%-:DIM
jy=.scale*((-:DIM)-y)%-:DIM
c=._0.8j0.156
a=.jx j. jy
<:{:((c + *:)@{. ,>:@{: )^:(1000 > |@{.)^:256 a,0
)
But I would prefer a rank _ approach
juliaB=: 3 : 0 NB. rank _ on a square of side y
scale=.1.5
k=. scale * 1 - (i. % -:)y NB. avoid the use of j and i
c=._0.8j0.156
a=. j./~ k
b=. 0 $~ y,y
for_r. i.256 do.
a=. c+ a * a
b=. b + r * 1000 < | a
a=. a * -.*b
end.
b=. b + 255 * 0 = b
)
(julia"0 0/~ -: julia1"0 0/~)i.DIM=:100
1
(juliaB DIM) -: (julia1"0 0/~)i.DIM=:100
1
R.E. Boss
> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Jan Jacobs
> Verzonden: vrijdag 12 augustus 2011 15:02
> Aan: [email protected]
> Onderwerp: [Jprogramming] julia fractal
>
> ls,
> I'm preparing a course on GPU programming (NVIDIA's parallel graphics
> processor) for bachelor students using J. I have a need for a more tacit
form
> of a julia fractal than the one shown below, which is too much C-like.
> Suggestions are welcomed.
> Thanks in advance,
> Jan.
>
>
> load'graph'
> DIM=:400
>
> NB. Julia function
> julia=:4 : 0
> scale=.1.5
> jx=.scale*((-:DIM)-x)%-:DIM
> jy=.scale*((-:DIM)-y)%-:DIM
> c=._0.8j0.156
> a=.jx j. jy
> i=.0
> while. i < 256 do.
> a=.(a * a) + c
> if. 1000 < | a do. i return. end.
> i=.i + 1
> end.
> 255
> )
>
> viewmat (i.DIM)julia"0 0/ (i.DIM)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm