Kali
|
|
« on: February 11, 2011, 02:54:51 PM » |
|
I have this idea of animating self-similar parts of the mandelbrot set, to see better how they evolve as they change slightly when you dive deeper into the set, perhaps producing some interesting results. But I need some help from some of the math geniuses here... how can I get "reference points" in a relative easy way, to know the coordinates of correspondence between each similar shape? (for example, each "seahorse" of the seahorse valley). Otherwise I have to do it "by hand", and the results will be limitated by my patience and free time (I don't have much of both )
|
|
« Last Edit: February 11, 2011, 02:58:47 PM by Kali »
|
Logged
|
|
|
|
David Makin
|
|
« Reply #1 on: February 11, 2011, 09:40:39 PM » |
|
If I understand you correctly then all I can think of that may help is the following:
Most (maybe all ??) fractal objects consist of individual points (or areas/volumes) that correspond to a given "genetic code". With standard (convergent) IFS the code is reversed with respect to rendering using the escape-time method - with convergent IFS-style rendering the code for a given point is such that the *most* significant transform used is the *last* one but in the escape-time (divergent) method then the most significant transform is the *first* one. Consider rendering a Sierpinski Triangle using the standard convergent IFS method, if we have a point "on" the fractal and apply to that point the transform corresponding to the top sub-triangle of the whole then the new point will be part of that top sub-triangle, if we then apply the transform for the bottom-left sub-triangle to the new point then the result will be within the bottom-left sub-triangle and so on. However the case is a little different for using the escape-time method, here if we have a point that is "on" the fractal and in the top triangle of the 3 main sub-triangles then in a/any sequence that does not bail out for that point the first transform will be the one for that top sub-triangle and if the point is in the bottom-left sub-triangle of the top sub-triangle then the second code in the sequence will be for the transform corresponding to the bottom-left triangle and so on.
You may be wondering how the above helps answer your question, but please bear with me, I'll get there in the end...
With respect to a non-affine fractal things are slightly different, for instance you might think there's no "genetic code" to be associated with iterating z^2+c using the escape-time method but that's not correct, you just need to do a little extra work to get the code/s. If you remember either the entire orbit (for a given pixel) or just the first n steps of the orbit then you can get either "iteration count" minus one or "n" minus one genetic codes - for z^2+c there are two possible codes per iteration, either the *backwards* orbit was +sqrt(z-c) OR -sqrt(z-c) and you can simply check your stored orbit values to see which was the case giving you a genetic sequence for that pixel position.
Further lets say we have a genetic code of 11100111001111 for a point on a z^2+c fractal then a point with code 00011100111001111 is self-similar to 14 iteration levels and 3 iteration levels deeper.
To be honest I'd realised the above a while ago but hadn't fully considered the possibilities it opens up until I wrote this reply. Of course some non-affine formulas would be a hell of a lot more difficult to decode due to it being very difficult to decide which was the correct genetic code working backwards through the orbit.
|
|
|
Logged
|
|
|
|
Kali
|
|
« Reply #2 on: February 11, 2011, 10:25:55 PM » |
|
Thank you very much David, I think I get the point. But if i'm getting it right, I have to search & test a huge amount of points... but perhaps finding a small amount of self similar points by using this method, I can "decode" a simpler way to obtain more of them. For example, doing a calculation based on previous results, and looking for the "genetic code" inside a small area where the new similar point it's likely to occur. I'll give it a try. Thanks again!
|
|
|
Logged
|
|
|
|
David Makin
|
|
« Reply #3 on: February 12, 2011, 03:35:39 AM » |
|
Of course I should have mentioned I was thinking of the problem from the point of view of an algorithmic solutiion i.e. to use a program to decode the genetics of the image and thus find corresponding points on self-similar areas e.g. store the codes for a given area of the fractal and maybe also provide this as a visual such that the user can then chose a point and the program will then highlight corresponding self-similar points at different iteration levels. e.g. the user selects a point with code 1101100 and the program highlights all point with codes ending 1101100 (or just those ending in 01101100 or 11101100 or 001101100 or 011101100 or 101101100 or 111101100 etc.)
|
|
|
Logged
|
|
|
|
Kali
|
|
« Reply #4 on: February 12, 2011, 10:43:16 AM » |
|
Yes, of course... When I wrote "I have to test and search for a huge amount of points", I mean MY PROGRAM has to do it. Otherwise you could be thinking of just me trying to do it by hand with a pen and a calculator Honestly, It's hard for me to fully express my ideas in english What I'm trying to say is that the computation time will be long if I want to find the points deep into the set without looking also for another kind of "rule" that predicts where the point is likely to occur, based on previous results...
|
|
|
Logged
|
|
|
|
David Makin
|
|
« Reply #5 on: February 12, 2011, 02:59:02 PM » |
|
Well I haven't actually tested it in detail but for a 2D complex fractal then a given genetic code sequence (starting with that for the first iteration as the most significant) represents a given area e.g. for the z^2+c Mandelbrot then if all start points with positive imaginary component have genetic code 0 for the first iteration then all start points with negative imaginary component will have genetic code 1, similarly codes 00, 01, 10 and 11 (I think) will define 4 specific areas, a 3 bit code (3 iterations) == 8 areas etc.
The simplest case for the standard z^2+c Mandelbrot is of course the point (-2,0) for which the orbit immediately goes to the point attractor (2,0) on the first iteration - here the genetic code is 0111111111..... (or 100000000..... depending on how you code it) so any points with genetic codes of the form xx...xx011111111.... should be at the sharp end of minibrots (where the leading number of bitcodes gives the "depth" of the minibrot - from 1 bitcode to as many as you can get accurately).
|
|
|
Logged
|
|
|
|
Kali
|
|
« Reply #6 on: February 12, 2011, 03:26:33 PM » |
|
I'll test your method later today and I'll keep you informed of the results... I think is a really clever solution to encode the points that way. I appreciate your help. Thanks!
|
|
|
Logged
|
|
|
|
|
Kali
|
|
« Reply #8 on: February 13, 2011, 05:21:09 PM » |
|
Nice, David! I'm trying to do it on VB, but there's something I'm doing wrong... I'm not using a complex number library, so I must calculate separated real and imaginary parts I tried this inside the iteration part, but it doesn't work properly: ' Save old values: zr2 = zr zi2 = zi
' Calculate new values: zr = zr * zr - zi * zi + x zi = 2 * zr2 * zi + y
' Calculate z-c: dr = zr - x di = zi - y
' Calculate sqrt(z-c) rr = Math.Sqrt((Math.Sqrt(dr * dr + di * di) + dr) / 2) ri = Math.Sqrt((Math.Sqrt(dr * dr + di * di) - dr) / 2)*Math.Sign(ri)
' See if the results are equal than previous iteration value (otherwise the sign has changed), and then write the genetic code If zr2 = rr and zi2 = ri Then gen(x, y) = gen(x, y) + "1" Else gen(x, y) = gen(x, y) + "0" End If
|
|
« Last Edit: February 13, 2011, 05:46:00 PM by Kali »
|
Logged
|
|
|
|
Kali
|
|
« Reply #9 on: February 13, 2011, 06:04:27 PM » |
|
There was a precision problem when I tested if the values from the previous iteration are exactly the same. I'm checking now only for the signs and I'm getting well definited areas and not diffuse patterns like before, but I'm not pretty sure they are right. I'll check the code a little bit more and then I'll upload some images of the results...
|
|
« Last Edit: February 13, 2011, 06:06:48 PM by Kali »
|
Logged
|
|
|
|
David Makin
|
|
« Reply #10 on: February 14, 2011, 01:03:09 AM » |
|
There was a precision problem when I tested if the values from the previous iteration are exactly the same. I'm checking now only for the signs and I'm getting well definited areas and not diffuse patterns like before, but I'm not pretty sure they are right. I'll check the code a little bit more and then I'll upload some images of the results...
Ah - for the precision issue, in the image posted I actually used (here in pseudo-code): if (magsquared(zold-ztest)>magsquared(zold+ztest)) Where ztest is sqrt(z-c) or sqrt(zold^2). Which takes slightly longer obviously but completely eliminates any worries regarding precision error on an equality, even if the values of zold and ztest are very small indeed. Of course the conditional ">" could be either way, it's not that essential since in this case it just reverses the binary code. Also your code could be optimised: ' Save old values: zr2 = zr zi2 = zi
' Calculate z-c: (of course is actually just zold^2) dr = zr*zr - zi*zi di = 2*zr2*zi
' Calculate new values: zr = dr + x zi = di + y
' Calculate sqrt(z-c) rr = Math.Sqrt((Math.Sqrt(dr * dr + di * di) + dr) / 2) ri = Math.Sqrt((Math.Sqrt(dr * dr + di * di) - dr) / 2)*Math.Sign(ri)
' See if the results are equal than previous iteration value (otherwise the sign has changed), and then write the genetic code If zr2 = rr and zi2 = ri Then gen(x, y) = gen(x, y) + "1" Else gen(x, y) = gen(x, y) + "0" End If
|
|
|
Logged
|
|
|
|
Kali
|
|
« Reply #11 on: February 14, 2011, 11:59:22 AM » |
|
Thanks again, David. As for the optimization, I don't know what I was thinking when I calculated +x +y and then back to -x -y to get the previous value
|
|
|
Logged
|
|
|
|
Kali
|
|
« Reply #12 on: February 19, 2011, 03:25:51 AM » |
|
I put this project on stand-by... but if anyone has another good idea as David had, they are welcomed!
|
|
« Last Edit: February 19, 2011, 04:57:31 AM by Kali »
|
Logged
|
|
|
|
|