### A-A-B-B-A

I’ll give you up only when the sun’s cold

And my hurting you is forbode

Shan’t ever run aroun’

Nor ever let you down

You’ve just been limerickrolled.

I’ll give you up only when the sun’s cold

And my hurting you is forbode

Shan’t ever run aroun’

Nor ever let you down

You’ve just been limerickrolled.

Comments Off on A-A-B-B-A

It’s the twenty-first century. Where are the flying cars? The videophones? What about the robot barbers and tailor engines? I’m kind of glad we didn’t get radium fireplaces though.

More images of the year 2000 from 1910 at the National Library of France.

Comments Off on 2000 in 1910

gdb has this awesome feature that nobody seems to have heard of (including myself before today). You can set breakpoints by regex!

“help rbreak”

Comments Off on Regex breakpoints in gdb

In the third century BC, Archimedes calculated an amazing approximation to π, bettering the old value of 256/81 worked out by 17th century Egyptians.

How did he do it? He circumscribed and inscribed a hexagon around a circle, then bisected each hexagon’s central angles to make a dodecagon, then a 24-gon, 48-gon, and finally a 96-gon. The perimeters of the polygons bound π above and below, and each pair of perimeters is related to the ones before.

Consider a pair of polygons being bisected:

If the radius AO = 1, then AB = tan α and AC = tan ½α.

If it has *n* sides, the outer perimeter *P* = 2*n* tan α and the new polygon has perimeter *P’* = 4*n* tan ½α. The inner perimeter is *p* = 2*n* sin α, with the new polygon’s perimeter being *p’* = 4*n* sin ½α.

Now, 1/*P* + 1/*p* = 1/(2*n* tan α) + 1/(2*n* sin α) = (sin α + tan α)/(2*n* sin α tan α) = (1 + sec α)/(2*n* tan α) = (cos α + 1)/(2*n* sin α) = (cos² ½α – sin² ½α + 1)/(4*n* sin ½α cos ½α) = (2 cos² ½α – 1 + 1)/(4*n* sin ½α cos ½α) = (1/2*n*) cot ½α = 2/*P’*

And, *P’ p* = (4*n* tan ½α)(2*n* sin α) = 16*n*² tan ½α sin ½α cos ½α = 16*n*² sin² ½α = *p’*²

So, we have easy ways to calculate successive perimeters from our basic hexagons, with *p* = 6, *P* = 4 √3, using only simple arithmetic and square roots.

n |
P |
p |
---|---|---|

6 | 6.928203 | 6 |

12 | 6.430781 | 6.211657 |

24 | 6.319320 | 6.265257 |

48 | 6.292172 | 6.278700 |

96 | 6.285429 | 6.282064 |

which puts 3.1427 > π > 3.1410.

Now, Archimedes didn’t have trigonometric functions to utilize in his calculations, so he calculated the perimeters using similar triangles, a much more complicated process. But it gives the same values. He also lacked decimals, so he worked with rationals instead, producing the bounds 3 1/7 > π > 3 10/71.

Comments Off on Archimedes simplified

I recently was amused by the “song chart” meme, so decided to give it a try.

Comments Off on Song chart

It’s been pointed out I’m not really addressing what’s wrong with the two arguments which give you different “correct” choices for the Newcomb scenario. So here we go…

**Expected Outcome**

This argument assumes that the predictor has foreseen our choice [with high probability]. If however we assume that free willed choices are by definition unpredictable, this is a logical impossibility.

**Dominant Outcome**

This argument assumes that the choice we make is not correlated with the predictor’s choice, because that would involve reverse causation. However, if we assume that we’re not free willed, or that freely willed choices can be predicted (whatever that would involve), then there’s a common cause: Our mind’s tendency to select choice X in the scenario causes both our selection of X when we’re in the scenario and the predictor to anticipate this selection. So, our choice wouldn’t be independent of the predictor’s, and dominance wouldn’t hold.

Comments Off on Newcomb’s Paradox, part II

So, I’ve been thinking about Newcomb’s Paradox lately.

I think part of the issue is it conflates a couple issues, and it might be useful to consider them separately. So, think on these paradoxes:

**Determinism vs. Nondeterminism**

Consider a superhuman predictor and a fair coin. The predictor predicts what the coin will show, then you flip it. The predictor is [nearly] always right.

**Removal of free will**

A computer has been programmed to maximize its expected score as a player in the Newcomb scenario, given that the predictor has a copy of the program to analyze, run in simulation or on another computer, etc. How will it play?

My take on Newcomb’s paradox? It reduces to the question of whether free will makes our choices inherently unpredictable, and the paradox is thorny because free will isn’t well defined enough to provide a clear answer.

If we have no free will, it’s just the computer scenario. If we assume free willed actions are inherently unpredictable, then the existence of a predictor contradicts that assumption, just like it contradicts the assumption that the outcome of a fair coin flip cannot be predicted.

It doesn’t help to zip already compressed file formats, like jpeg or mpeg, it only wastes CPU. Uncompressed video, audio, or still images will compress better with algorithms which are dedicated for video, audio, or images than they will with general compressors. JPEG is for photos — for images which are line drawings use PNG.

Comments Off on Tip: compression

Okay, so the Periodic Table of the Elements is one of the iconic symbols of Chemistry. Even if you flunked your high school Chem, you’ll recognize it instantly. Unfortunately, if you flunked high school Chem, you won’t actually know what it *means*.

Not recognizing that it’s a systematic arrangement of all the chemical elements, elucidating their properties in terms of their electron structure, you’re tempted to fill it in instead with items from whatever interest you do have. Make a Periodic Table of Fruit, or a Periodic Table of Government, or a Periodic Table of Rhetoric, then feel like you’ve somehow contributed something useful to Fruit classification. But what does this non-Elemental table *mean*? Do the properties of fruit recur periodically as something corresponding to atomic number increases? What even corresponds to atomic number? Why should fruit group as if it had electron shells? Does your table actually explain anything? Or are you just capitalizing on the fact that atoms do have electron shells and so elemental properties do arrange into a periodic table which is tremendously useful for chemistry, and applying it to something completely inappropriate?

Comments Off on Periodic table of *

If you try and find out how you compute the distance between points on a sphere, you’ll get a bunch of sites which offer to calculate it for you if you enter the coordinates. If you search harder, you can even get the formula. But no one seems to be offering a derivation. So here you go.

First, some preliminaries. The half angle formulas give us 2 sin² ½ψ = 1-cos ψ. (Easily derivable from cos 2α = cos² α – sin² α.) The straight-line distance (cutting through the inside of the sphere) between two points on a unit sphere with an angle ψ between them is 2 sin ½ψ. (Bisect the triangle formed by the two points and the center of the sphere.)

Consider A and B to be our two points we want to get the distance between, with latitudes φ_{A} and φ_{B}, and longitudes which differ by Θ. We’ll operate mostly on the disk formed by the parallel through B. The point where it intersects the pole is D, and the projection of A onto it is C. Let EB be perpendicular to DC.

The radius of the parallel through A is cos φ_{A} = DC; the one through B is cos φ_{B} = DB. Angle CDB is Θ, so EB = r_{B} sin Θ and ED = r_{B} cos Θ.

EC = CD – ED = r_{A} – r_{B} cos Θ.

BC² = EC² – EB² = r_{A}² – 2 r_{A} r_{B} cos Θ + r_{B}² cos² Θ + r_{B}² sin² Θ = r_{A}² + r_{B}² – 2 r_{A} r_{B} cos Θ.

AC = |sin φ_{A} – sin φ_{B}|.

AB² = BC² + AC² = r_{A}² + r_{B}² – 2 r_{A} r_{B} cos Θ + sin² φ_{A} + sin² φ_{B} – 2 sin φ_{A} sin φ_{B}

= 2 – 2 r_{A} r_{B} cos Θ – 2 sin φ_{A} sin φ_{B}.

If ψ is the angle AOB (which is also the along-surface distance between A and B), then

AB² = 4 sin² ½ψ = 2 – 2 cos ψ.

So, 1 – r_{A} r_{B} cos Θ – sin φ_{A} sin φ_{B} = 1 – cos ψ.

ψ = arccos(cos φ_{A} cos φ_{B} cos Θ + sin φ_{A} sin φ_{B}).

Comments Off on Distance between points on a sphere

Powered by **WordPress**