jlm-blog
~jlm

10-May-2007

Tip: compression

Filed under: general — jlm @ 16:28

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.

3-May-2007

Periodic table of *

Filed under: science — jlm @ 13:36

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?

30-Mar-2007

Distance between points on a sphere

Filed under: math — jlm @ 15:22

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.) Together, these mean that the square of the straight-line distance is 2 − 2 cos ψ.

[Geometric diagram of a 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 rA = cos φA = DC; the one through B is rB = cos φB = DB. Angle CDB is Θ, so EB = rB sin Θ and ED = rB cos Θ.
EC = CD − ED = rArB cos Θ.
BC² = EC² − EB² = rA² − 2 rA rB cos Θ + rB² cos² Θ + rB² sin² Θ = rA² + rB² − 2 rA rB cos Θ.

AC = |sin φA − sin φB|.
AB² = BC² + AC² = rA² + rB² − 2 rA rB cos Θ + sin² φB − 2 sin φA sin φB
   = cos² φA + sin² φA + cos² φB + sin² φA + sin² φB − 2 rA rB cos Θ − 2 sin φA sin φB
   = 2 − 2 rA rB cos Θ − 2 sin φA sin φB.

If ψ is the angle AOB (which is also the along-surface distance between A and B), then
AB² = 2 − 2 cos ψ, from the “preliminaries”.
So, 1 − rA rB cos Θ − sin φA sin φB = 1 − cos ψ.
ψ = arccos(cos φA cos φB cos Θ + sin φA sin φB).

30-Jan-2007

Washington’s farewell address

Filed under: politics — jlm @ 17:36

Randall Munroe, of xkcd fame, has gone and translated George Washington’s farewell address into everyday speech. It’s an utterly fascinating read, and much more tractable than trying to read the whole thing (it’s quite long) in his original text. Washington’s ideas on what makes good government are well argued by him, and Munroe has made it accessable. Give it a read, you won’t regret it!

29-Jan-2007

Cell biology animation

Filed under: science — jlm @ 07:33

The folks at Harvard have put together an amazing CGI video showing some of the biochemical dynamics involved in our cells: The Inner Life of the Cell

There’s other good informative bio videos there, but nothing else with as tasty eye-candy.

Powered by WordPress