Little things

Though they can make a big difference, the things that distinguish carefully written numerical methods are often easy to miss, unless you’re looking for them. A few come to mind:

  1. Careful codes use structure. Matrices that are sparse or symmetric are treated as such, structures that are supposed to be conserved by the physics are conserved (at least approximately) bt the methods, and some attention is paid to things like monotonicity.
  2. Careful codes compute corrections. Computing a correction to an approximate answer is often easier than computing the “right” answer directly. And trying to get an answer in closed form is sometimes not a very useful computational tactic — it’s better to think in terms of iterations that apply a series of corrections (though direct methods are fine where appropriate!).
  3. Careful codes have meaningful safeguards. This is sometimes mis-interpreted as “lots of safeguards,” leading to codes that are impossible to read because they spend so much time checking on conditions that can clearly never happen and that have no particular relevance.
  4. Careful codes are backed by both testing and analysis. Ideally, the analysis should guide the design of the test cases.

Comments

blog comments powered by Disqus
Fork me on GitHub