That knows that i is the square root of -1, that knows that √2 is irrational but π and e are transcendental. And so on. Also looking for a language that has a complete efficient implementation of surreal numbers (prompted by Conway's recent passing), or at least allows you to plug one in seamlessly/transparently if you so desired.
https://news.ycombinator.com/item?id=18565234
Don't really know much about surreal numbers, but I found the following library that defines Fractional and Num instances for it, so that should enable Haskell to work with surreal numbers as if they were native to the language:
https://github.com/Lacaranian/surreal
There's also this module on transcendental numbers:
https://hackage.haskell.org/package/numeric-prelude-0.4.2/do...
auxym might be right, though, that you might be better served with a language that is specialized more in mathematics, rather than a general purpose language.
Like for example I've tried to play this game building a toy language from first principles but you run into problems rather quickly. A computer can't represent reals (or even all rationals you care about) with a finite number of bits. You can't guarantee that all integers are representable by all rationals and all rationals by reals and so on.
And if you want to throw out formalism and accept the consequences, every language has a way to do it to varying degrees of success. Matlab, Mathematica, Julia, Python, R, basically anything that might be used by a working mathematician probably has the facilities and libraries to help.
IN: scratchpad 2 63 ^ 1 + 2 63 ^ / 2 63 ^ * 2 63 ^ 1 + =
t
The corresponding expression would incorrectly evaluate to false in most languages: >>> n = 63
>>> (2**n + 1) / 2**n * 2**n == 2**n + 1
False
Factor also has syntactic support for complex numbers but not for irrational ones.
Lean is being developed specifically for being applicable to math researcher.