4 ms·
It sounds like you're asking for symbolic math utilities, which exist in a number of languages. Like for example I've tried to play this game building a toy la
by qppo 7y ago
It sounds like you're asking for symbolic math utilities, which exist in a number of languages.
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.
- igravious 7y agoAha, you're thinking like me. That's why I thought I might incorporate surreal numbers into a toy language early on in the compute chain (before even a "normal"/"traditional" numeric implementation) but I've already run into the problem that the naive recursive plus op implementation is pathologically slow in regular cases so I had to hack the surreal integer case to make it faster. I don't want the entirety of symbolic math, I just want a sufficiently decent implementation of a useful part of it! The surreal numbers interest me because they are said to be able to represent infinitesimals and infinities … “A computer can't represent reals (or even all rationals you care about) with a finite number of bits.” This is where my thinking is on this. Because surreal numbers only give you the dyadic rationals exactly it forces you to think about what it means to represent not just exotic numbers like i, √2, π, and e but also non-exotic rationals like the vulgar fraction ⅓. My thinking is that the algorithm(s) that produce ever greater precision for non-exact representations are finite and recursive which means that the more precise you want something you specify how long you want that algorithm to pump out ever more precise values or you specify a number of bits constraint. Not fixed point, not floating point, flexi-point? If you have π to 100 binary places as a dyadic fraction that's a precision above and beyond what anyone would ever need in practice. I'm thinking that when manipulating symbols that the algorithm is manipulated, not the numeric representation!