The program works and is fairly easy to read with the caveats that I had
to read the source to guess for the name of the main verb, and
experiment to find that mbrowse's arguments are ignored.
The "smoothing out after a few zoom steps" issue is caused by too few
iterations rather than insufficient floating point precision. I change
the right mouse button code to double ITERS. Since mbrot is implicit it
needs to be recreated after changing ITERS. Elsewhere mbrot appears in
explicit code where j reevaluates the definition of mbrot. Under the
new scenario zoom in with "left mouse", hit the "right mouse", then hit
the "left mouse".
w_g_mbrup =: 3 : 0 NB. right mouse button
ITERS =: +: ITERS
mbrot =: [: +/ 2 <&| ((+ *:) :: _:)"0^:(<ITERS) & 0
CENTER =: {. CENTERS
if. (# CENTERS) > 1 do. CENTERS =: }. CENTERS end.
repaint [ SCALE =: +: SCALE
)
Date: Sat, 2 Jan 2016 20:11:45 -0600
From: Michal Wallace<[email protected]>
To:[email protected]
Subject: [Jprogramming] feedback wanted for mandelbrowse tutorial
Message-ID:
<cae6hcjnpcr33azpxx9zvn7m0kispf743qwzffmcwbkbyf2i...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Hey all. Happy new year!
I made a small GUI app for a tutorial video I'm planning:
https://github.com/tangentstorm/mandelbrowse
It draws the mandelbrot set, and lets you zoom in and out.
I was hoping I could get some feedback on the code before I filmed anything.
In particular, you can only zoom in a few steps before the edge starts
smoothing out.
I think the problem has to do with lack of precision in J's complex number
type.
Is there anything I can do about this, other than implementing my own
complex
number type as a pair of extended precision numbers?
Thanks!
-Michal
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm