this is not as cool as i had hoped because it just hardcodes the first 14 terms of the continued fraction for pi, i.e. 3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1
(i did implement a generalized continued fraction which isn't hardcoded, but (A) it converges much more slowly and (B) it doesn't actually find the "best" convergents (e.g. 355/113) so it just didn't seem very useful.)
we're still figuring out how to do it right, so it might change still. But yeah, the fib example shows how it works a bit, the ?0-9 registers match values, and ?: on an operator is a kind of bang to evaluate an arithmetic operation.
Devine Lu Linvega
in reply to ⛧ esoterik ⛧ • • •⛧ esoterik ⛧
in reply to Devine Lu Linvega • • •@neauoire i'm cheating -- just using a continued fraction representation:
https://git.phial.org/d6/modal/src/branch/d6/binary/arith.modal#L434
i had a GCF implementation using the faster fraction from here: https://en.wikipedia.org/wiki/Generalized_continued_fraction#%CF%80
however the regular CF provides better approximations, so it seemed better to do it that way.
generalization of continued fractions in which the partial numerators and partial denominators can assume arbitrary complex values
Contributors to Wikimedia projects (Wikimedia Foundation, Inc.)⛧ esoterik ⛧
in reply to ⛧ esoterik ⛧ • • •this is not as cool as i had hoped because it just hardcodes the first 14 terms of the continued fraction for pi, i.e. 3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1
https://oeis.org/A001203
(i did implement a generalized continued fraction which isn't hardcoded, but (A) it converges much more slowly and (B) it doesn't actually find the "best" convergents (e.g. 355/113) so it just didn't seem very useful.)
A001203 - OEIS
oeis.org⛧ esoterik ⛧
in reply to ⛧ esoterik ⛧ • • •Devine Lu Linvega
in reply to ⛧ esoterik ⛧ • • •⛧ esoterik ⛧
in reply to Devine Lu Linvega • • •Devine Lu Linvega
in reply to ⛧ esoterik ⛧ • • •This is very nice! All in native numbers then.
I don't know if you saw, but I've started putting a x11 playground to draw modal programs to a framebuffer?
Fractals next?
https://git.sr.ht/~rabbits/thuesday
~rabbits/thuesday - Semi-Thue Ordinator, written in C99(X11) - sourcehut git
git.sr.ht⛧ esoterik ⛧
in reply to Devine Lu Linvega • • •@neauoire oh! yes! that would be super fun.
i need to port arith.modal to the number device you implemented. i think that should give at least a 10x speed up.
Devine Lu Linvega
in reply to ⛧ esoterik ⛧ • • •