• October 20, 2021, 03:17:28 AM

Author Topic: (Problem) found another precision limit issue  (Read 544 times)

0 Members and 1 Guest are viewing this topic.

Offline Mr Rebooted

  • Fractal Fruit Salad
  • *****
  • Posts: 79
(Problem) found another precision limit issue
« on: August 28, 2021, 01:51:55 AM »
this time, it's on hybrid fractals. I tried attempting to make the separated perpendicular mandelbrot, but when i get to a  certain zoom level (2.12e037), i might as well have hit the precision limit.

I've also attached a screenshot and a .kfr file to the location of this limit

Linkback: https://fractalforums.org/index.php?topic=4384.0

Offline FractalAlex

  • Perturbation formula helper
  • Fractal Freak
  • **
  • Posts: 690
  • One step closer to victory
Re: found another precision limit issue
« Reply #1 on: August 28, 2021, 01:54:25 AM »
Just downloaded it, same thing on my end. Thanks for the report, I shall report it to Claude. It appears to be the same precision loss problem that occurs in the HPDZ Buffalo fractal when the seed is non-zero.

Offline claude

  • 3f
  • ******
  • Posts: 2033
    • mathr.co.uk
Re: found another precision limit issue
« Reply #2 on: August 28, 2021, 10:36:14 AM »
Cancellation precision loss in x occurs when x = +/- 3.5, cancellation precision loss in y occurs when x = +/- 1.75.  This is because the formula expands to x + y i -> (|x| (|x| - 3.5) - y^2) + (2 y (1.75 - |x|)) i + c.  As the critical point is x = +/- 1.75 (when y= 0) and minis are periodic, this happens every period making minis glitch.

I'm not sure how to fix it.  Probably it needs a new glitch test to detect the precision loss (|Xr+xr| much nearer to 1.75 than |Xr| ?) but while I can see how to add a condition to the built in formulas (working on it for Nova), for hybrid formulas it's much harder...
« Last Edit: September 07, 2021, 05:52:43 PM by claude, Reason: typo »

Offline claude

  • 3f
  • ******
  • Posts: 2033
    • mathr.co.uk
Re: found another precision limit issue
« Reply #3 on: September 07, 2021, 05:48:34 PM »
attached is more like what it should look like, rendered without perturbation with full precision for each pixel, taking almost 1 minute for 64x36 pixels...

Offline claude

  • 3f
  • ******
  • Posts: 2033
    • mathr.co.uk
