Fractal Related Discussion > Fractal Mathematics And New Theories

M-brot distance estimation versus Claude's "fake" DE

(1/2) > >>

gerrit:
Looking at the formulas for the true distance estimation (DE) and the normalized (smoothed) iteration count (NC), it seems that the norm of the gradient of the NC (g), proposed by Claude as "fake DE" (FDE) is in fact identical to the "true" DE, if we take FDE=1/(g*log(2)), in the limit of infinite escape radius and inf X inf grid.  Except it is not calculated analytically during the iterations, but numerically later on using finite differences.

Numerically however we get g=0 at some locations, so I tried a "regularization": FDE = 1/((g+ep)*log(2)) where I guess ep such that when g=0 FDE equals dx/4 (maximum distance) where dx is the size of the region. This gives ep = 1/(log(2)*dx/4).

g is here the norm of the finite difference (viz. f(x+1)-f(x)) divided by h=pixel spacing, i.e., the actual numerical estimate.

With this regularization the true DE and "fake" DE look almost identical.

Examples below comparing the "fake-DE" (titled Claude DE) and the "true" DE.

gerrit:
What I wrote was not correct. Simply FDE=1/(g*log(2)) when g>0 and undefined when g=0 (i.e., in interior).

With this I computed FDE and true DE for some examples. Error as measured by mean(FDE-DE)/max(DE) for various gradient finite difference formulas was typically of the order of 0.05% for the Diag2X2 gradient method, but about 100 times higher for the central and forward formulas, which I didn't expect (or I could have a bug).

gerrit:

--- Quote from: gerrit on October 01, 2017, 03:32:59 AM ---Simply FDE=1/(g*log(2)) when g>0 and undefined when g=0 (i.e., in interior).
--- End quote ---

I investigated some more. Theoretically analytical distance estimate (DE) d is related to numerical gradient norm g of smoothed iteration map through
d = 1/(g*log(2)) when g>0 and undefined when g=0 (i.e., in interior). (Natural log).

On an example I computed numerical gradient norm g(x) (and analytical DE) with four methods:
1) diag: finite difference (FD) over diagonals of 2X2 stencil with x  bottom left.
2) forward: FD from x to all its 8 neighbours (left/right and diagonal)
3) central: FD across x (viz (f(x+1)-f(x-1))/2) in all 4 directions  (left/right and diagonal)
4) xy: just FD in positive x and y direction

3) has order h^2 error, others are O(h).

Following table lists difference between analytic and numeric DE on an example for four methods, and antialiasing factor (AA ).
Metric is 100% *||num DE - an. DE||/||an DE|| over the image.

--- Code: --- AA  diag        forward   central    xy
1    5.5900    3.6700    3.390     7.0500
2    2.8600    1.6500    1.520     2.5100
3    2.0500    2.0500    0.949     1.7700
4    1.4400    0.7340    0.6770   1.2800
5    1.1400    0.5640    0.5210   1.0800

--- End code ---

claude:

--- Quote from: gerrit on October 04, 2017, 05:24:05 AM ---Following table lists difference between analytic and numeric DE on an example for four methods, and antialiasing factor (AA ).
Metric is 100% *||num DE - an. DE||/||an DE|| over the image.

--- End quote ---
I guess that is the mean of the realtive error over the image.  I think it would be interesting to see more statistics on the error, like maybe RMS average, or min/max values, maybe even histogram - perhaps a few very bad points are spoiling it for the rest of them?

gerrit:

--- Quote from: claude on October 04, 2017, 10:20:59 PM ---I guess that is the mean of the realtive error over the image.  I think it would be interesting to see more statistics on the error, like maybe RMS average, or min/max values, maybe even histogram - perhaps a few very bad points are spoiling it for the rest of them?

--- End quote ---
||.|| stands for the 2-norm, i.e., RMS. 1-norm is about the same, infiniti norm (=max) is large and all over the place (the few bad points you mention). I didn't save those numbers.

I plan to look at another example when I have some time.