« October 2004 | Main | December 2004 »

Tuesday, November 30, 2004

FORTRAN Double Precision Constant Gotcha

What do you think this FORTRAN program prints, when compiled with g77 and run?
        X = 0.0025

        PRINT 1000, X
1000    FORMAT (1X, F14.12)

If you guessed "  0.002500000000", you've fallen into the same trap I did with the FORTRAN version of my floating point benchmark. In fact, this program prints "  0.002499999944". Why? Because the statement "X = 0.0025" assigns a REAL constant of 0.0025, which has only 32 bits of precision, to the DOUBLE PRECISION variable X, resulting in the round-off error when the value is printed to 12 decimal places. To cause the constant assigned to X to be treated as DOUBLE PRECISION, you must write "X = 0.0025D0", where the "D" exponent denotes a DOUBLE PRECISION constant. Earlier FORTRAN compilers with which the floating point benchmark was tested (for example SGI MIPSpro FORTRAN version 7.2.1) appear to promote decimal constants to DOUBLE PRECISION when they appear in a DOUBLE PRECISION expression or are used to initialise a DOUBLE PRECISION variable, but the FORTRAN standard does not specify this behaviour and the g77/gcc compiler strictly follows the standard and requires the "D" in all DOUBLE PRECISION constants.

Posted at 20:48 Permalink

Sunday, November 28, 2004

Yotta Yotta Universe

As you probably know, the SI unit prefixes which used to stop at "exa" (1018) and "atto" (10-18) have been expanded to include "zetta" (1021), "yotta" (1024), and on the small side "zepto" (10-21) and "yocto" (10-24). Excuse me if I think of the Marx brothers.

I thought it would be interesting to work out the size of the universe in terms of Planck lengths (the smallest meaningful length based on dimensional analysis of the fundamental constants; the length scale at which quantum gravity is believed to be fully manifest). The "size of the universe" in any units depends on a large number of assumptions; I'll use the Hubble age of the universe, about 13.7×109 years times the speed of light here (most topological models of the universe yield a larger size, so consider this conservative). The Hubble time is 4.32×1017 seconds which, converted to distance by multiplying by the speed of light, is about 1.30×1026 metres. Now the Planck distance ((Gℏ)/c³)½ is about 1.6×10-35 metres, so the radius of the universe is about 8×1060 Planck lengths. Given the uncertainty in the age of the universe and what expressing it in length means, we might as well round this off to 1060 Planck lengths. So how big is the universe in Planck lengths? Mega, mega, yotta, yotta big!

Posted at 22:48 Permalink

Saturday, November 27, 2004

Quarter Million Year Canon of Solar System Transits

Last May I decided to see if the long-term evolution of planetary orbits in the Solar System ever resulted in a simultaneous transit of Mercury and Venus visible from Earth in the distant past or future (I chose a period of ±125,000 years for the investigation). Little did I know at the time that Jean Meeus was working on the same problem, and beat me to the solution, publishing the July 69163 simultaneous transit in the June 2004 issue of The Journal of the British Astronomical Association. But all was not lost, since my transit finder, based on Steve Moshier's DE118i-2 numerical integrator, was producing a list of all planetary transits (excluding grazes and short events which start and end within one integration step of 1/100 day [14.4 minutes]), plus barycentre excursions. Suitably post-processed by a camel of Perl programs, the results were assembled into a comprehensive catalogue of transits, which is now posted. All of the software used to produce the canon is available for downloading, as is the canon itself in CSV format. Computation of the list of transits took two months on my 1 GHz "laptop", with the backward integration running for a month in parallel on another 400 MHz machine, then transferred back to the faster laptop after it completed the forward integration. In any project like this, one always worries about whether the answers obtained are, you know, right, so I spent a lot of time on both internal consistency checks of the results and comparing them to other published investigations of historical and future transits, described in a section near the end of the document.

Posted at 15:45 Permalink

Reading List: Financial Reckoning Day

