News: Visit UltraFractalWiki for hints & tutorials on UltraFractal5
 
*
Welcome, Guest. Please login or register. October 31, 2014, 05:06:58 PM


Login with username, password and session length



Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: What range/precision for fractional escape counts for Mandelbrot/Julia sets?  (Read 2395 times)
0 Members and 1 Guest are viewing this topic.
Duncan C
Fractal Fanatic
****
Posts: 347



WWW
« on: April 25, 2007, 09:59:37 PM »

I'm interested in supporting fractional escape counts for coloring the exteriors of Mandelbrot and Julia sets. Typically this is done using the log log of the magnitude of the escape value for a point:

mu = N + 1 - log (log  |Z(N)|) / log 2

Where N is the integer escape count, Z(N) is the complex value of the last iteration of the function when it reaches the escape threshold, |Z(N)| is the magnitude of the escape value { Z(N) = a+bi;  |Z(N)| = sqrt(a^2 + b^) }

What is the range of the values you get from this function, and how much precision do you need in order to create smoothly shaded plots with lots of color gradiation? (Right now I use integer escape values to color my plots, and assign a unique color value to every escape value, up to 65535 unique colors)

I was thinking of using 32 bit fixed point values for the fractional escape value (+- 2^15 + (2^16 - 1) / 16). That would let me represent numbers as large as 32767 and as small as about 1.53E-5. Alternately, I have available a "Fract" data type that is a 32 bit quantity with a 2 bit signed integer component and 30 bit fraction, which would let me handle numbers in the range of about +-4 to roughly 9.3E-10.


Duncan C
Logged

Regards,

Duncan C
juharkonen
Forums Freshman
**
Posts: 17


« Reply #1 on: May 01, 2007, 10:34:30 AM »


The fractional (or smooth) iteration count is given by the equation

mu = N + 1 + log( log(M) / log|z(N)| ) / log(p),

where
N is the iteration count
M is the bailout value
p is the power in the iterated equation z(n+1) = z(n)^p + c

The decimal part 1+log( log(M) / log|z(N)| ) / log(p) is in the range [0,1].

The smooth iteration count has discontinuities at the iteration boundaries. However, the discontinuity is very small for, say, M = 5, and decreases for larger bailouts. About the preferrable number presentation, I propose that you try the usual float or double and see if you encounter any problems with accuracy.

You can find a rather difficult to follow discussion of the smooth iteration count here:
http://linas.org/art-gallery/escape/escape.html
A more thorough discussion will be included in my soon-to-be-finished master's thesis on fractal coloring functions.

Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2269



Makin' Magic Fractals
WWW
« Reply #2 on: May 01, 2007, 12:22:43 PM »

Most colouring formulas in Ultrafractal use:

smooth iter = iter + 1 + (log(log(bailout) - log(log(cabs(#z)))) / log(p)

(-1 corrected to +1 1st May '07)

Which I believe is slightly more accurate than:

mu = N + 1 - log (log  |Z(N)|) / log 2

Note that log(log(bailout)) can be pre-calculated so this method is only slightly slower in practice.

Also note that instead of using a user-supplied (or preset) value for the power p you can instead use a calculated value.
p is just an estimate of the degree of divergence and the degree of divergence can be calculated as log(cabs(final z))/log(cabs(penultimate z))
Doing so obviously slows calculation down but it means that the iteration smoothing works even at low bailout and for formulas where the degree of divergence varies acrosss the fractal - such as the Novas - and even for fractals such as the Barnsleys.
It also means that the only user-parameter required for correct smoothing is the bailout value.

« Last Edit: May 01, 2007, 10:19:10 PM by David Makin » Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Duncan C
Fractal Fanatic
****
Posts: 347



WWW
« Reply #3 on: May 01, 2007, 03:28:51 PM »

ok i skipped over the derivation of my formula last time, but since people seem to still be really attached to their sqrt computations, here it is in full:

log(log(x^1/2)) =
log(log(x)/2) =
log(log(x)) - log(2)

and since we have in the original expression log(log(x^1/2)) / log2 we get by substitution (log(log(x)) - log2) / log2 = log(log(x))/log2 - 1, and that - 1 cancels with the + 1, making the whole formula seem a lot more natural too. 1/log2 can and should be precomputed, since it is a constant (divides are two orders of magnitude slower!).

in most forums i'm on, simplifications and speedups are welcomed with open arms...

btw david, thanks for your insightful post!

I do indeed greatly appreciate the speedup. Thanks a million.

Things like converting division to reciprocals, factoring out constants, etc are quite straightforward. Factoring out the square root is one that hadn't occurred to me. It's been far too long since I did much higher math. My bread-and-butter development doesn't use much floating point at all, for that matter.


Duncan C
Logged

Regards,

Duncan C
Duncan C
Fractal Fanatic
****
Posts: 347



WWW
« Reply #4 on: May 01, 2007, 08:23:13 PM »

I do indeed greatly appreciate the speedup. Thanks a million.

always happy to make a contribution! those opportunities are few and far between for me :/

about fractals and maths: i recently had a chat with a good friend of mine (who is one hell of a fractalist) about this. he could also would benefit from a stronger mathematical grounding, however that's hardly hindered him! it turns out that when working with fractals, quite often you can pretty much do what you like and still get awesome looking results cheesy (an obvious corollary is that researchers tend to have boring images *dodges a thousand hurled chalkboard dusters*.) such a truth is completely unavoidable, so the only defense i could make for poor old mathematics at that stage is "knowing which rules you're breaking can give you more perspective and therefore power". however, it occurs to me now (returning to the matter at hand) that it has a further use, namely simplifying expressions*.

i referred him to this great website i found some years ago, S.O.S math (lol): http://www.sosmath.com/algebra/algebra.html

feel like you dozed too much during high school maths classes? get in line! wink the above site is really nice and concise, highly recommended. it goes deeper than just algebra and i still find some use for it now and then (it's great to finally master things i floundered with earlier).


* things like sqrt(x) < const, and the simplification given earlier are two such examples.

Actually math and science were my favorate, and best, subjects in high school, so they were the subjects where I was most awake. Still, I don't have much call for dealing with complex numbers or solving for derivatives in day-to-day life, so those skills have gotten a little rusty with the passing years. Your insight is appreciated.

That site is great. It goes from elementary to intermediate level in nice easy steps. I found the discusssion on polar coordinates for complex numbers very helpful, for example. That's a concept I haven't been clear on until now.


This thread is actually related to another thread I started in the Mandelbrot/Julia area. I wonder if you folks could chime in there. Specifically, I posted a question about the log-log approach to distance estimation as compared to the distance estimator algorithm documented in the book "The Science of Fracal Images." Here's the thread:


How are B&W images from "Beauty of Fractals" created?

specifically my post "reply #8", dated 5/1/07.


Duncan C
Logged

Regards,

Duncan C
Pages: [1]   Go Down
  Print  
 
Jump to:  



Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.317 seconds with 29 queries. (Pretty URLs adds 0.013s, 2q)