## Friday, October 15, 2004

### Twelve Routes to Useless Computation

How very Zen-sounding. How very useless. Even if the goal is only to explore a new tool or a new mathematical idea, there must be some goal to guide a computation.

2. Solve the wrong problem

Also known as the build a swimming pool to avoid getting wet approach. This is a popular means for mathematicians to make themselves the butt of jokes ending with lines like consider a spherical cow.

3. Assume there exists a unique solution

There is an old joke about a mathematician who wakes to see that his blanket is on fire, sees a bucket of water in the corner, exclaims A solution exists! and goes back to sleep. I know of no comparable joke about an engineer with thirty feet of rope with which to build a bridge across a forty-foot chasm, but there ought to be one.

4. Put the method before the problem

You've done some work to reduce your problem to the solution of a large linear system, and you've decided to use dense Gaussian elimination with partial pivoting as your solution method. Your code runs slowly, so you buy a larger computer. After a month of painstaking work, you finally get an answer, which you proudly present to your boss. Your boss points out that while the equation 2x = b can indeed be solved using dense Gaussian elimination, dividing every element by two would have been much more economical, and fires you on the spot for gross incompetence.

5. Use the wrong level of abstraction

One-dimensional calculations are often easier than calculations in two and three dimensions. That doesn't keep people from devising elaborate theorems about the behavior of an equation on an n-dimensional manifolds when all anybody really cares about is the behavior on the interval [0,1]. This error is a favorite of novice C++ and Java programmers who supplant a modicum of common sense with a ton of object-oriented jargon.

6. Avoid useful tools

I'm not sure why people think it is more rigorous to write a half-assed code to solve a linear system (for example) rather than to use an existing library which is faster, more robust, better documented, and freely available. I'm also not sure why people solve medium-sized systems of linear equations by hand rather than use the computer. But there are people who do such things. May the Lord have mercy on their souls if they ever get between me and food in the process.

7. Insist on the wrong tools

If you want to solve a 2-by-2 linear system, do it in MATLAB, or Octave, or on your calculator, or by hand. Do not write a C++ program with a class hierarchy that takes three pages to describe. This is, of course, situational -- a C++ program with a three-page class heirarchy may be the right approach if you're solving a variety of types of linear systems, all with special structure that you can use, and you want to organize your ideas into a coherent library.

8. Don't consult the literature

It's good that you're a genius. We're all impressed that you managed to re-invent fire, the wheel, and the Edsel. Please be our competitor instead of our collaborator.

9. Blindly follow the literature

The literature on computing contains a lot of very good ideas by very smart people. It also contains some ideas which were obviously written while the author was hallucinating, and subsequently were reviewed by three chimps and a hung-over undergrad. Even if you read with enough criticism to pass over papers in the latter category, you may be reading papers by very smart people who were solving a problem only superficially similar to your own. This error is often coupled with solving the wrong problem, putting the method before the problem, or insisting on useless tools.

10. Mis-understand the error sources

If you model the Golden Gate bridge as a single degree of freedom system, fit your parameters very carefully, and use smart methods to figure out the resonant frequency of your model to a gazillion digits, that does not mean you know the resonant frequency of the Golden Gate to a gazillion digits. That doesn't keep people from claiming much higher accuracy than they really have -- and, upon later discovering that their answers don't match experiments, blaming the problem on roundoff error.

11. Fail to check the results

You wrote down the equations, you did a lot of algebra, and you got a solution. Did you actually test the solution to see if it satisfied the equations? A computation that fails for want of a sanity check is like the five-thousand dollar computer that sacrifices itself to save a five cent fuse.

UPDATE: As Heidi trenchantly observes, a bout of temporary confusion led me to use base 9 for my title numbering.