272 points · by twic · 11y ago · 40 comments
edit - on second thoughts, twelfth root of ten isn't particularly helpful for musical notes, where the factor between semitones is the twelfth root of two. So... carry on.
def series(x, precision=2)
root = 10 ** (1 / x.to_f)
return x.times.map {|i| (root ** i).round(precision)}
end
> series(2)
=> [1.0, 3.16]
> series(5)
=> [1.0, 1.58, 2.51, 3.98, 6.31]
> series(10)
=> [1.0, 1.26, 1.58, 2.0, 2.51, 3.16, 3.98, 5.01, 6.31, 7.94]
And of course, if you want more aesthetically pleasing increments (like for axis markers on a logarithmic graph), just round each increment as desired. I usually find that the [1, 2, 5] series is sufficient.[0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500]
The USD is close, too. Bills are in 1, 2, 5, although the $2 bill is rare. For some reason our coins are irregular, although people in my experience find all coins a bother.
The "ideal" set of 3 denominations would be 1, 2.15, and 4.64.
: user@debian:~; python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> (10**(1+np.arange(24)/24.0)).reshape((2,3,4)).round()
array([[[ 10., 11., 12., 13.],
[ 15., 16., 18., 20.],
[ 22., 24., 26., 29.]],
[[ 32., 35., 38., 42.],
[ 46., 51., 56., 62.],
[ 68., 75., 83., 91.]]])
>>> (10**(2+np.arange(48)/48.0)).reshape((2,3,8)).round()
array([[[ 100., 105., 110., 115., 121., 127., 133., 140.],
[ 147., 154., 162., 169., 178., 187., 196., 205.],
[ 215., 226., 237., 249., 261., 274., 287., 301.]],
[[ 316., 332., 348., 365., 383., 402., 422., 442.],
[ 464., 487., 511., 536., 562., 590., 619., 649.],
[ 681., 715., 750., 787., 825., 866., 909., 953.]]])
>>>
Hmm, Ruby has a numpy-like thing too, no? NArray, it’s called? There
are a few minor differences, but you can do the same thing: : user@debian:~; irb
irb(main):001:0> require 'narray'
=> true
irb(main):002:0> (10*10**(NArray.float(24).indgen!/24)).round.reshape(4,3,2)
=> NArray(ref).int(4,3,2):
[ [ [ 10, 11, 12, 13 ],
[ 15, 16, 18, 20 ],
[ 22, 24, 26, 29 ] ],
[ [ 32, 35, 38, 42 ],
[ 46, 51, 56, 62 ],
[ 68, 75, 83, 91 ] ] ]
irb(main):003:0> (100*10**(NArray.float(48).indgen!/48)).round.reshape(8,3,2)
=> NArray(ref).int(8,3,2):
[ [ [ 100, 105, 110, 115, 121, 127, 133, 140 ],
[ 147, 154, 162, 169, 178, 187, 196, 205 ],
[ 215, 226, 237, 249, 261, 274, 287, 301 ] ],
[ [ 316, 332, 348, 365, 383, 402, 422, 442 ],
[ 464, 487, 511, 536, 562, 590, 619, 649 ],
[ 681, 715, 750, 787, 825, 866, 909, 953 ] ] ]
irb(main):004:0>
Presumably 12, 24, and 48 were chosen because they are
https://en.wikipedia.org/wiki/Highly_composite_numbers, and 96 and 192
for compatibility with 48 (since the HCNs in that neighborhood — 60,
120, and 180 — aren’t divisible by 48.)(Related joke: How do we know the Babylonians were idiots? Because the day doesn’t have 83160 seconds.)
For example, perhaps cars designed in America tend to be more|less aesthetically pleasing because American designers will round up to an inch whereas European designers are (hypothetically) unlikely to feel the need to round up to 2.54 cm instead of say 2.5 cm.
So imagine you have a landscape architect designing the interior of a park and a civil engineer designing the city around it. In the metric system, their preferred placements automatically agree. In imperial units they have to coordinate that.
Basically re-creating the nice aspect of imperial units within the metric system.
(Though I must say, I’m also partial to the Babylonian base 60 system.)
24 is similarly divisible by 2,3,4,6,8,12, whereas 25 is only evenly divisible by 5. So those odd-looking "constants" are good for something after all.
http://hooniverse.com/2015/05/12/review-2015-toyota-prius-c/...