Fredrik Johansson writes about arbitrary-precision numerical software, including the Arb and Calcium C libraries and rigorous numerical computation.
Commenters call Calcium amazing for treating constants like pi and e as first-class numbers, and link his Arb integration post as interesting reading.
>"When computers revealed all those smaller copies of the Mandelbrot set within itself, Douady and Hubbard wanted to explain their presence. They ended up turning to what’s known as renormalization theory, a technique that physicists use to tame infinities in the study of quantum field theories, and to connect different scales in the study of phase transitions."
https://en.wikipedia.org/wiki/Renormalization
Rampant conjecture/speculation: In the future, perhaps some Mathematician might discover a link between Renormalization Theory -- and the Digits Of Pi... since they seem related...
More specifically, between Renormalization Theory -- and algorithms for the Digits of Pi.
Of which, one notable one is The Chudnovsky algorithm:
https://en.wikipedia.org/wiki/Chudnovsky_algorithm
Which leads to Binary Splitting:
https://en.wikipedia.org/wiki/Binary_splitting
Which leads to Hypergeometric Series:
https://en.wikipedia.org/wiki/Hypergeometric_function#The_hypergeometric_series
Which leads to Gauss' continued fraction:
https://wikimedia.org/api/rest_v1/media/math/render/svg/4d54114465d858bd4de8e8bb87818d19d9e2da38
https://en.wikipedia.org/wiki/Hypergeometric_function#:~:text=Gauss%27%20continued%20fraction
https://en.wikipedia.org/wiki/Gauss%27s_continued_fraction
Which leads to Analytic continuation of 3F2, 4F3 and higher functions:
https://fredrikj.net/blog/2009/12/analytic-continuation-of-3f2-4f3-and-higher-functions/
Which leads to my brain hurting ("Put down…
Great work! I like how well considered the design is. This calculator takes a point in the design space with text input, equation rendering, a grapher, and Big Int/Floats for number representation.
I wonder if the author considered an input method where keypresses translate directly into a rendered equation? Symbolab kind of does this, so instead of writing an expression in some functional style and seeing its rendered output, I can directly manipulate the rendered equation with the keyboard.
The other point the author makes about discoverability of operators like sqrt and cbrt, I feel that you could circumvent it by introducing a semantic search feature for operators. For example, typing "square root" would display a list of suggestions for operators that match that, like an IDE.
The last question I have is if the author has looked at libraries like Calcium (https://fredrikj.net/calcium/) or the work that went into the Android calculator recently (https://dl.acm.org/doi/pdf/10.1145/3385412.3386037). They use exact arithmetic with computable real/complex numbers. It might serve as a cleaner abstraction that switching between different BigNum representations yourself.
> When I started working on this I thought that I might want to switch to "binary coded decimal"[0] to avoid issues with inputs like (0.1 + 0.2 - 0.3).
If you want to go this route, there are standardized decimal floating points, e.g. https://en.wikipedia.org/wiki/Decimal64_floating-point_format (or the 128 bit version).
> And is there an implementation I could use?
Afaik Boehms implementation lived only in the Android source tree, i.e. https://android.googlesource.com/platform/packages/apps/ExactCalculator/+/7265aa3a922a7e7c0389dae4b26cca562aa777a6/src/com/android/calculator2/UnifiedReal.java . So to use that you'd need to extract and port them, which might be some effort.
There are all sorts of different approaches for doing calculations on real numbers. I think Johanssons work is particularly impressive in this domain, but I'm not sure if that is much use for a calculator like this: https://fredrikj.net/
There is an algorithm by Richardson to prove equality of real and complex numbers composed from exponentials and logarithms. (It doesn't have a complete proof of correctness, but it never returns a wrong result: it will loop forever iff it encounters a counterexample to Schanuel's conjecture.)
It can also be extended to higher transcendental functions, but it gets harder to guarantee termination.
I have a library for exact reals/complexes with an incomplete implementation of Richardson's algorithm: https://fredrikj.net/calcium/
That's called ball arithmetic, and there are many libraries for it, such as arb. http://fredrikj.net/arb/ It's useful in mathematical calculation, but usually with floating point calculations you have some error bounds coming from your algorithm which are "good enough" if the result is going to be the value of something with 5% tolerance.
Hey, that's me! Though I mention it in the post, I also want to give a shoutout here to libcalcium, which handles the somewhat magical task of representing and comparing exact algebraic numbers: https://fredrikj.net/calcium/index.html.