Bonner, William with Addison Wiggin. Financial Reckoning Day. Hoboken, NJ: John Wiley & Sons, 2003. ISBN 0-471-44973-3.
William Bonner's Daily Reckoning newsletter was, along with a few others like Downside, a voice of sanity in the bubble markets of the turn of millennium. I've always found that the best investment analysis looks well beyond the markets to the historical, social, political, moral, technological, and demographic trends which market action ultimately reflects. Bonner and Wiggin provide a global, multi-century tour d'horizon here, and make a convincing case that the boom, bust, and decade-plus "soft depression" which Japan suffered from the 1990s to the present is the prototype of what's in store for the U.S. as the inevitable de-leveraging of the mountain of corporate and consumer debt on which the recent boom was built occurs, with the difference that Japan has the advantage of a high savings rate and large trade surplus, while the U.S. saves nothing and runs enormous trade deficits. The analysis of how Alan Greenspan's evolution from supreme goldbug in Ayn Rand's inner circle to maestro of paper money is completely consistent with his youthful belief in Objectivism is simply delightful. The authors readily admit that markets can do anything, but believe that in the long run, markets generally do what they "ought to", and suggest an investment strategy for the next decade on that basis.

Posted at 15:10 Permalink

Saturday, November 20, 2004

Reading List: Inside the Asylum

Babbin, Jed. Inside the Asylum. Washington: Regnery Publishing, 2004. ISBN 0-89526-088-3.
You'll be shocked, shocked, to discover, turning these pages, that the United Nations is an utterly corrupt gang of despots, murderers, and kleptocrats, not just ineffectual against but, in some cases, complicit in supporting terrorism, while sanctimoniously proclaiming the moral equivalence of savagery and civilisation. And that the European Union is a feckless, collectivist, elitist club of effete former and wannabe great powers facing a demographic and economic cataclysm entirely of their own making. But you knew that, didn't you? That's the problem with this thin (less than 150 pages of main text) volume. Most of the people who will read it already know most of what's said here. Those who still believe the U.N. to be "the last, best hope for peace" (and their numbers are, sadly, legion--more than 65% of my neighbours in the Canton of Neuchâtel voted for Switzerland to join the U.N. in the March 2002 referendum) are unlikely to read this book.

Posted at 13:54 Permalink

Thursday, November 18, 2004

Reading List: Isaac Newton

Gleick, James. Isaac Newton. New York: Pantheon Books, 2003. ISBN 0-375-42233-1.
Fitting a satisfying biography of one of the most towering figures in the history of the human intellect into fewer than 200 pages is a formidable undertaking, which James Gleick has accomplished magnificently here. Newton's mathematics and science are well covered, placing each in the context of the "shoulders of Giants" which he said helped him see further, but also his extensive (and little known, prior to the twentieth century) investigations into alchemy, theology, and ancient history. His battles with Hooke, Leibniz, and Flamsteed, autocratic later years as Master of the Royal Mint and President of the Royal Society and ceaseless curiosity and investigation are well covered, as well as his eccentricity and secretiveness. I'm a little dubious of the discussion on pp. 186-187 where Newton is argued to have anticipated or at least left the door open for relativity, quantum theory, equivalence of mass and energy, and subatomic forces. Newton wrote millions of words on almost every topic imaginable, most for his own use with no intention of publication, few examined by scholars until centuries after his death. From such a body of text, it may be possible to find sentences here and there which "anticipate" almost anything when you know from hindsight what you're looking for. In any case, the achievements of Newton, who not only laid the foundation of modern physical science, invented the mathematics upon which much of it is based, and created the very way we think about and do science, need no embellishment. The text is accompanied by 48 pages of endnotes (the majority citing primary sources) and an 18 page bibliography. A paperback edition is now available.

Posted at 14:59 Permalink

Monday, November 15, 2004

Reading List: Content Syndication with RSS

