Hi all,
I'm back to windows ... (and be very careful if you have a dual OS on your machine -- the Linux GRUB is very hard to remove, I needed a boot CD to fix the MBR to start up in Windows again ).
OK, found something interesting that may be of interest (on
http://math.bu.edu )
I wrote it first in PLT Scheme and found there is no difference in operation time between an iterative and recursive definition of the fractal.
goes like this :
(define (juliaR x y rg ig it maxit orb)
(if (or (> orb 4.0) (= it maxit )) it
(juliaR
(- (* x x) (* y y) (/ (+ (* 2 ig x y) (* rg x x) (- (* rg y y))) (+ (* 4 x x y y) (sq (- (* x x) (* y y))))))
(- (* 2 x y) (/ (- (* ig x x) (* ig y y) (* 2 x y rg)) (+ (* 4 x x y y) (sq (- (* x x) (* y y))))))
rg ig (add1 it) maxit (+ (* x x) (* y y)))))
As this is only f(z)=z²-C/z² and these already need some pen and paper to convert into f(x,y) I switched to complex numbers.
To my surprise and working in Clozure Common Lisp unexpectedly there is almost no loss in processing time between real numbers and complex. !!!!
the complete formula simplifies into :
(defun juliaC (z c it maxit orb)
(if (or (> orb 4.0) (= it maxit )) it
(juliaC (- (sq z) (/ c (sq z))) c (1+ it) maxit (abs (* (realpart z) (imagpart z))))))
(where sq is definied as (defun sq (x) (* x x))
you can see I replaced (at the end) the usual |z| for testing the orbit escape limit with an hyperbolic criterium (gives nicer images
)
As there 're some poles in the formula it's even possible to ignore these by telling the compiler :
(set-fpu-mode :overflow nil :invalid nil )
it's very easy to expand the definition into any power of z -- prototyping can be done in minutes.
best Rob
.