Title: Preferred numbers in dozenal
Dan - December 16, 2007 08:07 AM (GMT)
After reading uax's comment in the "1kg water = 1 litre = 1 cubic decimetre" thread, I decided to take a look at Wikipedia's article on
preferred numbers.
| QUOTE (Wikipedia) |
Reynard numbers
The French army engineer Col. Charles Renard proposed in the 1870s a set of preferred numbers for use with the metric system. His system was adopted in 1952 as international standard ISO 3. Renard's system of preferred numbers divides the interval from 1 to 10 into 5, 10, 20, or 40 steps. The factor between two consecutive numbers in a Renard series is constant (before rounding), namely the 5th, 10th, 20th, or 40th root of 10 (1.58, 1.26, 1.12, and 1.06, respectively), which leads to a geometric sequence. This way, the maximum relative error is minimized if an arbitrary number is replaced by the nearest Renard number multiplied by the appropriate power of 10. |
The dozenal equivalent would be divide the interval from 1 to *10 into 6, *10, *20, or *40 steps. Thus, for example, the *R6 series (rounded to one dozenal place) would be:
*R6: *1.0 *1.6 *2.3 *3.6 *5.3 *7.Ɛ
| QUOTE (Wikipedia) |
1-2-5 series
In applications for which the R5 series provides a too fine graduation, the 1-2-5 series is sometimes used as a cruder alternative:
... 0.1 0.2 0.5 1 2 5 10 20 50 100 200 500 1000 ...
This series covers a decade (1:10 ratio) in three steps. Adjacent values differ by factors 2 or 2.5. Unlike the Renard series, the 1-2-5 series has not been formally adopted as an international standard. However, the Renard series R10 can be used to extend the 1-2-5 series to a finer graduation.
The denominations of most modern currencies follow a 1-2-5 series. An exception are some quarter-value coins, such as those of Canada and the United States (the latter denominated as "quarter dollar" rather than 25 cents) |
This is easily dozenalized by changing the factors of 2.5 to factors of 3. Thus, the 1-2-5 series becomes 1-2-6 and the 1-2.5-5 series becomes 1-3-6.
| QUOTE (Wikipedia) |
Capacitors and resistors
International standard IEC 60063 defines another preferred number series that is commonly used for electronic components, especially resistors and capacitors. It works similarly to the Renard series, except that it subdivides the interval from 1 to 10 into 6, 12, 24, etc. steps. These subdivisions ensure that when some random value is replaced with the nearest preferred number, the maximum error will be in the order of 20%, 10%, 5%, etc. |
Wow, a dozenal division of the decade! This could easily be applied to the zenade as well. In any case, we'd need 2 extra colors to indicate the digits Χ and Ɛ on resistors.
kitabatake - December 16, 2007 11:37 AM (GMT)
I use the number series 1, 3, 6, 10dd, 30dd, 60dd, 100dd for my civilization (in my hobby-project)
Would be easy to do exchange, twelve 3-coins or six 6-coins gives one 30dd-bill
The 1,3,6,10dd... series can be used for measuring areas and volumes also.
uaxuctum - December 16, 2007 03:28 PM (GMT)
Months ago on the talk page of the mentioned Wikipedia article I made
a long comment regarding preferred numbers in dozenal (I was user 213.37.6.106 (*) who responded to the question asked by user 68.0.120.35, and also the one who had previously argued there at length with another user regarding the whole "S.I. preferred numbers" nonsense), and what I said there is basically what I have to say on this issue, so I won't repeat myself here. I'll just point out that there are many more possible coherently-dozenal Renard series than the ones you mention, particularly the 3-step series that do not fit in a decimal system, precisely because of ten's poor divisibility (of course no-one stops you from devising a Renard series based on the cube roots of ten, but that would be as inherently anti-decimal as it is basing the nomenclature and S.I. prefixes for huge numbers on powers of ten whose exponents are multiples of the decimal-incompatible numbers 3 and 6).
Dozenal Renard series (irrational values rounded to nearest grossth):
| CODE |
doz R1 ··· 1.00 ···································································································· ·············· 10.00 doz R2 ··· 1.00 ······················································ 3.57 ······················································ 10.00 doz R3 ··· 1.00 ·································· 2.36 ·································· 5.24 ·································· 10.00 doz R4 ··· 1.00 ························ 1.A4 ························ 3.57 ························ 6.54 ························ 10.00 doz R6 ··· 1.00 ·············· 1.62 ·············· 2.36 ·············· 3.57 ·············· 5.24 ·············· 7.B2 ·············· 10.00 doz R10 ·· 1.00 ···· 1.29 ···· 1.62 ···· 1.A4 ···· 2.36 ···· 2.9A ···· 3.57 ···· 4.32 ···· 5.24 ···· 6.54 ···· 7.B2 ···· 9.91 ···· 10.00 doz R20 ·· 1.00 1.14 1.29 1.44 1.62 1.82 1.A4 2.09 2.36 2.66 2.9A 3.16 3.57 3.A1 4.32 4.88 5.24 5.99 6.54 7.1A 7.B2 8.97 9.91 A.9A 10.00 etc. |
(I don't know how the above looks in your browser, but in mine I can't seem to be able to make the table render in a monospaced font, neither using the FONT tag nor by means of the CODE-tag trick. Is there something with the forum settings or with the forum software that disallows monospaced fonts? Because I don't experience this frustrating problem in other forums.)
Dozenal preferred rationals (between one mass and one massth, and restricted to values derived from the factors of the dozen and the gross; note that many other selections, larger and smaller, are possible, as I explained in my referenced comment):
1000, 900, 800, 600, 400, 300, 200, 160, 140, 100, 90, 80, 60, 40, 30, 20, 16, 14, 10, 9, 8, 6, 4, 3, 2, 1.6, 1.4, 1, 0.9, 0.8, 0.6, 0.4, 0.3, 0.2, 0.16, 0.14, 0.1, 0.09, 0.08, 0.06, 0.04, 0.03, 0.02, 0.016, 0.014, 0.01, 0.009, 0.008, 0.006, 0.004, 0.003, 0.002, 0.0016, 0.0014, 0.001
(*) I have a Wikipedia user account (same nick as here), but forgot or didn't care to log in when I initially made an edit to that article (**) and afterwards I didn't find it appropriate to apparently "switch identity" while in the middle of a discussion, so all the comments I made there I signed "anonymously" with the IP address I was using at the time.
(**) Most of the time I cannot be bothered to go through the annoying Wikipedia log-in process just to make some casual edit or typo correction, because it lands you on a different page than the one you were at when you started logging in and then you are only provided with a link to the previous page but not to its previous editing state (so if you had already started, or more often were already finishing, editing that page, you have to use the Go Back button of your browser to get back to where you were when you wanted to log in to sign your edit, and fat chance if your browser no longer has that previous state cached because then all of your editing effort to that page before logging-in will be lost). A particularly exasperating bad-design software behaviour; although in fact the whole Wikipedia editing process is riddled with poor-usability problems, starting by the requirement to edit pages directly in arcane wikicode, which is comparable to forcing everyone who needs a webpage to learn and type HTML directly.
Dan - December 16, 2007 09:26 PM (GMT)
[Note: In this post, all numerals are in dozenal, even in the absence of the * prefix]
An alternate idea to create rounded Reynard series is to start with "convenient" numbers in base-twelve and then round the numbers to those. As a clarification:
Let the "A" series be the factors of a dozen
A: 1, 2, 3, 4, 6
For the "B" series, we take the factors of a gross:
1, 2, 3, 4, 6, 8, 9, 10, 14, 16, 20, 30, 40, 60
and divide by twelve as needed so that all numbers are less than twelve:
1, 2, 3, 4, 6, 8, 9, 1.0, 1.4, 1.6, 2.0, 3.0, 4.0, 6.0
thus arriving at the series:
B: 1, 1.4, 1.6, 2, 3, 4, 6, 8, 9
Similarly, the "C" series uses the factors of a great gross:
1, 2, 3, 4, 6, 8, 9, 10, 14, 16, 20, 23, 28, 30, 40, 46, 54, 60, 80, 90, 100, 140, 160, 200, 300, 400, 600
C: 1, 1.4, 1.6, 2, 2.3, 2.8, 3, 4, 4.6, 5.4, 6, 8, 9
This can be extended to higher powers of twelve:
D: 1, 1.16, 1.4, 1.6, 1.94, 2, 2.3, 2.8, 3, 4, 4.6, 5.4, 6, 6.9, 8, 9, Χ.8
E: 1, 1.16, 1.4, 1.6, 1.83, 1.94, 2, 2.3, 2.8, 3, 3.46, 3.68, 4, 4.6, 5.4, 6, 6.9, 7.14, 8, 9, Χ.8
F: 1, 1.16, 1.228, 1.4, 1.6, 1.83, 1.94, 2, 2.3, 2.454, 2.8, 3, 3.46, 3.68, 4, 4.6, 5.09, 5.4, 6, 6.9, 7.14, 8, 9, Χ.16, Χ.8
G: 1, 1.16, 1.228, 1.323, 1.4, 1.6, 1.83, 1.94, 2, 2.3, 2.454, 2.646, 2.8, 3, 3.46, 3.68, 4, 4.6, 4.8Χ8, 5.09, 5.4, 6, 6.9, 7.14, 8, 9, 9.594, Χ.16, Χ.8
(I expect that "What's after Z?" is unlikely to be a practical concern.)
These series are mentioned in uaxuctum's post on that Wikipedia talk page. What hasn't been mentioned, however, is how these can be combined with the Reynard series. I will do this in my next post...
Dan - December 16, 2007 09:52 PM (GMT)
Now, consider, for example, the 6-step dozenal Renard series. The unrounded (technically, rounded to machine accuracy) series is
*1.0000000000000
*1.61A741A0891B4
*2.3581709AA9197
*3.569B73BB71521
*5.2A93478AB0360
*7.B2054056BA792
We
could round them to two dozenal places, like so:
*1.00, *1.62, *2.36, *3.57, *5.2B, *7.B2
However, we may want to have the additional restriction of only using, say, E-series numbers.
- *1.00 is already an E-series number and will be included as-is.
- *1.61A741A0891B4 will be rounded down to *1.6 or up to *1.83.
- *2.3581709AA9197 will be rounded down to *2.3 or up to *2.8.
- *3.569B73BB71521 will be rounded down to *3.46 or up to *3.68.
- *5.2A93478AB0360 will be rounded down to *4.6 or up to *5.4.
- *7.B2054056BA792 will be rounded down to *7.14 or up to *8.
To decide which one to round to, we choose the one that minimizes the relative error. In order words, the cutoff for rounding up or down is the geometric mean of the two choices.
- sqrt(*1.6 × *1.83) = *1.7112935538B80. The Renard number is less, so we round down.
- sqrt(*2.3 × *2.68) = *2.4937221208B45. The Renard number is less, so we round down.
- sqrt(*3.46 × *3.68) = *3.569B73BB71521. This happens to be exactly equal to the Renard number.
- sqrt(*4.6 × *5.4) = *4.A9552A43A5872. The Renard number is greater, so we round up.
- sqrt(*7.14 × *8) = *7.6614858576652. The Renard number is greater, so we round up.
So, this gives us the series:
E6: 1, *1.6, *2.3, *3.46 or *3.68, *5.4, 8Hmm...how do we choose between *3.46 and *3.68?
uaxuctum - December 17, 2007 12:37 AM (GMT)
That idea is similar to what is done with the 1-2-5-10 series in decimal, which one can see as the rounding of the cubic-root-of-ten logarithmic series (what would be the decimal-though-really-not-so-decimal R3 series) into decimal-compatible rational numbers. This approach offers the arithmetic advantage of only dealing with radix-compatible rational numbers (when considering the actual values rather than their radix-based logarithms). The main problem is that the rounding is often rough and the rounding error very variable, so the growth uniformity provided by a logarithmic series, which is normally the main purpose of using such a series, gets mangled when using these approximations. Continuing with the 1-2-5-10 example, one can see that the second element is twice the previous, but the third jumps to two and a half times, and the fourth returns to twice; so there is a noticeable change in the growth ratio, as can be better appreciated graphically:
|
|
|
|
|
| |
| |
| |
| | |
| | | |
Similarly, the "A" series you mentioned presents significant non-uniform-growth issues:
|
|
|
|
|
|
| |
| |
| | |
| | | |
| | | | |
| | | | | |
That said, regarding your question of whether to round *3.569B73BB71521... to *3.46 or to *3.68, given that their significands have equal digit length, their reciprocal digit sequences also have equal length, and they factorize the same power of the radix (in fact, those two happen to be precisely the reciprocal digit sequence of one another: *346 × *368 = *10^5; which is the reason their geometric mean results in a Renard number—in the square root of twelve to be precise, since sqrt(*3.46 × *3.68) = sqrt((*346 × 368) / (*100 × *100)) = sqrt(*10^5 / *10^4) = sqrt(*10)), I say let's go with the one that is actually (although minimally) closer to the true irrational value:
3.46 − 3.569B73BB71521... = −0.109B73BB71521... ← this one is (a tiny bit) closer
3.68 − 3.569B73BB71521... = +0.112048004A69B...
Another approach could be to compare the growth rates in the series when using one or the other, and choose the one that results in a lower deviation from the mean value, so as to preserve growth uniformity as much as possible.
As a side note, just for reference:
• The four dozen non-trivial (plus one trivial) dozenal digit sequences that factorize the radix powers up to twelve to the twelfth, grouped by reciprocal pairs:
2 × 6 = 3 × 4 = 10^1
8 × 16 = 9 × 14 = 10^2
28 × 46 = 23 × 54 = 10^3
A8 × 116 = 69 × 194 = 10^4
368 × 346 = 183 × 714 = 10^5
1228 × A16 = 509 × 2454 = 10^6
48A8 × 2646 = 1323 × 9594 = 10^7
16B68 × 7716 = 3969 × 31B14 = 10^8
63A28 × 1A946 = B483 × 107854 = 10^9
2134A8 × 58416 = 2A209 × 426994 = 10^A
851768 × 151046 = 86623 × 14A3314 = 10^B
2986628 × 433116 = 217669 × 5751054 = 10^10
It's easy to notice the patterns emerging in their last digits.
Well, it's easier to notice when laid out in a table with right-aligned text, but such is not easy to do in a forum post. :P
Notice also that they are the dozenal respresentation of the powers of two (the first and the fourth element in each row), the powers of three (the third in each row), and twice the powers of three (the second in each row). This property (having a significand with the same digit sequence as one of those, which guarantees their factorization is of the kind 2^m × 3^n (m,n∈Z)) is the identifying look of a dozenal-compatible number in dozenal, just like in decimal the signature appearance of a decimal-compatible number is that its digit sequence coincides with that of the decimal representation of either a power of two or a power of five.
I think at least the three (possibly the four) first rows of the above table should be learned by heart in order to achieve an acceptable level of "dozenal literacy", and the sequences of up to four digits should look at least familiar. Most definitely the two first rows are an absolute sine qua non requirement—not knowing them would be akin to ignoring the pairs 2 × 5 = 10 and 4 × 25 = 100 in decimal. Fortunately, the third row offers nifty mnemonic patterns:
28 × 46 = 1000
↓ 28 ↑
↓ 46 ↑
→ → →
(2-4-6-8)
23 × 54 = 1000
→ →
23 ↓
54 ↓
← ←
(2-3-4-5)
Most of the four-digit sequences also display nice mnemonic patterns:
1228, 1323, 2454, 2646, 3969, 48A8, 7716, 9594, B483
• The eight dozen non-trivial (plus one trivial) dozenal-compatible digit sequences of up to twelve digits:
1
101B6AA6A16
107854
1099346
1139A01B854
116
1182632A8483
1228
124BB369
12B969228
1323
14
1427526116
14A3314
151046
159114277314
16
162B443A323
16B68
1727B09
17B8902B68
183
194
1975AB416
1A584194
1A946
2
203B199183
2134A8
217669
2277803B4A8
23
234506594946
2454
249BA716
25B716454
2646
28
2852A5023
2986628
2A209
2B6228532628
3
305A8878646
31B14
3253A16
33B5605B14
346
350769881209
368
372B9A83
38B48368
3969
4
407A376346
426994
433116
4533407A994
46
468A10B6969
48A8
497B923
4BB2308A8
509
54
54A58A046
5751054
58416
5B0454A65054
6
60B9553509
63A28
64A783
67AB00BA28
69
6A1317542416
714
725B7946
75A94714
7716
8
813873069
851768
86623
8A668139768
9
915821B1716
9594
973B646
9BA461594
A16
A31A85203623
A8
A98B5809
B2A20A8
B483
BA08A990A0A8
Notice that in general they are (much) more abundant the lower the value of their first digit (for the given range, we find two dozen and two of them starting with a one, but only three starting with an eleven; not sure why this is so). If grouped by number of digits, the distribution is more uniform, ranging from six to nine elements per sequence-length group, with an average of between seven and eight.
Notice also that a similar survey for decimal yields a significantly smaller range of compatible digit sequences (since there is only one reciprocal digit sequence pair per power of ten, namely the one formed by the power of two and the power of five of the same exponent as the corresponding power of ten). And the range gets down to minimal when dealing with the dyadic radices (e.g., in binary there is only one compatible digit sequence, namely the trivial 1; in octal there are just three: 1, 2 and 4; and in hexadecimal there are merely four: 1, 2, 4 and 8).
Another notable difference between decimal and dozenal is that in dozenal the reciprocal pairs are more "balanced" (their components have digit sequences of similar length, differing by 0, 1 or 2 digits), whereas in decimal there is a noticeable asymmetry that seems to only get larger and larger:
2 × 5 = 10^1
4 × 25 = 10^2
8 × 125 = 10^3
16 × 625 = 10^4
32 × 3125 = 10^5
64 × 15625 = 10^6
128 × 78125 = 10^7
256 × 390625 = 10^8
512 × 1953125 = 10^9
1024 × 9765625 = 10^10
This means that to cover all compatible digit sequences up to a given length, you have to reach much higher powers of ten than to do the same in dozenal. For example, to cover all two-digit sequences in dozenal you don't need to go past the zyriad, whereas in decimal you'll have to reach the million; for three-digit sequences, the zillion is enough in dozenal, and the longest sequences in the set will be four-digit (1228 and 2454), whereas you'll have to soar to the thousand million in decimal, getting even a seven-digit sequence (1953125) in the process.
Dan - December 17, 2007 03:46 AM (GMT)
| QUOTE (uaxuctum @ Dec 16 2007, 06:37 PM) |
| I say let's go with the one that is actually (although minimally) closer to the true irrational value: |
OK, so you mean define "closer" in absolute rather than relative terms. Applying this to all rounding gives us the series:
A: 1, 2, 3, 4, 6
A1: 1
A2: 1, 3
A3: 1, 2, 6
A4: 1, 2, 3, 6
A5: 1, 2, 3, 4, 6
B: 1, 1.4, 1.6, 2, 3, 4, 6, 8, 9
B1: 1
B2: 1, 3
B3: 1, 2, 6
B4: 1, 2, 3, 6
B5: 1, 1.6, 3, 4, 8
B6: 1, 1.6, 2, 3, 6, 8
B7: 1, 1.6, 2, 3, 4, 6, 8
B8: 1, 1.4, 2, 3, 3, 4, 6, 9
B9: 1, 1.4, 1.6, 2, 3, 4, 6, 6, 9
Looks like we'll have to go pretty far down the alphabet to get good logarithmic spacing.
Dan - December 19, 2007 05:02 AM (GMT)
| QUOTE (uaxuctum @ Dec 16 2007, 06:37 PM) |
| Notice that in general they are (much) more abundant the lower the value of their first digit (for the given range, we find two dozen and two of them starting with a one, but only three starting with an eleven; not sure why this is so). If grouped by number of digits, the distribution is more uniform, ranging from six to nine elements per sequence-length group, with an average of between seven and eight. |
The distribution is also more uniform if you take the logarithms.
0.0000000000000
0.00950B6B11429A5B
0.0302A9135489B93
0.0397B8826610979
0.06059626A957B66
0.069AA595BA9A951
0.0773B5451021737
0.09A192A95368924
0.0A76A25864AB70A
0.10A48000A83690
0.11798B6BB9796A
0.14807883524767
0.15558832638A46
0.17836596A71565
0.18587545B85843
0.1A8652AA3BA362
0.1B5B6259512640
0.2034720862691B
0.22624B70A5B43A
0.23375B1BB73718
0.256538843A8237
0.263A4833500516
0.29413546A49313
0.2A1644B5B615B1
0.3044225A396110
0.311932094AA3AB
0.34201B20A371A8
0.34B52A8BB4B486
0.37230834383BA5
0.37B817A3498284
0.3A25B5479109A2
0.3ABB04B6A25081
0.3B941465B3935B
0.4201B20A371A7A
0.42970179486159
0.45049B218BA877
0.4599AA90A12B56
0.48A097A435B953
0.4975A753474032
0.4BA384B78A8751
0.50789466A00A2B
0.52A6720B23554A
0.537B817A349828
0.54549129461B07
0.56826A91896625
0.57577A409AA904
0.598557A5223423
0.5A5A6754337701
0.5B33770344B9A0
0.616154678844BB
0.62366416998799
0.6464417B2112B8
0.6539512A325596
0.68403A41872394
0.691549B0986672
0.6B4327551BB191
0.70183704313470
0.72461468747B8A
0.731B2417860269
0.73B43386974547
0.7622112B1A9066
0.76B7209A301344
0.7924BA42735A63
0.79BA09B184A142
0.8100B705196B3B
0.819606742AB219
0.8403A418723938
0.8498B387838017
0.87069130070736
0.879BA09B184A14
0.8874B04A2990B3
0.8AA289B2711812
0.8B779961825AB0
0.91A5770605A60B
0.927A86751728A9
0.93539624286B88
0.958173886BB6A6
0.96568337813985
0.988460A00484A4
0.9959704B160782
0.A06059626A957B
0.A135691180185A
0.A3634676036379
0.A438562514A657
0.A6663389583176
0.A73B4338697455
0.A81452A77AB733
0.AA423050024252
0.AB173BBB138530
0.B21A291268532A
0.B2B33881799608
0.B5211626012127
0.B5B62595126405
0.B824033955AB24
0.B8B912A8673203
0.BB26B050AA7922
Dan - July 1, 2008 12:54 AM (GMT)
OK, I'll try a different approach. First, some definitions:
The
nth
factor series is FS(n) = {significand of x: x is a factor of radix^n}
For example, in decimal:
- FS(0) = {1}
- FS(1) = {1, 2, 5}
- FS(2) = {1, 2, 2.5, 4, 5}
- FS(3) = {1, 1.25, 2, 2.5, 4, 5, 8}
- FS(4) = {1, 1.25, 1.6, 2, 2.5, 4, 5, 6.25, 8}
- FS(5) = {1, 1.25, 1.6, 2, 2.5, 3.125, 3.2, 4, 5, 6.25, 8}
- FS(6) = {1, 1.25, 1.5625, 1.6, 2, 2.5, 3.125, 3.2, 4, 5, 6.25, 6.4, 8}
and in dozenal:
- FS(0) = {1}
- FS(1) = {1, 2, 3, 4, 6} = A series
- FS(2) = {1, 1.4, 1.6, 2, 3, 4, 6, 8, 9} = B series
- FS(3) = {1, 1.4, 1.6, 2, 2.3, 2.8, 3, 4, 4.6, 5.4, 6, 8, 9} = C series
- FS(4) = {1, 1.16, 1.4, 1.6, 1.94, 2, 2.3, 2.8, 3, 4, 4.6, 5.4, 6, 6.9, 8, 9, Χ.8} = D series
So far, there's nothing new except the notation: For the purposes of this post, it will be easier to refer to the factor series by number instead of by letter.
The
regularity order of a rational number
q, denoted reg(q), is the smallest nonnegative integer
n such that
q is in FS(n). If no such
n exists, then reg(q) = infinity.
For example, in dozenal:
- reg(1) = 0
- reg(2) = reg(3) = reg(4) = reg(6) = 1
- reg(5) = infinity
- reg(8) = reg(9) = 2
- reg(2.3) = 3
Now, suppose that we wish to approximate pi using the decimal (because right now I'm too lazy to use
baseconv) factor series. Let
p denote the approximation.
If we use FS(1), we have three choices: p=1, p=2, or p=5. We decide between them by minimizing the logarithmic error.
- For p=1, the error is | log10(1) - log10(pi) | = 0.4971498726941338
- For p=2, the error is | log10(2) - log10(pi) | = 0.19611987703015266
- For p=3, the error is | log10(5) - log10(pi) | = 0.20182013164188495
So we choose p=2.
In general, let the
factor series approximation FSA(x, n) = the number
y in FS(n) that minimizes the quantity | log(y) - log(x) |. If there is an exact tie between two candidate y's, we choose the smaller one.
To be continued...
Dan - July 19, 2008 04:40 AM (GMT)
Continuing in decimal...
- FSA(pi, 0) = 1
- FSA(pi, 1) = 2
- FSA(pi, 2) = 2.5
- FSA(pi, 3) = 2.5
- FSA(pi, 4) = 2.5
- FSA(pi, 5) = 3.125
- FSA(pi, 6) = 3.125
- FSA(pi, 7) = 3.125
- FSA(pi, 8) = 3.125
... - FSA(pi, 98) = 3.15544362088404728439172686194069683551788330078125
In this list of approximations, there is of course a trade-off between accuracy and simplicity. There are two ways to approach this tradeoff:
- Find the most accurate approximation given a constraint on the simplicity.
- Find the simplest approximation given a constraint on the accuracy.
The first is what FSA does. For the second, we define the
lowest regularity order approximationLRO(x, t) = FSA(x, k), where k is the smallest nonnegative integer satisfying | ln(FSA(x, k)) - ln(x) | < t.
For example,
- LRO(pi, 0.5) = 2 (logarithmic error is 0.45158270528945488 < 0.5)
- LRO(pi, 0.25) = 2.5 (logarithmic error is 0.22843915397524506 < 0.25)
- LRO(pi, 0.01) = 3.125 (logarithmic error is 0.0052956026610353479 < 0.01)
To be continued...
Dan - July 19, 2008 05:22 AM (GMT)
From this, we can define the
LRO series of preferred numbers as:
LROS(N, T) = {LRO(base^(k/N), T * ln(base) / (2N)) for k in [0, 1, 2, ..., N-1]}
For example, in decimal:
- LROS(5, 1)[0] = LRO(10^(0/5), ln(10)/10) = 1
- LROS(5, 1)[1] = LRO(10^(1/5), ln(10)/10) = 1.6
- LROS(5, 1)[2] = LRO(10^(2/5), ln(10)/10) = 2
- LROS(5, 1)[3] = LRO(10^(3/5), ln(10)/10) = 5
- LROS(5, 1)[4] = LRO(10^(4/5), ln(10)/10) = 6.25
Producing the series {1, 1.6, 2, 5, 6.25}.
Dan - August 22, 2008 03:38 AM (GMT)
Or, in Python:
| CODE |
"""Preferred Numbers module"""
from __future__ import division
import math as _math from gmpy import mpq as _Rational
class _Memoize(object): """ Decorator to save function return values for efficiency. """ def __init__(self, func): self._func = func self._cache = {} def __call__(self, *args): try: return self._cache[args] except KeyError: value = self._func(*args) self._cache[args] = value return value
@_Memoize def factors(num): """ Return the factors of a small positive integer. """ return [divisor for divisor in xrange(1, num) if num % divisor == 0]
@_Memoize def factor_series(degree, base): """ The characteristics of the factors of base**degree. """ if degree == 0: return [_Rational(1)] else: result = set() for old in factor_series(degree - 1, base): for factor in factors(base): product = old * factor if product >= base: product *= _Rational(1, base) result.add(product) return sorted(result)
def lro(num, tol, base): """ Lowest Regularity Order approximation of num, where tol = maximum error in the natural logarithm. """ # Loop for degree in [0, 1, 2, ...] until we find a factor series # with a good enough match degree = 0 while True: candidates = [(approx, abs(_math.log(approx) - _math.log(num))) for approx in factor_series(degree, base)] candidates = [(approx, error) for (approx, error) in candidates if error < tol] if candidates: break degree += 1 # Find the candidate approximation with the smallest error. # If a tie (to within the fudge factor), return the smallest. fudge = 1 + 2 ** -50 best_error = min(error for (approx, error) in candidates) * fudge return sorted(approx for (approx, error) in candidates if error <= best_error)[0]
def lros(count, tol, base): """ LRO series of preferred numbers. """ return [lro(base ** (index / count), tol * _math.log(base) / (2 * count), base) for index in xrange(count)] |
Dan - August 22, 2008 04:09 AM (GMT)
So, in decimal, we have:
LROS(5, 1) = {1.0, 1.6, 2.0, 5.0, 6.25}
LROS(5, 0.1) = {1.0, 1.6, 2.5, 4.0, 6.25}
LROS(5, 0.01) = {1.0, 1.5845632502852867, 2.5108406941546719, 3.9827297778311306, 6.3108872417680937}
LROS(10, 1) = {1.0, 1.25, 1.6, 2.0, 2.5, 3.2, 4.0, 5.0, 6.25, 8.0}
LROS(10, 0.1) = {1.0, 1.25, 1.6, 2.0, 2.5, 3.1691265005733, 4.0, 5.0, 6.25, 8.0}
LROS(10, 0.01) = {1.0, 1.2580368690619399, 1.5845632502852867, 1.9934389902195133, 2.5108406941546719, 3.165829138855738, 3.9827297778311306, 5.0164565101131178, 6.3108872417680937, 7.9488926325796294}
And, in dozenal:
LROS(6, 1) = {1, 1.6, 2, 3, 6, 8}
LROS(6, 0.1) = {1, 1.6, 2.34506594946, 3.50769881209, 5.317B5804588A8, 8}
LROS(6, 0.01) = {1, 1.6204B6973277A7A, 2.3596561863A0857, 3.56387A0A3112075, 5.2A6093B799B7029, 7.B130131B4A77242}
LROS(10, 1) = {1, 1.4, 1.6, 2, 2.3, 3, 3.46, 4, 5.4, 6, 8, 9}
LROS(10, 0.1) = {1, 1.2946350B476495A, 1.62B443A323, 1.A584194, 2.34506594946, 2.986628, 3.56387A0A3112075, 4.33116, 5.317B5804588A8, 6.4A783, 7.A85B26068714, 9.8AA141A5B666069}
Now, we need to decide our preferred sets of preferred numbers.
BTW, does anyone have any comments? I've been talking to myself for a while.