Page 22 - Compact Numerical Methods For Computers
P. 22
12 Compact numerical methods for computers
As this revision is being developed, efforts are ongoing to agree an international
standard for Full BASIC. Sadly, in my opinion, these efforts do not reflect the majority
of existing commercial and scientific applications. which are coded in a dialect of
BASIC compatible with language processors from Microsoft Corporation or Borland
International (Turbo BASIC).
Many programmers and users do not wish to use BASIC, however, for reasons quite
apart from capability. They may prefer FORTRAN, APL, C, Pascal, or some other
programming language. On certain machinery, users may be forced to use the
programming facilities provided. In the 1970s, most Hewlett-Packard desktop
computers used exotic programming languages of their own, and this has continued
to the present on programmable calculators such as the HP 15C. Computers offering
parallel computation usually employ programming languages with special extensions
to allow the extra functionality to be exploited.
As an author trying to serve this fragmented market, I have therefore wanted to
keep to my policy of presenting the algorithms in step-and-description form.
However, implementations of the algorithms allow their testing, and direct publi-
cation of a working code limits the possibilities for typographical errors. Therefore,
in this edition, the step-and-description codes have been replaced by Turbo Pascal
implementations. A coupon for the diskette of the codes is included. Turbo Pascal
has a few disadvantages, notably some differences from International Standard
Pascal, but one of its merits (others are discussed in $1.6) is that it allows the
algorithms to be presented in a manner which is readable and structured.
In recent years the concepts of structured and modular programming have
become very popular, to the extent that one programming language (Modula-2) is
founded on such principles. The interested reader is referred to Kernighan and
Plauger (1974) or Yourdon (1975) for background, and to Riley (1988) for a more
modern exposition of these ideas. In my own work, I have found such concepts
extremely useful, and I recommend them to any practitioner who wishes to keep his
debugging and reprogramming efforts to a minimum. Nevertheless, while modular-
ity is relatively easy to impose at the level of individual tasks such as the decompo-
sition of a matrix or the finding of the minimum of a function along a line, it is not
always reasonable to insist that the program avoid GOTO instructions. After all, in
aimimg to keep memory requirements as low as possible, any program code which
can do double duty is desirable. If possible, this should be collected into a
subprogram. In a number of cases this will not be feasible, since the code may have to
be entered at several points. Here the programmer has to make a judgement between
compactness and readability of his program. I have opted for the former goal when
such a decision has been necessary and have depended on comments and the essential
shortness of the code to prevent it from becoming incomprehensible.
The coding of the algorithms in the book is not as compact as it might be in a
specific application. In order to maintain a certain generality, I have chosen to allow
variables and parameters to be passed to procedures and functions from fairly
general driver programs. If algorithms are to be placed in-line in applications, it is
possible to remove some of this program ‘glue’. Furthermore, some features may not
always be necessary, for example, computation of eigenvectors in the Jacobi method
for eigensolutions of a real symmetric matrix (algorithm 14).