Converting between arbitrary real-valued base systems

109 Views Asked by At

I watched a video from Combo Class on YouTube about non-integer base systems which is something I've expressed interest in before but this did get me thinking about them again. In the video we are given a look at bases π, e, 1/2, 3/2, $\sqrt2$, $\sqrt10$, $\sqrt[3]{10}$, and ɸ.

In theory, any real number $n$ can be used as a radix for a positional number system, and we can easily represent such bases using the powers of $n$ multiplied by the place value. For example, $3π^2 + 7π^1 + 2π^0 + 6π^{-1} + 4π^{-2}$. Of course, we might not want this representation of a base-π number; we'd want to represent it the way we normally show numbers, which is with positional notation and a limited number of digits, with a radix point separating the integral and fractional parts. We'll almost certainly get an infinite amount of digits, which is acceptable, we just want to be able to calculate the digits up to an arbitrary point, and know exactly how many symbols we need to represent it.

Up until now, I had thought that for any given real base $b$, you only need a number of digits $d$ such that $ceil(b) = d$. For example, base $\sqrt2$ is less than 2, but it still uses two symbols - 0 and 1 - just like binary, because $ceil(\sqrt2)$ = 2. The same goes for base ɸ. Yet, once Domotro covers base 3/2, it turns out we actually need 3 symbols - 0, 1, and 2 - rather than just the expected 2, since 3/2 = 1.5 which is less than 2. And even weirder, 3/2 is between $\sqrt2$ and ɸ in value, so we go from needing 2 digits to 3, to going back to only needing 2. In other words, $d$ is not monotonically increasing as $b$ increases.

Additionally, we see in the video that we can convert to some of these real-valued bases, but it's done by exploiting properties of the number used for the base - for example, conversion from base 10 to ɸ is made possible by using algebraic properties of ɸ. However, is there a general formula that can convert between any two arbitrary real-numbered bases? The standard algorithm used for positive integer bases doesn't work since you get fractional remainders, so I'm looking for a generalized version of the base conversion algorithm that works with any real number $n$. And, if such an algorithm exists, then how do we determine how many digits $d$ we need, since the rule $ceil(b) = d$ does not hold. Or is it the case that there does not exist such an algorithm, and generalized representations of arbitrary real-numbered bases is an undecidable problem and thus the rules are something we have to make up ourselves, based on what we find most convenient?

For example, say I wanted to, for whatever strange reason, convert the base-ten number 12 to the equivalent number in base-$ln(10)$, without exploiting properties specific to $ln(10)$ and just using a generalized algorithm, such that I get the corresponding value in a typical positional notation, with only the digits needed to represent that base.