3 ms·
Wait a second, does it yield an exact inverse or a numerical approximation?
by choeger 6y ago
Wait a second, does it yield an exact inverse or a numerical approximation?
- e12e 6y agoGiven the example of reversing over a function that calculates the first Fibonacci number greater than 100, it seems to be a bit more going on than "just" a numerical approximation: https://github.com/GiggleLiu/NiLang.jl/blob/master/examples/fib.jl https://github.com/GiggleLiu/NiLang.jl/blob/master/examples/... Ed: after skimming the paper (that went mostly over my head) - this does indeed seem to be about "actually" running functions in reverse - given a function only defined "forward" in the nilang DSL. It appears the graph embed examples are missing in the master branch, unfortunately. I wonder if this can be used more trivially to solve simple problems too - like calculating values/sums pertaining to compound interest/investment, given a naive function for calculating sums etc (its trivial to add up compounded interest and deposits, but a tiny bit more complicated to answer the question "at what time is my portfolio at X or more dollars).
- GiggleLiu 6y agoGraph embedding example is not missing, it in the appendix of the paper's master branch: https://github.com/GiggleLiu/nilangpaper/blob/master/invc.pdf https://github.com/GiggleLiu/nilangpaper/blob/master/invc.pd... The source code is available here: https://github.com/JuliaReverse/NiGraphEmbedding.jl https://github.com/JuliaReverse/NiGraphEmbedding.jl
- GiggleLiu 6y agoVery good question. Floating point `+=` and `-=` are not exactly reversible. This is the only approximation that we have made in NiLang. To compile NiLang to a reversible device (rigorously reversible), we need to overhaul current number systems, i.e. using fixed point numbers and logarithmic numbers instead. Fixed point numbers are exactly reversible under `+=` and `-=`, logarithmic numbers are exactly reversible under `*=` and `/=`. Here is an example of implementing Bessel function with two number systems: https://giggleliu.github.io/NiLang.jl/dev/examples/besselj/ https://giggleliu.github.io/NiLang.jl/dev/examples/besselj/