Hammersley, Ben. Content Syndication with RSS. Sebastopol, CA: O'Reilly, 2003. ISBN 0-596-00383-8.
Sometimes the process of setting standards for the Internet just leaves you wanting to avert your eyes. The RSS standard, used by Web loggers, news sites, and other to provide "feeds" which apprise other sites of updates to their content is a fine example of what happens when standards go bad. At first, there was the idea that RSS would be fully RDF compliant, but then out came version 0.9 which used RDF incompletely and improperly. Then came 0.91, which stripped out RDF entirely, which was followed by version 1.0, which re-incorporated full support for RDF along with modules and XML namespaces. Two weeks later, along came version 0.92 (I'm not making this up), which extended 0.91 and remained RDF free. Finally, late in 2002, RSS 2.0 arrived, a further extension of 0.92, and not in any way based on 1.0--got that? Further, the different standards don't even agree on what "RSS" stands for; personally, I'd opt for "Ridiculous Standard Setting". For the poor guy who simply wants to provide feeds to let folks know what's changed on a Web log or site, this is a huge mess, as it is for those who wish to monitor such feeds. This book recounts the tawdry history of RSS, provides examples of the various dialects, and provides useful examples for generating and using RSS feeds, as well as an overview of the RSS world, including syndication directories, aggregators, desktop feed reader tools, and Publish and Subscribe architectures.

Posted at 21:16 Permalink

U.S. Supreme Court--Re-confirmation Amendment

Many people are worried about appointments to the U.S. Supreme Court; regardless of which party wins an election, the judges appointed and confirmed during their term in government serve for life (unless impeached), and thus can cast a shadow in history much longer than the returns from any single election.

I am neither a U.S. citizen, resident, nor voter, but will you permit me to propose an amendment to their Constitution to limit the long-term impact of ideological excursions in their politics? When the U.S. Constitution was ratified, people who had attained the age to become candidates for the Supreme Court didn't, for the most part (although there were exceptions), live for all that long after they took office. Now, however, it's quite likely that a nominee at age 50 may continue to sit on the court for five decades--twelve presidential elections--after having been chosen. Further, sitting justices (I detest that word--only "judge" is actually valid, but most people use the former) tend to time their retirements so similarly-inclined administrations get to choose their successors, which introduces further decades of time-hysteresis into the system.

What I propose is simple, albeit requiring a Constitutional amendment to implement. Judges nominated and confirmed for seats on the Supreme Court shall be re-confirmed for their seats on or before 7 years after their last confirmation or re-confirmation. Re-confirmation shall require a vote of <RADICAL>50%</RADICAL> <REASONABLE>33%</REASONABLE> or more of the Senate. Failure to re-confirm will result in the seat being declared open and subject the the regular nomination and confirmation process. The non-confirmed judge may, of course, be re-nominated as his or her own successor.

To answer some questions in advance, I've chosen seven years not out of fondness for the French septennat, but because it's relatively prime with the terms of U.S. representatives, presidents, and senators. Further, I'd advocate this rule be applied for all "appointed for life" judicial posts in the U.S., not just the Supreme Court. If there's one lesson of democracy, it's not that it guarantees the optimal solution, but that it provides an excellent error correction mechanism when things start going sideways.

The goal is simply to provide a mechanism to re-sync the judicial review process with the political consensus on a rolling time frame longer than the presidential election cycle but not determined by the aleatory vagaries of human mortality.

Posted at 02:41 Permalink

Sunday, November 14, 2004

Generator for Reading List Available

Yesterday I put the new version of the reading list into production. The cross-linked document tree and RSS feed are automatically generated from a single chronological list by a purpose-built Perl program. The Perl program doesn't use any modules for HTML, XML, RSS, etc.--it's pure old-fashioned text bashing, although it will require a modern version of Perl--I developed it on 5.8.0. I'll eventually add a download link on the reading list page, but as I'm still finding and fixing little things, I'll hold off until it settles down a bit more. If you'd like to preview the current state of things, you can download the archive; this location will remain the same when it's posted on the reading list page.

I seriously considered using Movable Type to manage the reading list, but after several experiments (which is why the syntax I use for the reading list database bears such a strong resemblance to a Movable Type import file), I decided it would be easier to accomplish precisely what I wanted with my own generator. Certainly, with sufficient templates and plug-ins, I could have made Movable Type do the job, but my judgment was that it would end up taking more work and be more difficult to maintain in the future, and having finished the project I don't regret the course I took.

This project goes much deeper into CSS2 style sheets than anything I've done before. I did most of my testing with Mozilla Firefox 1.0 and, of course, Exploder, and tweaked things so nothing falls on its face with either. There may be some problems with older, buggy browsers, but as far as I know everything I've used is employed by myriad Movable Type Web logs, so I expect the results, if infelicitous, to be at least legible. Yes, I've tested the new version with Lynx; it works fine.

Posted at 23:24 Permalink

Reading List: Persepolis: The Story of a Childhood

Satrapi, Marjane. Persepolis: The Story of a Childhood. New York: Pantheon Books, [2000, 2001] 2003. ISBN 0-375-71457-X.
This story is told in comic strip form, but there's nothing funny about it. Satrapi was a 10 year old girl in Tehran when the revolution overthrew the Shah of Iran. Her well-off family detested the Shah, had several relatives active in leftist opposition movements, and supported the revolution, but were horrified when the mullahs began to turn the clock back to the middle ages. The terror and mass slaughter of the Iran/Iraq war are seen through the eyes of a young girl, along with the paranoia and repression of the Islamic regime. At age 14, her parents sent her to Vienna to escape Iran; she now lives and works in Paris. Persepolis was originally published in French in two volumes (1, 2). This edition combines the two volumes, with Satrapi's original artwork re-lettered with the English translation.

Posted at 23:02 Permalink

Saturday, November 13, 2004

Reading List: Our Oldest Enemy

Miller, John J. and Mark Molesky. Our Oldest Enemy. New York: Doubleday, 2004. ISBN 0-385-51219-8.
In this history of relations between the America and France over three centuries--starting in 1704, well before the U.S. existed, the authors argue that the common perception of sympathy and shared interest between the "two great republics" from Lafayette to "Lafayette, we are here" and beyond is not borne out by the facts, that the recent tension between the U.S. and France over Iraq is consistent with centuries of French scheming in quest of its own, now forfeit, status as a great power. Starting with French-incited and led Indian raids on British settlements in the 18th century, through the undeclared naval war of 1798-1800, Napoleon's plans to invade New Orleans, Napoleon III's adventures in Mexico, Clemenceau's subverting Wilson's peace plans after being rescued by U.S. troops in World War I, Eisenhower's having to fight his way through Vichy French troops in North Africa in order to get to the Germans, Stalinst intellectuals in the Cold War, Suez, de Gaulle's pulling out of NATO, Chirac's long-term relationship with his "personal friend" Saddam Hussein, through recent perfidy at the U.N., the case is made that, with rare exceptions, France has been the most consistent opponent of the U.S. over all of their shared history. The authors don't hold France and the French in very high esteem, and there are numerous zingers and turns of phrase such as "Time and again in the last two centuries, France has refused to come to grips with its diminished status as a country whose greatest general was a foreigner, whose greatest warrior was a teenage girl, and whose last great military victory came on the plains of Wagram in 1809" (p. 10). The account of Vichy in chapter 9 is rather sketchy and one-dimensional; readers interested in that particular shameful chapter in French history will find more details in Robert Paxton's Vichy France and Marc Ferro's biography, Pétain or the eponymous movie made from it.

Posted at 16:52 Permalink

Thursday, November 11, 2004

Amazon Search ISBNs--How Dumb Can You Get?

My "Recommend Book" page allows people to enter the ISBN numbers of books they think I should read and, over the years, it has been the source of numerous books which have broadened my intellectual horizons beyond the well-tramped turf I usually inhabit. One persistent mystery was why some ISBNs (International Standard Book Numbers) failed to find a book at Amazon while entering the author and title would immediately retrieve the self-same book with the same ISBN.

It's because Amazon are idiots.

There is no standard at all about separating digits in an ISBN by dashes, periods, or other delimiters. Usually, they designate the country, publisher, etc. but ultimately all that matters is the numbers (and the final checksum, which can be a number or the letter "X").

Believe it or not, Amazon.com's "advanced search" page requires you to enter ISBNs with no delimiters at all--notwithstanding that the book you're looking at has dashes (or periods if you're French, or spaces if you're British) between groups of characters.

It would take precisely one Perl regular expression to make every ISBN search so-entered which came up blank actually find the book the user was looking for. Amazon, little help here?

Posted at 01:23 Permalink

Tuesday, November 9, 2004

Reading List: Jennifer Government

Barry, Max. Jennifer Government. New York: Vintage Books, 2003. ISBN 1-4000-3092-7.
When you try to explain personal liberty to under-thirty-fivers indoctrinated in government schools, their general reaction is, "Well, wouldn't the big corporations just take over and you'd end up with a kind of corporate fascism which relegated individuals to the rôle of passive consumers?" Of course, that's what they've been taught is already the case--even as intrusive government hits unprecedented new highs--but then logic was never a strong point of collectivist kiddies. Max Barry has written the rarest of novels--a persuasive libertarian dystopia--what it would look like if the "big corporations" really did take over. In this world, individuals take the surname of their employer, and hence the protagonist, Jennifer, is an agent of what is left of the Government--get it? It is a useful exercise for libertarians to figure out "what's wrong with this picture" and identify why corporations self-size to that of the predominant government power: the smaller the government, the more local the optimal enterprise.

Posted at 01:42 Permalink

Monday, November 8, 2004

Importing New Weblogs into Movable Type

If you import an entire database into a new weblog with Movable Type you may get weird:
    uninitialized value in substitution iterator at
        lib/MT/Util.pm line 146
messages (this is with Movable type 3.121). This is due to pure imports not setting the language for the date/time display. If you go to the configuration page for the weblog and set the Preferences/Language for Date Display to "English", it should fix the problem. When I imported my reading list generated by a Perl program, the date display language ended up set as "Czech". If you get similar error messages, czech and double czech that this hasn't happened to you.

Posted at 00:06 Permalink

Sunday, November 7, 2004

Floating Point Benchmarks

There are many disadvantages to being a balding geezer. In compensation, if you've managed to live through the second half of the twentieth century and been involved in computing, there's bearing personal witness to what happens when a technological transition goes into full-tilt exponential blow-off mode. I'm talking about Moore's Law (actually, more of an observation than a law, since it's predicated on certain physical principles and can't go on forever)--computing power available at constant cost doubling every 18 months or so. I've not only seen this happen, I've--er--profited from it; had the 80286-based IBM PC/AT and its competitors not appeared when they did, Autodesk would have been stillborn as too early to market or drowned out by competitors as we arrived too late.

When Moore's Law is directly wired to your career and your bank account, it's nice to have a little thermometer you can use to see how it's going as the years roll by. This page links to two benchmarks I've used to evaluate computer performance ever since 1980. They focus on things which matter dearly to me--floating point computation speed, evaluation of trigonometric functions, and matrix algebra. If you're interested in text searching or database retrieval speed, you should run screaming from these benchmarks. Hey, they work for me.

Posted at 01:26 Permalink

Saturday, November 6, 2004

IQ and The Pentagon's New Map

In Thomas Barnett's The Pentagon's New Map, one of the assumptions underlying his aggressive strategy of integrating the disconnected countries he places in the "gap" into the "functioning core" of globalisation is that with military intervention where required to topple authoritarian regimes which profit from their population's disconnectedness and patient "system administration" by benevolent nation builders with guns, any country in the gap can become a fully functional part of the core--it is only accidents of history and geography which have excluded countries from the march of globalisation.

But in IQ and the Wealth of Nations, Lynn and Vanhanen find that the strongest single factor which correlates with per capita income and the rate of economic growth is the mean IQ of a country's population. I thought it would be interesting to compare the mean IQ of the countries in Barnett's core and gap, so I took a copy of the global composite country database I prepared for the Global IQ: 1950-2050 study and marked countries as "Core" or "Gap" according to Barnett's map. A little Perl program was then used to compute population, mean and standard deviation of IQ, and number of countries in each region and the world as a whole, with the following results:

RegionCountriesPopulation × 109Mean IQIQ Std. Dev.
Core 54 3.98 93.5 7.3
Gap 131 2.31 81.2 9.3
World 185 6.29 89.0 12.2

This is very interesting, since Lynn and Vanhanen find a mean population IQ of 90 or above is a prerequisite for economic development of the kind associated with the globalised "core" nations. If this is the case, "shrinking the gap" is going to take a lot more than military intervention and nation-building (and explains why so many development assistance programs to date have produced such meagre results).

Barnett assigns India to the core, which skews the results substantially, since Lynn and Vanhanen estimate the mean IQ of the Indian population as just 81. While India is a rapidly developing part of the global economy, a large portion of the population remains in traditional villages (60% of the population is engaged in agriculture, according to the CIA World Factbook), a lifestyle associated with lower IQ (urban populations with access to education have higher IQ than rural populations with identical ethnic composition), so India's mean IQ can be expected to rise as more of its population is brought into the modern economy. If we were to deem India a "gap" country, as many would have not long ago, the results are even more striking:

RegionCountriesPopulation × 109Mean IQIQ Std. Dev.
Core 53 2.93 98.0 6.9
Gap 132 3.36 81.2 9.3
World 185 6.29 89.0 12.2

This suggests that instead of spending trillions on "Leviathan" military solutions, it might be wise to invest far more modest sums in trying to learn just what intelligence is and how to increase it.

Posted at 15:30 Permalink

Friday, November 5, 2004

Fixing the "Broken Pipe" Error in Movable Type NetPBM Thumbnail Generation

If you assiduously follow the instructions in the Movable Type manual for configuring image thumbnail generation using the NetPBM image processing toolkit on your Unix server and end up with a pink pop-up box with the message "Broken Pipe" followed by a huge amount of gibberish, the most likely cause is that you've installed libraries (for example libjpeg.*) in a location where the user ID under which CGI programs run cannot find them. Many users install third party packages in the /usr/local directory tree and set up their PATH and LD_LIBRARY_PATH to include the binary and library directories there. Unfortunately, CGI programs tend to run with a minimal library path, so even though you've specified a NetPBMPath in mt.cfg or installed the utilities in one of the default directories, if they can't find their libraries they collapse ignominiously, leading to the "Broken Pipe" disaster.

If you're the server's administrator, the easiest way by far to fix this is to install all the requisite libraries into a standard library directory such as /usr/lib. If you can't do that, you'll have to figure out how to guarantee the NetPBM programs can find the shared libraries, or else link the required utilities with static libraries so they'll work regardless of the server's shared library environment.

Posted at 21:41 Permalink

Wednesday, November 3, 2004

Reading List: The Pentagon's New Map

Barnett, Thomas P. M. The Pentagon's New Map. New York: G.P. Putnam's Sons, 2004. ISBN 0-399-15175-3.
This is one scary book--scary both for the world-view it advocates and the fact that its author is a professor at the U.S. Naval War College and participant in strategic planning at the Pentagon's Office of Force Transformation. His map divides the world into a "Functioning Core" consisting of the players, both established (the U.S., Europe, Japan) and newly arrived (Mexico, Russia, China, India, Brazil, etc.) in the great game of globalisation, and a "Non-Integrating Gap" containing all the rest (most of Africa, Andean South America, the Middle East and Central and Southeast Asia), deemed "disconnected" from globalisation. (The detailed map may be consulted on the author's Web site.) Virtually all U.S. military interventions in the years 1990-2003 occurred in the "Gap" while, he argues, nation-on-nation violence within the Core is a thing of the past and needn't concern strategic planners. In the Gap, however, he believes it is the mission of the U.S. military to enforce "rule-sets", acting preemptively and with lethal force where necessary to remove regimes which block connectivity of their people with the emerging global system, and a U.S.-led "System Administration" force to carry out the task of nation building when the bombs and boots of "Leviathan" (a term he uses repeatedly--think of it as a Hobbesian choice!) re-embark their transports for the next conflict. There is a rather bizarre chapter, "The Myths We Make", in which he says that global chaos, dreams of an American empire, and the U.S. as world police are bogus argument-enders employed by "blowhards", which is immediately followed by a chapter proposing a ten-point plan which includes such items as invading North Korea (2), fomenting revolution in (or invading) Iran (3), invading Colombia (4), putting an end to Wahabi indoctrination in Saudi Arabia (5), co-operating with the Chinese military (6), and expanding the United States by a dozen more states by 2050, including the existing states of Mexico (9). This isn't globocop? This isn't empire? And even if it's done with the best of intentions, how probable is it that such a Leviathan with a moral agenda and a "shock and awe" military without peer would not succumb to the imperative of imperium?

Posted at 22:42 Permalink

U.S. Election Returns, Viewed from Switzerland

Harry Schultz and John Walker on U.S. election night 2004

Legendary market and geopolitical analyst Harry D. Schultz and John Walker take a break for a photo op at around 02:00 local time while following the U.S. election returns on 2004-11-03 in Montreux, Switzerland.

As Yogi Berra said, "It's hard to make predictions, especially about the future.", but the predictions of the attendees at this soirée, declared before the polls closed in the U.S., were accurate to a degree unmatched by any of the polling services or news media. By 02:30, the outcome (based on Bush running ahead of his 2000 figures) was sufficiently obvious we decided to call it a night.

Posted at 22:17 Permalink