This coloring UCL file is supposed to detect period of an orbit, and assign color index accordingly. Testing on plain mandelbrot set gives a noisy result (can't attach image here I guess, any color map, linear 0.1; values are in 0-20 range). I can see nothing wrong with the code and I have turned of guessing, normal periodicity checking, messed with tolerance, max iters, even tried extra decimals.

Error looks like something is not initialized or allocated.

Anyone have a clue?

Debug print shows reasonable values for zoomed out M-set, but not at the right locations.

Test1 {
init:
  int it = 0
  complex last_z = 0
  int k ;count period
  int kmax
  bool notDone = true
  float val = 0
loop:
  if(notDone)
    it = it + 1
    if(it==1)
       last_z = #z
       k = 0 
       kmax = 3;
    else
       k = k + 1
       if(|#z-last_z| <= @tol)
         notDone = false
         val = k
       else
         if(k == kmax)
            last_z = #z
            k = 0
            kmax = round(kmax*@perboost)
            if(kmax > @permax)
               kmax = @permax
            endif
         endif
       endif
    endif
  endif
final:
  $define DEBUG
  print(val)
  #index = val
default:
  title = "Test1"
  int param permax
    caption = "Max period"
    default = 100
  endparam
  float param perboost
    caption = "Perdiod increase factor"
    default = 2
  endparam
  float param tol
    caption = "Tolerance"
    default = 1e-100
  endparam
}
This coloring UCL file is supposed to detect period of an orbit, and assign color index accordingly. Testing on plain mandelbrot set gives a noisy result (can&#039;t attach image here I guess, any color map, linear 0.1; values are in 0-20 range). I can see nothing wrong with the code and I have turned of guessing, normal periodicity checking, messed with tolerance, max iters, even tried extra decimals. Error looks like something is not initialized or allocated. Anyone have a clue? Debug print shows reasonable values for zoomed out M-set, but not at the right locations. ```` Test1 { init: int it = 0 complex last_z = 0 int k ;count period int kmax bool notDone = true float val = 0 loop: if(notDone) it = it + 1 if(it==1) last_z = #z k = 0 kmax = 3; else k = k + 1 if(|#z-last_z| &lt;= @tol) notDone = false val = k else if(k == kmax) last_z = #z k = 0 kmax = round(kmax*@perboost) if(kmax &gt; @permax) kmax = @permax endif endif endif endif endif final: $define DEBUG print(val) #index = val default: title = &quot;Test1&quot; int param permax caption = &quot;Max period&quot; default = 100 endparam float param perboost caption = &quot;Perdiod increase factor&quot; default = 2 endparam float param tol caption = &quot;Tolerance&quot; default = 1e-100 endparam } ````
 
0
reply

Your code is correct in the sense that it will detect periods of an orbit. I think the problem is that the Mandelbrot set doesn't behave as nicely as you would like it to. It is true that any inside point will be attracted to a cycle of some period n. But "attracted to" a cycle doesn't mean the orbit of a point is actually cyclic; it just gets closer and closer to the cycle. This is probably easiest to visualize in the main cardiod, where the attractive cycle has period 1 (meaning it is a single point). The orbit of some point in the main cardiod will continually swing around the attracting point, but will never quite reach it. This is why you need the Tolerance parameter to specify how close a point needs to come to be part of a cycle.

But the closer the starting point is to the edge of the set, the longer it will take for the orbit to converge to the attracting cycle. There will always be a band around the edge of the set where you can't detect the period; the lower the Tolerance, the thicker the band. Inside from that band is another band of points where false cycles will be detected. Again, the lower the Tolerance, the thicker that band. If Tolerance is too small, the false positives dominate the image; I think this is what you are seeing with a Tolerance of 1E-100, which is far too small. I suggest a much higher value, such as 1E-5.

However there still a lot of false cycles detected as the orbit converges on the cycle. They appear as curved bands on the image. The canonical way to eliminate most of these is to skip some orbit points before looking for cycles. You could add another parameter for the number of orbit points to skip, but it's easier to just skip the first half of the orbit. In your code, change the line "if(it==1)" to "if(it<=#maxiter/2)".

Your code is correct in the sense that it will detect periods of an orbit. I think the problem is that the Mandelbrot set doesn&#039;t behave as nicely as you would like it to. It is true that any inside point will be attracted to a cycle of some period n. But &quot;attracted to&quot; a cycle doesn&#039;t mean the orbit of a point is actually cyclic; it just gets closer and closer to the cycle. This is probably easiest to visualize in the main cardiod, where the attractive cycle has period 1 (meaning it is a single point). The orbit of some point in the main cardiod will continually swing around the attracting point, but will never quite reach it. This is why you need the Tolerance parameter to specify how close a point needs to come to be part of a cycle. But the closer the starting point is to the edge of the set, the longer it will take for the orbit to converge to the attracting cycle. There will always be a band around the edge of the set where you can&#039;t detect the period; the lower the Tolerance, the thicker the band. Inside from that band is another band of points where false cycles will be detected. Again, the lower the Tolerance, the thicker that band. If Tolerance is too small, the false positives dominate the image; I think this is what you are seeing with a Tolerance of 1E-100, which is far too small. I suggest a much higher value, such as 1E-5. However there still a lot of false cycles detected as the orbit converges on the cycle. They appear as curved bands on the image. The canonical way to eliminate most of these is to skip some orbit points before looking for cycles. You could add another parameter for the number of orbit points to skip, but it&#039;s easier to just skip the first half of the orbit. In your code, change the line &quot;if(it==1)&quot; to &quot;if(it&lt;=#maxiter/2)&quot;.
 
0
reply

Yes if I include a warmup period (quite large, like 1000 iters for full M-set) results improve. Seems the orbits converge very slowly.

Yes if I include a warmup period (quite large, like 1000 iters for full M-set) results improve. Seems the orbits converge very slowly.
 
0
reply

If you haven't seen it yet, check out Samuel Monnier's Orbits coloring. It shows the orbit of a M-set point so you can see visually how it converges. http://www.p-gallery.net/help/variouscol.htm#orbits

If you haven&#039;t seen it yet, check out Samuel Monnier&#039;s Orbits coloring. It shows the orbit of a M-set point so you can see visually how it converges. http://www.p-gallery.net/help/variouscol.htm#orbits
 
0
reply
120
views
3
replies
2
followers
live preview
Enter at least 10 characters.
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft