Book contents
- Frontmatter
- Contents
- Preface
- Part I Numerical Software
- 1 Why numerical software?
- 2 Scientific computation and numerical analysis
- 3 Priorities
- 4 Famous disasters
- 5 Exercises
- Part II Developing Software
- Part III Efficiency in Time, Efficiency in Memory
- Part IV Tools
- Part V Design Examples
- Appendix A Review of vectors and matrices
- Appendix B Trademarks
- References
- Index
3 - Priorities
Published online by Cambridge University Press: 28 January 2010
- Frontmatter
- Contents
- Preface
- Part I Numerical Software
- 1 Why numerical software?
- 2 Scientific computation and numerical analysis
- 3 Priorities
- 4 Famous disasters
- 5 Exercises
- Part II Developing Software
- Part III Efficiency in Time, Efficiency in Memory
- Part IV Tools
- Part V Design Examples
- Appendix A Review of vectors and matrices
- Appendix B Trademarks
- References
- Index
Summary
Let's get this straight. Your priorities in writing scientific software should be, roughly speaking:
correctness,
numerical stability,
accurate discretization (including estimating accuracy),
flexibility,
efficiency (speed and memory).
If your program is not correct, then nothing else matters. If the algorithm is not numerically stable, the results cannot be trusted (at least not unless you test them first). If the discretization or other approximations used are inaccurate we will still not be able to trust the results. Even better is to have a method that can estimate the errors in the discretization and approximations. The estimates don't have to be exact (if they were, we could compute the exact values), but good enough to give a reasonable idea of their size.
If the software is not flexible, then others probably won't use it, since they will have a hard time making it do something slightly different. Once we have a correct implementation of a numerically stable algorithm, then we can think about how to make it fast. Speed is still one of our priorities, but it comes last. Don't forget memory. If your algorithm needs more memory than your machine has, then it won't run. And sometimes this is more important than speed.
Correctness
Without correctness, we really can't expect any useful results. So we must first make sure that our programs bug-free. Since human beings make errors even for the simplest tasks (and programming involves a great deal of thought), the probability that someone can write a bug-free program of any significance without debugging is close to zero.
- Type
- Chapter
- Information
- Writing Scientific SoftwareA Guide to Good Style, pp. 30 - 35Publisher: Cambridge University PressPrint publication year: 2006