Fractal Software > Programming

Mandelbrot interior DE

(1/2) > >>

xenodreambuie:
I had a request for a Mandelbrot orbit trap shape in Jux. I had my doubts, so I tried Julia set orbit traps first, and that worked quite well. For Mandelbrot, the trap needs a smooth interior DE to get the right shape. That's important for using slope, whereas coloring is not so critical. I managed to do that with some help from Claude's blog page about it (https://mathr.co.uk/blog/2014-11-02_practical_interior_distance_rendering.html)

I used essentially the unbiased method, as my orbit trap methods don't have access to previous pixels. Speed is better than I thought, although it takes a hit with cellular or other orbit trap options that don't bail on the first trap hit. Here is an example of a Julia set with a Mandelbrot trap.

Encouraged by this, I tried using interior DE for general Mandelbrot iteration, but had some issues (continued in another post...)

xenodreambuie:
For Mandelbrot interiors of general formulas, I have been using the exterior DE, because it's easy to calculate. Although it's not correct, it tends to work at the boundaries (or one of them if using two different critical points), but is often not smooth at iteration bands. The interior DE had looked a bit scary for a general case, but as it turns out to only need calculating in the period checking loop (which I already do after convergence), and I already had everything needed for the recurrence calculation except for the second derivative, it was worth a try.

For initial tests I used a central difference for d2/dz2 in the base formula class (I use 1/50 pixel for the interval, scaling up when near the zoom precision limit). It works as expected, except that you start to see noise when zooming by only 1e3 (and with some formulas even in some areas without zooming). So it does need analytic expressions for the second derivative (although one can ignore any Abs terms for this). Unfortunately, that can get ugly for some parameterized rational formulas, so it will take some work. I'm tempted not to bother for formulas that don't get zoomed much and that people usually either use potential coloring or Julia sets anyway. Whereas the first derivative doing forward differencing is generally fine.

But there is another issue. The results are smooth, but don't always match the set boundary. That's no problem for coloring and slope lighting, but it messes up boundary coloring using the DE. Here are examples using a Nova Mandelbrot set (0.75z + z-2 + c) and colored with the log of the DE. The first image uses interior DE. The second image uses exterior DE, with black boundary coloring.

Is anyone else using interior DE for general Mandelbrots, and do you have the same issue or not?
My method is to iterate until the point escapes or reaches maxiters, then iterate from the critical point (same or different one) until it converges to the previous point or reaches maxiters. If it converges, iterate more to find the period (and do the interior DE in this loop, as it will have a valid z0 and period.)

xenodreambuie:
In the absence of better ideas, for interior Mandelbrot regions I'm trying the interior DE calculation for coloring and slope and exterior DE calculation for the set boundary, which works well. Here is an example with a Nova Mandelbrot (not using slope lighting.)

claude:
Does the Mandelbrot power 2 interior distance formula need any modification for other powers / formulas?

Maybe the second derivatives can be calculated by extended dual numbers so you don't have to do the horrible algebra by hand for all formulas - I can probably dig out a reference with implementation notes if you want...
Hessian matrices or so might be needed for non-complex-analytic formulas (e.g. Burning Ship), do you implement any of them?

xenodreambuie:

--- Quote from: claude on December 18, 2020, 01:18:32 PM ---Does the Mandelbrot power 2 interior distance formula need any modification for other powers / formulas?

Maybe the second derivatives can be calculated by extended dual numbers so you don't have to do the horrible algebra by hand for all formulas - I can probably dig out a reference with implementation notes if you want...
Hessian matrices or so might be needed for non-complex-analytic formulas (e.g. Burning Ship), do you implement any of them?

--- End quote ---

The formula doesn't need any modification. The important change I had to make was generalizing the recurrence relations to use the proper derivatives (and correctly guessing where the second derivatives are.)

Now that I've done all the formulas it's not much of a task to do a few new ones as they arise, and it's convenient to use standard extended for everything relevant. For most rational functions it's convenient to use the formula for 2nd derivatives in terms of f,g,f',g',f'',g'' rather than one huge explicit formula. But parameterized powers do complicate the logic somewhat. I usually have a loop to calculate powers with a bunch of conditionals in it.

I am ignoring absolute options in all 2nd derivatives, and this works well, even when including them in first derivatives. It doesn't affect the aesthetics if the result isn't necessarily technically correct with these formulas, as they have discontinuities anyway. Also, for most general formulas, Mandelbrots with abs are not interesting, just useful for finding the best Julia sets, so the interior distance isn't very important for them.

I did not implement this for any of the real number formulas I have such as gnarls and Gumowski-Mira attractor, which are only interesting in Julia form.

Also, Jux only has formulas of form f(z)+c at present. If I ever get around to including some f(z,c) formulas with distance estimation that will take extra work.