Re: found another precision limit issue
« Reply #4 on: October 12, 2021, 04:58:26 PM »
spent about an hour on it today, trying to move critical point to 0.  still get glitches :( (but image 2 is a bit improved, maybe?)

Code: [Select]
  <reference t="R">
    Xrn = (abs(Xr + 7/4) - 7/2) * abs(Xr + 7/4) - Xi2 + Cr - 7/4;
    Xin = 2 * XB * Xi + Ci;
  </reference>
  <references t="R" name="XA" update="XAn" value="1.75">
    XAn = Xrn + 7/4;
  </references>
  <references t="R" name="XB" update="XBn" value="0">
    XBn = 7/4 - abs(7/4 + Xrn);
  </references>
  <perturbation t="R">
    xrn = cr + (2 * Xr + xr) * xr - (2 * Xi + xi) * xi + 7 * (xr - diffabs(XA, xr)) / 2;
    xin = ci + 2 * (XB * xi - Xxi * diffabs(XA, xr));
  </perturbation>

maybe it needs some custom magic for (xr - diffabs(XA, xr)), or maybe the precision loss is elsewhere (XB is really a diffabs(), but I haven't implemented it for MPFR yet, in any case that is evaluated in full precision and stored as double, as is XA)

EDIT a custom sepdiffabs() function made not difference

EDIT2 maybe the problematic orbits go near both +7/4 and -7/4 ?  as some locations in this fractal (going past many minis) are unproblematic down to e50 and beyond.... (EDIT3 no that doesn't seem to be the cause here)
« Last Edit: October 12, 2021, 08:06:32 PM by claude, Reason: not sure what is happening »

Offline claude

  • 3f
  • ******
  • Posts: 2033
    • mathr.co.uk
Re: found another precision limit issue
« Reply #5 on: October 13, 2021, 05:39:05 PM »
fixed it!

Code: [Select]
  <reference t="R">
    Xrn = sqr(diffabs(7/4, Xr)) - Xi2 + Cr - 77/16;
    Xin = 2 * XB * Xi + Ci;
  </reference>
  <references t="R" name="XA" update="XAn" value="1.75">
    XAn = Xrn + 7/4;
  </references>
  <references t="R" name="XB" update="XBn" value="0">
    XBn = 0-diffabs(7/4, Xrn);
  </references>
  <references t="R" name="XC" update="XCn" value="7">
    XCn = 7 + 2 * Xrn;
  </references>
  <perturbation t="R">
    xrn = cr + diffabs(XA, xr) * ((Xr > 0-7/4) ? ((Xxr > 0-7/4) ? (2 * Xr + xr) : (0-7/2 - xr)) : ((Xxr > 7/4) ? (xr - 7/2) : (0-XC - xr))) - (2 * Xi + xi) * xi;
    xin = ci + 2 * (XB * xi - Xxi * diffabs(XA, xr));
  </perturbation>

there is an issue with SIMD, the ternary operators ?: breaks it - may have to wrap this into a special function just for this formula.

P(f(x)) := f(X+x) - f(X)  -- rearranged symbollically to avoid catastrophic cancellation
diffabs(X, x) := P(|x|) = |X + x| - |X|   -- implemented with case analysis by laser blaster on ff com
P(diffabs(K, x)) = diffabs(K+X, x)     -- exercise for reader, verify this from the definitions above

completing the square in (|x|-7/2)|x| gives (|x|-7/4)^2 - 49/16
translating with critical point of separated perpendicular at 7/4 gives  (|x+7/4|-7/4)^2 - 49/16-7/4  which inner part is a diffabs
perturbing diffabs(7/4,x)^2 using product rule gives diffabs(7/4+X,x) * (diffabs(7/4,X) + diffabs(7/4,X+x)); doing case analysis on the terms in brackets (which works out as |7/4+X| + |7/4+X+x| - 7/2) gives the final formula.

note: 7/2 in C would give 3 by integer division, the fraction is correctly 3.5, this is fixed up by KF's preprocessor (which needs 0-x instead of just -x, minor annoyance)

Offline claude

  • 3f
  • ******
  • Posts: 2033
    • mathr.co.uk
Re: found another precision limit issue
« Reply #6 on: October 16, 2021, 05:55:54 PM »
I fixed the SIMD issue by implementing two template functions just for this formula; still need to add derivatives and OpenCL support.


Meanwhile I rendered a video zooming past the location in the first post:
https://diode.zone/w/tsz9dJyLACRmPLNrUjn9fP

It was quite a challenge, first try led to undetected/uncorrected glitches, even with a ridiculous threshold for Pauldebrot's criterion - something about the main reference was no good for one of the minis and its embedded Julia set echoes - so I had to re-render some of the keyframes picking the main reference by hand.



xx
"Time Span"

Started by cricke49 on Fractal Image Gallery

0 Replies
1152 Views
Last post August 02, 2018, 07:05:21 AM
by cricke49
xx
OpenGL font rendering

Started by sjhalayka on Programming

2 Replies
534 Views
Last post April 20, 2020, 05:00:47 PM
by sjhalayka
clip
A new style of fractal imagery using fractal neural style transfer

Started by iRyanBell on Fractal Image Gallery

4 Replies
1779 Views
Last post July 18, 2021, 03:47:45 AM
by Chris_M_Thomasson
xx
Kleinian limit set

Started by birational on Fractal Image Gallery

1 Replies
324 Views
Last post October 13, 2021, 06:10:21 PM
by Adam Majewski
xx
Another Kleinian limit set

Started by birational on Fractal Image Gallery

1 Replies
300 Views
Last post December 04, 2018, 11:28:31 PM
by lycium