Saturday, April 28, 2018

[ikaajwwn] Golden subdivisions of a day

A day divided by phi, phi^2, etc.  Not sure what higher powers of phi might be useful for.

Also consider dividing the sidereal rotation period, not the 24-hour solar day.

0 = 24h 0m 0.000s
1 = 14h 49m 58.137s
2 = 9h 10m 1.863s
3 = 5h 39m 56.273s
4 = 3h 30m 5.590s
5 = 2h 9m 50.683s
6 = 1h 20m 14.907s
7 = 0h 49m 35.776s
8 = 0h 30m 39.131s
9 = 0h 18m 56.645s
10 = 0h 11m 42.485s
11 = 0h 7m 14.160s
12 = 0h 4m 28.326s
13 = 0h 2m 45.834s
14 = 0h 1m 42.491s
15 = 0h 1m 3.343s
16 = 0h 0m 39.148s
17 = 0h 0m 24.195s
18 = 0h 0m 14.953s
19 = 0h 0m 9.242s
20 = 0h 0m 5.712s
21 = 0h 0m 3.530s
22 = 0h 0m 2.182s
23 = 0h 0m 1.348s
24 = 0h 0m 0.833s
25 = 0h 0m 0.515s
26 = 0h 0m 0.318s
27 = 0h 0m 0.197s
28 = 0h 0m 0.122s

24 = 1.200 Hz
25 = 1.942 Hz
26 = 3.142 Hz
27 = 5.083 Hz
28 = 8.225 Hz
29 = 13.308 Hz
30 = 21.534 Hz
31 = 34.842 Hz
32 = 56.376 Hz
33 = 91.218 Hz
34 = 147.593 Hz
35 = 238.811 Hz
36 = 386.404 Hz
37 = 625.214 Hz
38 = 1.012 kHz
39 = 1.637 kHz
40 = 2.648 kHz
41 = 4.285 kHz
42 = 6.934 kHz
43 = 11.219 kHz
44 = 18.153 kHz
45 = 29.372 kHz
46 = 47.525 kHz
47 = 76.896 kHz
48 = 124.421 kHz
49 = 201.317 kHz
50 = 325.738 kHz
51 = 527.055 kHz
52 = 852.793 kHz
53 = 1.380 MHz
54 = 2.233 MHz
55 = 3.612 MHz
56 = 5.845 MHz
57 = 9.458 MHz
58 = 15.303 MHz
59 = 24.760 MHz
60 = 40.063 MHz
61 = 64.823 MHz
62 = 104.887 MHz
63 = 169.710 MHz
64 = 274.597 MHz
65 = 444.307 MHz
66 = 718.903 MHz
67 = 1.163 GHz
68 = 1.882 GHz
69 = 3.045 GHz
70 = 4.927 GHz
71 = 7.973 GHz
72 = 12.900 GHz
73 = 20.873 GHz
74 = 33.773 GHz
75 = 54.646 GHz
76 = 88.419 GHz
77 = 143.065 GHz
78 = 231.485 GHz
79 = 374.550 GHz
80 = 606.035 GHz
81 = 980.585 GHz
82 = 1586.619 GHz
83 = 2567.204 GHz
84 = 4153.823 GHz
85 = 6721.028 GHz

[iueeifyd] Building a black hole the straightforward way

Currently popular is the idea of constructing an artificial black hole (to use as a compact power source) out of light: a kugelblitz.  However, is that route to black hole easier than building one out of regular matter?  In thermonuclear bombs we've gotten pretty good at compressing matter using radiation pressure (hohlraum), so just scale it up.

[lajyvhrh] Mass = time = temperature = power

There exists a black hole mass whose Hawking radiation is in equilibrium with the current cosmic background radiation.  What is that mass?

Friday, April 27, 2018

[poaebmuk] Sphere constant

Pi is a mathematical constant used in the formulae for many geometric objects, of which we provocatively claim the most relevant in our 3-dimensional world is the sphere, not the 2D circle.

Arrange the digits of pi on or in a sphere.

Tuesday, April 24, 2018

[kkdnzbbn] Experiments with 1/x and the natural logarithm

