External rays & Lavaurs algorithm
2 minutes read | 347 words by Ruben BerenguelAs you may remember, I spent quite some time this August with Lavaurs algorithm for the topological identification of the circle corresponding to the Mandelbrot set. After that, I spent quite some more trying to do pictures of external rays to show side by side. I was not able… and then found Mandel.
Really nice program, with lots and lots of options (and I met the programmer, which happens to be also mathematician, we met at a conference). I asked if there was some whay to draw all rays in one step, as it stands I needed to press “e”, enter the rational number corresponding to the ray, and enter. “No, you should change the source… probably the best way was to do it by hand if there are not too many rays”.
I though No way! I don’t want to do it by hand, neither mess with someone else’s code… I am teaching a class of computer things, and I must look at too much C code.
I wrote a LISP program that, given a level uses my Lavaurs code to generate a shell script in Mac OS (full of command line AppleScript) such that the needed keystrokes are sent to the Mandel application.
The code is as follows
(defun GenerateScript (Num)
(progn
(format t "open -a mandel.app;~%")
(format t "osascript -e 'delay 0.1';~%")
(format t "osascript -e 'tell application \\"System Events\\" to keystroke \\"5\\"';~%")
(format t "osascript -e 'delay 0.1';~%")
(format t "osascript -e 'tell application \\"System Events\\" to key code 99';~%")
(format t "osascript -e 'tell application \\"System Events\\" to keystroke \\"600\\"';~%")
(format t "osascript -e 'tell application \\"System Events\\" to keystroke return';~%")
(format t "osascript -e 'delay 0.9';~%")
(dotimes (n Num)
(dolist (X (PeriodK n))
(progn
(format t "osascript -e 'tell application \\"System Events\\" to keystroke \\"e ~A\\"';~%" X)
(format t "osascript -e 'tell application \\"System Events\\" to keystroke return';~%")
)))))
This opens Mandel, changes resolution and drawing algorithm and sends all rays. And you can see the results in the beginning of the post.