This weekend I came across a remarkable post from Casey Handmer1.
The context is that this algorithm can be used on a Curta mechanical calculator2 to rapidly determine the square root of some arbitrary number to a surprising number of sig figs in just 2 steps.
This caused a few reactions reactions in me:
I suddenly deeply desired to own a Curta mechanical calculator (and a slide rule), despite their substantial cost and rarity.
I became very interested in mechanical computational tools.
I wanted to share my favorite mental math trick.
Logarithmetic
I learned this trick from a very senior engineer a few years ago3. It’s a fun and simple way to estimate the products and quotients of very large and very small numbers. Since we do a lot of quantum stuff around here, you can see how it might be useful to quickly compare 5 GHz in energy units to 100 mK in energy units. The longform way requires multiplying by Planck’s constant (6.62607015×10−34 J⋅Hz−1) and Boltzmann’s constant (1.380649×10−23 J⋅K−1). Theorists like to set these numbers to 14, but sometimes you need to know the actual value.
You might also end up needing to change units from J —> eV, or some even more cursed form of energy accounting.
Instead of using your calculator like a normal person, you can convert these big and small numbers to dB. This converts the multiplication and division into sums and differences, respectively, and the very large and very small numbers become two or three digit numbers that can be manipulated trivially in your head. Then just convert back at the end and you’ll be reasonably close.
If you need to do powers, well that’s just multiplication and division in dB space.
Convert to dB
The conversion is quite simple. X in dB is 10*log(X). You might want to memorize the first 10 dB or so, but you could do pretty well just remembering that moving 3 dB up or down is a factor of 2 and 10 dB is a factor of 10.
for i in range(11):
print(f'{i} dB = {10**(float(i)/10):3.3f}')
0 dB = 1.000
1 dB = 1.259
2 dB = 1.585
3 dB = 1.995
4 dB = 2.512
5 dB = 3.162
6 dB = 3.981
7 dB = 5.012
8 dB = 6.310
9 dB = 7.943
10 dB = 10.000
Casey’s Example
If you wanted to do this for the square root of 500, here’s how that would go.
1000 is 30 dB, so half of that is 500, which is 27 dB
Sqrt in dB space is division by 2, so we get 13.5 dB.
13 dB is 20 (10 dB is 10, +3 dB doubles it)
+0.5 dB is about +12 percent, so we’ll get 22.4.
22.4^2 = 501.76
Not as close as Casey got, and with more steps. BUT almost entirely addition/subtraction.
A Physics Example
This gets more interesting as the numbers get bigger (and smaller).
Say you wanted to estimate whether 90 mK is large or small compared to 7 GHz.
Yes, we could turn to Wolfram Alpha, but there’s a twist! We’re at a party5!
Let’s try some Logarithmetic-
How did we get here? Well recall, we are doing 10*log(X) so we immediately get turn every multiplication into an addition, and the division into a subtraction. Concretely:
We end up with about 6 dB. Which is 4. That is to say, 7 GHz in energy units is about 4 times greater than 90 mK in energy units. Easy, peasy.
I went and checked this with Wolfram Alpha, to let it handle the units. The result is 3.733, which means the calculation in dB is within 10% . It’s fast once you get used to it!
Final Words
I love this method for when I need to do an estimate and an order of magnitude isn’t quite good enough. Or, when there are enough coefficients that aren’t ~ 1 that I might be gaining/losing an order of magnitude if I don’t keep track of them.
It requires some memorization, but you shouldn’t let that dissuade you6.
A genuinely interesting guy with a genuinely interesting blog and a genuinely interesting startup. A ‘good follow’ as they say on Twitter.
Find more algorithms here: https://curta.org/wiki/CurtaAlgorithms
It actually took me a few tries, because during the first couple demonstrations I was most staring slack jawed at what was happening before me.
Cowards.
I always talk shop at parties.
We physicists like to brag about not needing to memorize anything. “I can just derive it”. This is actually a lie. It is good and important to strategically memorize useful numbers/important techniques. You would never brag about deriving multiplication from addition every time you needed it, would you?
Casey comes across as rather arrogant to me and he seems surprisingly proud of working on the failed hyperloop nonsense. A good follow? I'm not so sure.
Edit: After checking out his startup I'm even more skeptical. His white paper on "Terraformer One" has more holes than Swiss cheese.