DEV Community

Cover image for My Feather Fractal Was Just Two Blobs: Fixing 2 Rational Dynamics Bugs in WebGL & NumPy

My Feather Fractal Was Just Two Blobs: Fixing 2 Rational Dynamics Bugs in WebGL & NumPy

QuantumTechCoder on November 18, 2026

My Feather Fractal Was Just Two Blobs: Fixing 2 Rational Dynamics Bugs in WebGL & NumPy πŸ”— Quick Links πŸš€ Live Demo (60 F...
Collapse
 
paullovelace profile image
Paul Lovelace •

The c * 0.2 line is the best kind of bug β€” someone typed it once and it quietly turned a crescent into a bullseye. And starting at z0 = c instead of 1 is the sort of thing no unit test catches, because the output still looks like a fractal, just the wrong one. Your lesson 3 is the real takeaway: visually cross-reference against the literature, tests won't save you here. What made you check Google Images in the first place β€” a user report, or did the blobs just look off to you?

Collapse
 
quantumtechcoder profile image
QuantumTechCoder •

Um, I think I already mentioned lol, It was a user report.

And by "someone"(who started at z0=c instead of 1) I know exactly who it is: My real life friend, he is kind of always drinking coffees while working so yeah his mind might have drifted off.

Collapse
 
quantumtechcoder profile image
QuantumTechCoder •

Appreciate you reading through the math breakdown!

Collapse
 
magopredator profile image
Fenix •

Excelente, Quantum....es flamante. :)

Collapse
 
quantumtechcoder profile image
QuantumTechCoder •

Thanks so much!

Collapse
 
magopredator profile image
Fenix •

Thanks a lot, Quantum, for trusting me to test it out. I did see yoursβ€”it’s fantastic! My own fractal still acts a bit strangeβ€”for instance, the screen goes black when rendering multibrotsβ€”and it’s very basic, almost just a simple demo; it definitely needs some fixes. But the Julia set is spectacular, isn’t it? :) ... Your fractal is really greatβ€”sophisticated and elegant. Thanks, Quantum. Best regards. Aloha. :)

Thread Thread
 
magopredator profile image
Fenix •

Tu software es espectacular Quantum, de lujo! :o ... :)

Thread Thread
 
quantumtechcoder profile image
QuantumTechCoder •

Thanks :D

If you need a small help, just reach me out here itself. Or, just open an issue in github and ping me there, but i rarely check github notifications, so here itself :-)

Thread Thread
 
quantumtechcoder profile image
QuantumTechCoder •

Pls star the repo as a sidequest :)

Collapse
 
dafili profile image
Renhua Wei •

If the feather formula is a rational map (p(z)/q(z)) rather than a polynomial, anchoring the orbit at z0 = 0 only looks right when 0 happens to be a critical point. Root the critical set instead β€” numpy.roots on p'(z)q(z) - p(z)q'(z) β€” and color by the orbit of that root: on every rational map I've colored, the blob-to-filament change happens without touching the shader. And the imaginary unit deserves one assert in the Python port, because a dropped imag term still renders: compare (a+1j*b)*(c+1j*d).imag against a hand-computed case.

Collapse
 
quantumtechcoder profile image
QuantumTechCoder •

πŸ‘Thats a good idea. I'll try this one if any more similar error occur :D

Collapse
 
dafili profile image
Renhua Wei •

The check that pays for itself on the first try: deg(p'q - pq') is deg p + deg q - 1 unless the leading terms cancel, and they only cancel when deg p == deg q. So for a degree-d map numpy.roots should hand you 2d-2 critical points with multiplicity, anything else means you are colouring a map of a different degree than you think. And np.trim_zeros(p'q - pq', 'f') before the roots call, a 1e-17 float tail adds a phantom complex pair that moves every orbit you seed.