3 ms·
Irrationals are properly represented as a "symbol plus algorithm" to compute a value to any degree. E.g. pi is "pi" plus it's Taylor expansion. This is effectiv
by javajosh 5y ago
Irrationals are properly represented as a "symbol plus algorithm" to compute a value to any degree. E.g. pi is "pi" plus it's Taylor expansion. This is effectively what textbooks and papers mean by pi, so it makes sense that software would use the defition, too.
- nine_k 5y agoYes, there are neat representations for some irrationals, like pi, or sqrt(2). But in the general case, there is none. You can, with an increasing degree of inconvenience, operate on expression trees that use rationals at leaf nodes to represent computations involving irrational numbers. You have a limited ability to do even simple math with them though; if you use infinite series to represent two of them exactly, you can't even always add them, to say nothing of multiplication. And our ability to run numeric stuff like integration or gradient descent is limited to integers and floating-point approximations of real numbers.
- feoren 5y agoIn the general case, you need infinite bits to represent an irrational number. 100% of all irrational numbers are not computable by a Turing machine, because the set of all algorithms on a Turing machine is countable and irrationals are not. So it seems a bit silly to talk about "the general case" of irrational numbers; it's extremely unlikely you care about an irrational number that is not computable. If an irrational number doesn't have a "neat representation", then it doesn't come up in your problem.