The integral of 1/x is log(x).  For u=x+delta, the area under the curve between 1/u and 1/(u+1) is exactly log(u)-log(u-1) and approximately 1/x for some delta.  Define f(delta,x)=log(x+delta)-log(x+delta-1).  We experiment with different values of the delta offset, seeking to approximate 1/x well.

The value delta=0.5 is optimal for large x in the following sense.  Define the error function Y(delta,x)=1/f(delta,x) - x.  Then (limit (x tends to infinity) of Y(0.5,x)) = 0.  However, approximations for small x are not so good: f(0.5,1) = 1.0986 = 1/0.9102.  f(0.5,2) = 1/1.9576.

The value delta1=1/(e-1) = 0.581976706869326424385 causes the approximation to be exact at (only) x=1: f(delta1,1)=1.  f(delta1,2)=1/2.0413.

For general delta, we claim without proof that (limit (x tends to infinity) of Y(delta,x)) = delta-0.5.  For the above value delta1, f(delta1,x) ~= 1/(x+0.081976706869326424385) for large x.

Motivation is to sample from the Zipf distribution without having to compute and store partial sums of the harmonic series.  Could also do a hybrid approach of computing and storing the probabilities of the more frequent items and using the above continuous approximation for the rest.

Monday, April 16, 2018

[ljdyledo] Sort of UTF-6

We present an encoding of Unicode code points to printable ASCII characters that keeps English text vaguely readable.  It accomplishes a similar purpose as Quoted-Printable.  This design is modeled after UTF-8.  We use 6-bit bytes instead of UTF-8's 8-bit bytes.  We also do not encode the number of continuation bytes in the first byte; instead, the most significant bit (high bit) signifies whether a byte is followed by further continuation bytes.  The last byte of a sequence does not have its high bit set, signifying it is the last byte of a sequence representing one Unicode character.  The binary bits of the Unicode code point numbers of various magnitudes are encoded big-endian into the x's as follows:

  • 0xxxxx
  • 1xxxxx 0xxxxx
  • 1xxxxx 1xxxxx 0xxxxx
  • 1xxxxx 1xxxxx 1xxxxx 0xxxxx
  • ...

This encoding can encode values of arbitrary size, in contrast to the 36-bit limit of UTF-8 extended in the obvious way.  But this is a moot point (for now) as Unicode was originally limited to 31 bits, and later (including currently) limited further to 21 bits.

Here, in order, are the 64 printing characters used to encode a 6-bit byte.  It is modeled after ASCII, but some common punctuation namely ;,-.? has been moved so that it remains unchanged when encoded.  (The moved punctuation was moved only up or down a column of the 16-wide ASCII table, preserving low-order bits out of tradition).  The second row, beginning with @, are characters that will only be used in multibyte sequences.  The first row, beginning with space, represents characters which will be unchanged when encoded but can also occur as the last byte of a multibyte sequence.

 abcdefghijklmnopqrstuvwxyz;,-.?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_

The following is how Unicode code points 0 through 127 are encoded.  Here is a 16-wide ASCII table to see the corresponding original characters.

BaBbBcBdBeBfBgBhBiBjBkBlBmBnBo
BpBqBrBsBtBuBvBwBxByBzB;B,B-B.B?
 CqCrCsCtCuCvCwCxCyCzC;,-.C?
CaCbCcCdCeCfCgChCiCj;ClCmCn?
AaAbAcAdAeAfAgAhAiAjAkAlAmAnAo
ApAqArAsAtAuAvAwAxAyAzA;A,A-A.A?
Cpabcdefghijklmno
pqrstuvwxyzCkC,C-C.Co

The fact that some multibyte sequences are terminated by space (e.g., code points 48 and 64, corresponding to the digit zero and the at-sign respectively) is a little unfortunate.

Here is some more text containing higher Unicode code points, followed by its vaguely readable encoding:

lowercase Capitalized camelCase UPPERCASE numbers 0123456789 common punctuation ;,-.? at-sign @ bob@example.com http://example.com exclamation ! (parentheses) time 12:01 tilde ~ ‘single curly quotes’ “double curly quotes” yen ¥ euro € en–dash em—dash ellipsis … y-umlaut ÿ eng ŋ tent emoji ⛺ fire kanji 火 canoe emoji 🛶 newline

