April 02, 2009
Mathematics and programming
Jeff Atwood disputes the theory that competent programmers should be mathematically inclined. His conclusion may or may not be correct – I don’t have any evidence one way or the other. His reasoning, however, is wrong.
Jeff observes that “the vast bulk of code that I've seen consists mostly of the ‘balancing your checkbook’ sort of math, nothing remotely like what you'd find in the average college calculus textbook, even,” and gives the example i = j++ / (x + v) -- “not,” he rightly observes, “exactly the stuff mathletes are made of.”
Right, and nothing to do with being mathematically inclined either. Jeff seems to be one of those people who believes that what mathematicians do is sit around doing ever harder calculations. The sort of people who can only imagine Andrew Wiles proved Fermat’s Last Theorem by a fiendishly complicated process of long division.
In reality, the bulk of mathematical effort goes not into performing calculations, but into hypothesising and proving general truths. Let’s take a quick run down of the kind of skills mathematicians really use in doing this:
- Identifying useful abstractions – separating out the salient points of a problem.
- Formulating a path from A to B – building a high-level plan of attack for a problem or proof.
- Turning that plan of attack into a series of precise and rigorous steps, expressed using an abstract and formal notation.
- Bundling up appropriate partial results into handy lemmas – another example of identifying useful abstractions.
- Thinking about special cases that might invalidate the assumptions of the proof or require special handling.
The core skills of mathematics sound awfully like the core skills of programming. It is only “very hard … to draw a direct line from ‘good at math’ to ‘good at programming’” if you confuse mathematics with “mathletics.”
April 2, 2009 in Science, Software | Permalink | Comments (3) | TrackBack
July 11, 2008
MONIAC: adventures in analogue computing
Thanks to the wily Kirk Jackson and the, er, New Zealand Association of Economists, I had the pleasure this afternoon of seeing an unusual piece of computing history in action. MONIAC, the Monetary National Income Analogue Computer, also known as the Phillips Machine, was an analogue computer invented by Bill Phillips (he of curve fame) to model and simulate the relationships between various economic factors. Nothing unusual about that, except that it was invented in the 1940s... and instead of processing 0s and 1s, it processed water. The Reserve Bank of New Zealand has one of the few Phillips Machines still around and in working order, and as part of a lunchtime session for the NZAE conference they had cranked it up and were demonstrating it.
The machine works by circulating water around a network of tanks, taps, pumps and pipes. Values are represented by the levels of water in various tanks, parameters by opening and closing taps or moving valves up and down, and the key readouts of income and interest rates are recorded by pens moving against graph paper. Water, of course, represents money, though demonstrator Geoff Bertram was careful to refer to it at all times as "the circulating medium." I have to be a bit vague about what sort of things the various tanks and taps and throttles represented: explanations of the various bits in terms of private sector liquidity requirements and endogenous money supply undoubtedly made sense to the mainly economist audience but I'm afraid I struggled. Still, I gathered it was a pretty accurate simulation of the economic theories of the 1940s and 1950s; according to the demonstrator it effectively shut down a major debate of the time by convincing both sides that their arguments were actually compatible.
Of course, not being programmable, MONIAC can't be updated to reflect new factors and new economic conditions (such as globalisation). The demonstrator did, however, relate how one lecturer used to set up two MONIACs, one representing the US economy and one representing the UK, hook up the relevant bits of piping between the two machines, and challenge two sets of students to do the best for "their" economy, so within the constraints of the model there was a certain amount of flexibility.
On the other hand, MONIAC's analogue approach still rivals the digital approach in some ways. "It's solving nine simultaneous differential equations," noted the demonstrator. Given the sophistication of modern numerical techniques, and the effort that has undoubtedly been poured into economic simulation and prediction, it's no surprise that the Phillips Machine has been superseded, but I suspect that ultimately the digital equivalents are just badly simulating water flow, only more flexibly and a lot faster. One member of the audience, noting that the Phillips Machines had been used largely for educational purposes, asked Dr Bertram how he would present the same ideas now. "I'd draw a hydraulic diagram," he replied.
This being a computer demo, of course, things did not go quite to plan; but this being an analogue computer demo, they went not to plan not through the usual syntax errors and unhandled exceptions, but instead because the bit of plastic representing the level of imports had fallen off and had to be stuck back on with blu-tack, and the export doohickey had become stuck against its housing. Kernel fans will also be pleased to know that the Phillips Machine's ultimate failure mode is also described as "dumping," except in this case you end up with wet shoes and a massive carpet cleaning bill instead of just a nice convenient file. "Now it sits in this bath here, and we've fitted a drain through to the outside," noted Dr Bertram ruefully.
(Incidentally, Bill Phillips was a New Zealander: connoisseurs of Kiwiana will therefore note that the use of blu-tack to hold the level of imports steady counts as Kiwi ingenuity, while the failure mode of spewing the "circulating medium," i.e. the national economy, all over the floor represents classic Kiwi ingenuity, or possibly Rogernomics.)
This highlights another interesting feature of the analogue approach: its unpredictability. When the demonstrator was showing us "fiscal shocks" and "monetary shocks," he commented on how long the simulated economy took to react to stimuli such as suddenly injecting government investment or restricting lending. "Sometimes they take 30 seconds, sometimes they take five minutes," depending on the mood of the machine. Given the unpredictability of real economies, this in some ways seems like an attraction of the analogue approach. The downside? "Sometimes you'll be standing there talking about how things eventually come back to equilibrium, and everything's crashing and burning behind you." At least when my demos tank they don't take national economies with them.
Due to short notice, I don't have any pictures, but Wikipedia does (as does NZIER at the link above), and if you're in Australia or the UK, I gather there are also kinda-maybe-working machines at Melbourne University and at the Science Museum. There is also apparently one lost in Guatemalan jungle, so any budding Indiana Joneses of computing, now's your chance.
July 11, 2008 in Science, Software, Usability | Permalink | Comments (2) | TrackBack
June 28, 2008
Another sf prediction lets us down
BBC News: "Martian soil appears to contain sufficient nutrients to support life - or, at least, asparagus."
In all the mass of science fiction dealing with the terraforming and colonisation of Mars, I don't think anyone has ever depicted a market garden economy based on asparagus. Reality-shaping drugs? Sure. Angels? Absolutely. Elvis? Everywhere. Paul McAuley even placed a side bet on yaks. But nobody ever anticipated this, did they?
June 28, 2008 in Books, Science | Permalink | Comments (2) | TrackBack
October 31, 2007
Quite a lot of decades actually
I know we've been repeatedly burned by predictions that x many telephone numbers, IP addresses, kilobytes of memory, etc. will be enough to last for y zillion years, and then they suddenly run out after three weeks. But the BBC's willingness to concede only that "IPv6 will create 340 trillion trillion trillion separate addresses, enough to satisfy demand for decades (sic) to come," seems to take conservatism too far.
October 31, 2007 in Science, Web | Permalink | Comments (0) | TrackBack
September 15, 2006
Kallisti!
The newly christened Eris is already doing a fine job of sowing discord, this time amongst the brave defenders of embattled neoconservatism: "Come on! ... [They] were taking a cheap shot at world affairs. Why assume the anti-war vibe? Because of Michael Brown's own statements, coupled with the fact that he is from the California Institute of Technology, located in far west Moonbat country."
(Some debate at the Bad Astronomy Blog as to whether this is satire, but three updates from the original author say he's serious. Bless)
September 15, 2006 in Science | Permalink | Comments (0) | TrackBack
The planet that launched a thousand squabbles
BBC News: "The distant world whose discovery prompted leading astronomers to demote Pluto from the rank of 'planet' has now been given its own official name. Having caused so much consternation in the International Astronomical Union (IAU), the object has been called Eris, after the Greek goddess of discord." I love scientists.
September 15, 2006 in Science | Permalink | Comments (1) | TrackBack
September 11, 2006
Cool Earths outside Hot Jupiters
BBC News: "One of every three known planetary systems could harbour Earth-like planets in habitable zones further out than the Hot Jupiters." I wonder what the inhabitants of such a world would see in their sky, what kind of mythologies it would inspire and how it would affect the development of astronomy and philosophy.
September 11, 2006 in Science | Permalink | Comments (0) | TrackBack
August 26, 2006
Hallucinating Pluto
IAU, 16 August: "The world's astronomers... have concluded two years of work defining the difference between 'planets' and the smaller 'solar system bodies' such as comets and asteroids. If the definition is approved... our Solar System will include 12 planets, with more to come: eight classical planets that dominate the system, three planets in a new and growing category of 'plutons' - Pluto-like objects - and Ceres. Pluto remains a planet and is the prototype for the new category of 'plutons.'"
But wait!
BBC News, 24 August: "Astronomers have voted to strip Pluto of its status as a planet... The International Astronomical Union's (IAU) decision means textbooks will now have to describe a Solar System with just eight major planetary bodies. Pluto, which was discovered in 1930 by the American Clyde Tombaugh, will be referred to as a 'dwarf planet'."
But wait still more!
25 August: "Owen Gingerich... blamed the outcome in large part on a 'revolt' by dynamicists - astronomers who study the motion and gravitational effects of celestial objects. 'In our initial proposal we took the definition of a planet that the planetary geologists would like. The dynamicists felt terribly insulted that we had not consulted with them to get their views. Somehow, there were enough of them to raise a big hue and cry.'"
Those dastardly dynamicists!
Brilliantly, Pluto's defenders are now selling bumper stickers inviting motorists to "Honk if Pluto is still a planet."
Science hasn't been this much fun since Stephen Hawking punched Homer Simpson with a giant mechanical boxing glove.
August 26, 2006 in Science | Permalink | Comments (2) | TrackBack
February 09, 2006
"It's only a theory" strikes again
New York Times (via No Right Turn): "George Deutsch, a presidential appointee in NASA headquarters, told a Web designer working for the agency to add the word 'theory' after every mention of the Big Bang." Pedantic, but not necessarily wrong: after all, scientists refer to even well-tested laws as "theories," as in "theory of gravity" or "theory of relativity."
But read on. Astonishingly, it seems that the presidential appointee's orders were motivated by more than just a desire to conform to the Associated Press Stylebook and Libel Manual. (Aside: "Libel Manual"? Am I the only one to whom that sounds wrong? Surely a Libel Manual is what Private Eye issues to each new editor as he assumes the chair?) "The Big Bang is 'not proven fact; it is opinion,' Mr. Deutsch wrote, adding, 'It is not NASA's place, nor should it be, to make a declaration such as this about the existence of the universe that discounts intelligent design by a creator.'"
Oh. Considering the amount of money and time NASA has put into sending up satellites like the Hubble Telescope and Wilkinson Microwave Anisotropy Probe to collect images of the young universe and echoes of the Big Bang in order to help scientists understand the origin of the universe, it must be disappointing for them to learn at this late stage that they would have been better off sending an intern with a digital camera to Rome to take pictures of the Sistine Chapel, and spending the rest of the budget on Flying Spaghetti Monster merchandise.
But there's good news too. "On Friday evening, repeated queries were made to the White House about how a young presidential appointee with no science background came to be supervising Web presentations on cosmology and interview requests to senior NASA scientists. The only response came from Donald Tighe of the White House Office of Science and Technology Policy. 'Science is respected and protected and highly valued by the administration,' he said." So that's all right then.
February 9, 2006 in Science | Permalink | Comments (0) | TrackBack
November 13, 2005
Tinfoil hats
A MIT team investigates the effectiveness of tinfoil hats (via Bruce Schneier): "Among a fringe community of paranoids, aluminum helmets serve as the protective measure of choice against invasive radio signals. We investigate the efficacy of three aluminum helmet designs on a sample group of four individuals."
Two observations:
First, back in my day, the secret world government used to beam signals into our heads using orbital mind control lasers, not boring old radio signals. I suppose tinfoil hats would be a pretty effective defence against lasers -- any OMCL poowerful enough to penetrate a tinfoil hat would probably burn a hole in the paranoid's cranium -- so maybe that's why the government abandoned them, but I have to say I consider this a step down for nefarious conspiracies everywhere.
Second, I'm impressed by the sheer blatancy with which researchers now covet Ig Nobel prizes.
November 13, 2005 in Science | Permalink | Comments (1) | TrackBack