Information Technology Reference
In-Depth Information
a first introduction to writing scientific software, with emphasis on two aspects:
-
The reliable translation of mathematical algorithms into working code
-
A glimpse of some relevant programming languages and tools
We work with very simple numerical sample problems such that the type of problem
and its solution methods are hopefully well understood. This enables us to con-
centrate on software issues. However, many of the important software issues listed
above are beyond the scope of this chapter, because they do not become evident
before one tries to implement sets of complicated algorithms.
6.1
Algorithms Expressed as Pseudo Code
Let us first address the issue of creating a program without errors . We suggest
approaching the challenge in two steps:
1. Express the numerical problem to be solved and the methods to be used in a
complete algorithm .
2. Translate the algorithm into a computer code using a specific programming
language.
Jumping directly from a compact description of the numerical problem to computer
programming is often an error-prone procedure, even if you are very experienced
with both the numerics of the problem and software development. The smaller you
can make the gap between an algorithm, expressed in mathematical terms on a piece
of paper, and a computer program, the easier it will be to develop the program
and check it for correctness. A direct consequence of this strategy is that we end
most of the discussion of numerical methods in this topic with detailed, complete
algorithms. In most cases it will be straightforward to translate the algorithm into
a program, provided you are experienced with programming, which is taken as a
prerequisite when working with this topic.
We emphasize the adjective complete in our phrase complete algorithms ;this
means that all numerical details are covered in the algorithm such that the imple-
mentation only involves a translation and no numerical or mathematical issues.
The art of formulating algorithms sufficiently close to computer programs is
best illustrated through examples. Two simple problem areas are considered here:
numerical integration by the trapezoidal rule and solution of an ordinary differential
equation (ODE) by the Heun scheme.
6.1.1
Basic Ingredients of Pseudo Codes
The mapping of a physical problem into computer code has some characteristics
that are independent of the problem being solved. First, the physical problem must
be expressed as a mathematical model, i.e., a set of mathematical problems to be
solved. For each mathematical problem we need to select an appropriate numerical
Search WWH ::




Custom Search