lowercase Acapitalized camelAcase AuApApAeArAcAaAsAe numbers C CaCbCcCdCeCfCgChCi common punctuation ;,-.? at-sign A  bobA example.com httpCjC?C?example.com exclamation Cq CxparenthesesCy time CaCbCjC Ca tilde C. H@xsingle curly quotesH@y H@,double curly quotesH@- yen Ee euro HEl enH@sdash emH@tdash ellipsis HAf y-umlaut G? eng Jk tent emoji IWz fire kanji \Ck canoe emoji C]Wv newlineBj

We implemented an encoder and decoder in Haskell (after first trying in Perl but finding it to be the wrong tool).  Some code excerpts:

We represented bytes as lists of Bool, sometimes little-endian sometimes big-endian depending on where we were in the conversion.  This is highly space-inefficient, but does allow some elegant code.  Given a list of big-endian bytes, splitting off the initial bytes that all have their high (first) bit set is elegantly span head.  This is used in decoding.

type Bstring=[Bool];
myspan :: [Bstring] -> ([Bstring],[Bstring]);
myspan = span head; -- takeWhile (\l -> head l == True)

Conversion to binary is an unfold.  Output is little-endian.

to_binary :: Integer -> [Bool];
to_binary = unfoldr (\n -> if n==0 then Nothing else Just (case divMod n 2 of {(q,r) -> (r==1,q)}));

Conversion from big-endian binary to an integer is a fold.

from_binary :: [Bool] -> Integer;
from_binary = foldl' (\accum b -> 2*accum+(if b then 1 else 0)) 0;

A few times we relied on the fact that mod x y with x negative and y positive yields a positive result.  This is in contrast to rem x y which would return a negative result.

Wednesday, April 04, 2018

[dahjjtaq] Fingerprint and PIN

Are there any phones which can be set to requiring both scanning a fingerprint and typing a PIN or password in order to unlock, for increased security?

We want "and" not "or" as most phones currently do.

[xfkccubv] Decrypt incorrectly to comprehensible text

Use a very good language model (e.g., LSTM) when encoding and encrypting text so that decrypting with the wrong key will result not in nonsense but normal-seeming text.  One could give a false key under duress.

Bit of a problem that it needs to decrypt to text that it is plausible someone would want to encrypt; there isn't much of a language model for that.

Could also do for pictures: there is a good model, namely porn, for pictures people would want to encrypt.  Then, encrypt text as a picture of text.

Another scenario is a master key to a password manager.  Each encrypted password should have a "language model" associated with it (used or valid password characters, or a more sophisticated password generating scheme like diceware), then an incorrect master password will generate incorrect passwords consistent with its language model or scheme.

[njogcgwc] In praise of calculating pi

Calculating pi to a record number digits stress-tests CPU, memory, and disk: there must not be even a 1-bit error in (typically) months of calculation.

Better -- a less complicated calculation which accomplishes the same tasks -- would be calculating sqrt(2)/2 in binary.  It can more easily be checked afterwards: just square it or compute 0.5/x.  But does calculating pi (using a Ramanujan-style formula with binary splitting as recent PC-based (not supercomputer) records have) test things that sqrt(2) (presumably calculated using Newton's method, an algorithm more similar to Brent-Salamin, not used in recent record-setting pi calculations) would not?

We specify sqrt(2)/2 and not sqrt(2) to eliminate ambiguity about whether calculating N bits includes the bits to the left of the radix point for numbers greater than 1.  There is something elegant about the square root of X in base X: dividing by X is simply a right shift.  However, one could do radix conversion to base 10 at the end.

In contrast to pi, sqrt(2)/2 has a nice feature that subsequent calculations to more bits can start from a previously published result then do more Newton iterations.  Slightly better would be if the fraction, before the final division, were published.

Parallel over many computers would also stress-test network, though it might be tricky to avoid it becoming a bottleneck.  Maybe file storage with disk arrays interconnected by network.

Are there better ways to test these things?  Probably something involving cryptographic hashes like Argon2, though it's not so glamorous.  Also cache-oblivious matrix transpose.