rendering bifurcation diagrams

  • 11 Replies
  • 328 Views

0 Members and 1 Guest are viewing this topic.

Offline claude

  • *
  • 3c
  • ***
  • Posts: 895
    • mathr.co.uk
« on: October 30, 2018, 07:47:18 AM »
hacking on some bifurcation diagram rendering code I came up with this formula that gives uniform appearance with a quality control:

iterations = density * height / bifurcationFactor ^ (log xViewSize / log xScalingFactor)

iterations is the number of times to iterate (and attempt to plot x of) the logistic map function x := a x (1 - x)
density is the desired average number of samples plotted per output pixel, 10 is lofi, 1000 is hifi.
height is the height of the image in pixels
bifurcationFactor (eg 2.0) is how many times features repeat when zooming in by xScalingFactor (eg second Feigenbaum constant 2.5029...)
xViewSize is the diameter of the view: x_max - x_min.

with this formula, I can achieve useful control of the image quality with the density parameter.

the final colouring is done with this formula, where exposure is a constant (eg 0.5):

pixel = log2(1 + count * exposure / density)


another thing that slightly improves quality is to spill the increment into 2 bins according to the distance from the bin center (triangular window).  use float accumulation buffer.

finally for anti-aliasing I vary 'a' across a small range centered on the pixel coordinate, to make the thin lines have a uniform aspect ratio I set this 'a' radius +/-1 pixel (diameter 2, like the bin spread).

the cost of rendering each frame of this zoom animation is:
O(width * height * density * xsize ^ (log 2 / log feig2)) = O(width * height * density * feig2 ^ (2 * frameNumber / frameCount * log 2 / log feig2)) = O (width * height * density * 4 ^ (frameNumber / frameCount))

wolfram alpha tells me the total cost of the animation is
O(width * height * density * 3 / (4 ^ (1/frameCount) - 1))

One sample animation (without disk IO, just for benchmarking) took 16.4 seconds at 384 * 216 * 100 * 3 / (4 ^ (1/100) - 1) ; so a more precise formula for wall-clock time per animation on my CPU is:
seconds = 9.2e-9 * width * height * density * 3 / (4 ^ (1/frameCount) - 1)

Offline claude

  • *
  • 3c
  • ***
  • Posts: 895
    • mathr.co.uk
« Reply #1 on: October 30, 2018, 08:01:44 AM »
the formula for iterations depends on height, so rendering bigger gives roughly the same grey level.  only details are sharper.

these are all downscaled to the same size, with exposure 0.25 and density 100

Offline claude

  • *
  • 3c
  • ***
  • Posts: 895
    • mathr.co.uk
« Reply #2 on: October 30, 2018, 09:45:35 AM »
zooming into the limit of "the period 3 island in the antenna of the (...) period 3 island in the antenna", speaking in Mandelbrot set terms. 
https://mathr.co.uk/mandelbrot/web/#!q=-1.786440256022461481+0i@1e-8

in the logistic map this translates to:

aOrigin = 3.854077963912311500
xOrigin = 0.5
aFactor = 55.24708962751378039
xFactor = 9.277343959121408190
nFactor = 3

needs two zooms as xFactor is really negative

Offline claude

  • *
  • 3c
  • ***
  • Posts: 895
    • mathr.co.uk
« Reply #3 on: October 30, 2018, 10:51:25 AM »
recentered/rescaled version, with the period tripling more obvious

Offline Fraktalist

  • *
  • Administrator
  • *******
  • Strange Attractor
  • Posts: 1017
« Reply #4 on: October 30, 2018, 10:55:37 AM »
 :thumbs: :yes:

Offline v

  • *
  • Fractal Fanatic
  • ***
  • Posts: 31
« Reply #5 on: October 30, 2018, 11:54:44 PM »
very nice work.  I've been interested in these plots, especially producing good quality zooms for things like x:=ax(1-x)^2 where I believe there is an embedded bifurcation diagram of the original ax(1-x) inside despite it being a lot more complex, pictured. Produced by:

Code: [Select]
for u=1 to 640
uu=5.8 + 1.2*u/640
for x=0 to 480
xx = x/480
for i=0 to 500
xx = uu*xx*(1-xx)^2
next
pset (2.5*u,2.5*480*(1-xx)-500)
next
next


Offline lkmitch

  • *
  • Fractal Friend
  • **
  • Posts: 17
« Reply #6 on: October 31, 2018, 04:52:39 PM »
When you want to render an image for printing (say), I find that a good way to thicken up the lines (because individual pixels are too small at print resolution) is to smear the image a small amount. I do this by rendering several different versions, each with slightly different window locations (same zoom) and then averaging them together. That's what I did with my image, "Bifurcation."

http://kerrymitchellart.com/gallery24/bifurcation.html

Offline pauldelbrot

  • *
  • 3c
  • ***
  • Posts: 847
« Reply #7 on: October 31, 2018, 05:08:31 PM »
there is an embedded bifurcation diagram of the original ax(1-x) inside despite it being a lot more complex

Those are basically minibrots, seen in a different way than usual, so yeah, they'll be everywhere in every formula that has critical points with no multiplicity.

Offline claude

  • *
  • 3c
  • ***
  • Posts: 895
    • mathr.co.uk
« Reply #8 on: November 01, 2018, 02:14:19 AM »
I find that a good way to thicken up the lines (because individual pixels are too small at print resolution) is to smear the image a small amount.

I would probably do it with a Gaussian blur of the histogram before doing the logarithmic colouring.

Offline claude

  • *
  • 3c
  • ***
  • Posts: 895
    • mathr.co.uk
« Reply #9 on: November 01, 2018, 02:57:10 AM »
http://abacus.bates.edu/~sross/ the lines are also "Q-curves" which could be plotted directly...

edit actually after thinking more, I think they are close to Q-curves but not quite (the image would have lines at limit cycles reachable from the critical point 0.5, rather than the just the n'th iterate for the n'th Q curve).
« Last Edit: November 01, 2018, 03:08:26 AM by claude, Reason: thinking »

Offline lkmitch

  • *
  • Fractal Friend
  • **
  • Posts: 17
« Reply #10 on: November 01, 2018, 05:02:31 PM »
http://abacus.bates.edu/~sross/ the lines are also "Q-curves" which could be plotted directly...

Thanks for the pointer to Q-curves. I hadn't read about them before.

Offline hgjf2

  • *
  • Fractal Fanatic
  • ***
  • Posts: 37
« Reply #11 on: December 09, 2018, 08:50:56 AM »
Also the Haussdorf measure and dimension having the equation Hhj(E):=inf{sum[j->oo]h(Gj):E<U[j->oo]Gj;Gj<-td;d(Gj)<d)\/j} applied and for bifurcation diagram


xx
Rendering Help

Started by AbrahamLeWizard on Mandelbulb3d

6 Replies
220 Views
Last post February 24, 2018, 03:47:55 AM
by AbrahamLeWizard
clip
Lyapunov diagrams

Started by marcm200 on Image Threads

64 Replies
1516 Views
Last post January 13, 2019, 10:53:06 AM
by marcm200
clip
correct rendering of z=exp(z)+c

Started by v on Noob's Corner

2 Replies
110 Views
Last post December 20, 2018, 03:38:47 AM
by FractalDave
xx
Speed of rendering...

Started by FractalDave on Off Topic

11 Replies
234 Views
Last post December 17, 2018, 06:00:58 PM
by hobold
clip
Rendering depth buffer from DE

Started by utak3r on Synthclipse

6 Replies
179 Views
Last post March 05, 2018, 08:43:57 AM
by utak3r