3 ms·
> Surprisingly, if you allow a base to be any real number, and not just an integer, then the most efficient computational base is the irrational number e. Now
by Rygian 2y ago
> Surprisingly, if you allow a base to be any real number, and not just an integer, then the most efficient computational base is the irrational number e.
Now I'm left with an even more interesting question. Why e? The wikipedia page has some further discussion, hinting that the relative efficiency of different bases is a function of the ratio of their natural logarithms.
- jetrink 2y agoThe "area" that you want to minimize is the number of digits, d, times the base, b. A = d * b d is roughly equal to the log of the number represented, N, base b. d ~= ln(N)/ln(b) Substituting, A ~= b * ln(N) / ln(b) Take the derivative of the area with respect to b and find where the derivative is zero to find the minimum. Using the quotient rule, dA/db = ln(N) * (ln(b)*1 - b/b) / ln(b)^2 0 = ln(N) * (ln(b) - 1) / ln(b)^2 0 = ln(b) - 1 ln(b) = 1 b = e I hope I got that right. Doing math on the internet is always dangerous.
- klyrs 2y ago> Doing math on the internet is always dangerous. Only if you see correctness as a thing to be avoided. In my experience, being Wrong On The Internet is the fastest way to get something proofread.
- l- 2y agoAlthough the cost function has a multiplication of a base times the floor of the log of the value with respect to that base plus one, area is a misleading analogy to describe the applicability as any geometric dimensional value has to taken with respect to a basis. For a visual, (directional) linear scaling is more in line so to say.
- vitus 2y agoA related point is comparing x^y vs y^x, for 1 < x < y. It can be easily shown that the "radix economy" described in the article is identical to this formulation by simply taking the logarithm of both expressions (base 10 as described in the article, but it doesn't really matter, as it's just a scaling factor; this doesn't change the inequality since log x is monotonically increasing for x > 0): y log x vs x log y. Or, if you want to rearrange the terms slightly to group the variables, y / log y vs x / log x. (This doesn't change the direction of the inequality, as when restricted to x > 1, log x is always positive.) If you minimize x / log x for x > 1, then you find that this minimum value (i.e. best value per digit) is achieved at x=e. (Choosing the base = e for calculation purposes: take a derivative and set to zero -- you get (ln x - 1) / (ln x)^2 = 0 => ln x - 1 = 0 => ln x = 1 => x = e.) For some intuition: For small x and y, you have that x^y > y^x (consider, for instance, x=1.1 and y=2 -- 1.1^2 = 1.21, vs 2^1.1 is about 2.14). But when x and y get large enough, you find the exact opposite (3^4 = 81 is larger than 4^3 = 64). You might notice that this gets really close for x=2 and y=3 -- 2^3 = 8, which is just barely smaller than 3^2 = 9. And you get equality in some weird cases (x=2, y=4 -- 2^4 = 4^2 = 16 is the only one that looks nice; if you consider 3, its pairing is roughly 2.47805). It turns out that what really matters is proximity to e (in a weird sense that's related to the Lambert W function). You can try comparing e^x to x^e, or if you want, just graph e^x - x^e and observe that's greater than 0 for x != e. https://www.wolframalpha.com/input?i=min+e%5Ex-x%5Ee https://www.wolframalpha.com/input?i=min+e%5Ex-x%5Ee