Published online by Cambridge University Press: 05 July 2012
Computer programs sometimes exhibit unexpected behavior. They may function correctly for years and then, suddenly, they fail. Computer programs that solve numerical problems are no exception. The unexpected behavior, perhaps a division by zero, is often the consequence of input that does not conform to the hidden assumptions and restrictions ofthe program. For example, a Gauss elimination procedure to solve systems oflinear equations requires the matrix to be non-singular. If the matrix is numerically singular or ill-conditioned, the mathematical problem of solving the system is still well-defined, but the numerical counterpart may have a hard time delivering a decent approximation to the exact solution. The conclusion that the matrix is ill-conditioned is only drawn while solving the system.
Sometimes there is a mismatch between the specification and the actual implementation. The part of the program that reads the data accepts input that conforms to the specification, but there are a few tacit assumptions, like line-endings for a text file containing the coefficients of the matrix for the Gauss elimination program.
Subtle bugs may lurk in an otherwise well-written and well-behaved program. Can you avoid them altogether? The unsatisfying answer is probably not, but that does not mean you cannot make an effort to understand the source of these bugs. That is the intention of this chapter – to examine three simple mathematical algorithms and their implementation in Fortran.
The idea is that a straightforward implementation contains all manners of hidden assumptions about the problem that needs solving.
To save this book to your Kindle, first ensure [email protected] is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.