566 Appendix A
impossible since the memory required for this would exceed any reasonable bounds.
Instead of representing the functions with the maximum precision possible, they are
usually defined on a much coarser grid, specified by the user and independent of the
representation of real numbers in the computer. Most problems can be solved with
sufficient accuracy using discretised variables. One should, however, in all cases
be careful in choosing the discretisation step; a balance must be found between the
number of values and the level of precision.
Suppose we want to solve Newton’s equations for the motion of a satellite orbiting
around the Earth. Its path is quite smooth, the velocity changes relatively slowly
so that a relatively large and constant time interval yields accurate results. If we
consider a rocket launched from the Earth which should orbit around the Moon,
most of the path between Earth and Moon will be smooth so that a large time step
is possible, but when the rocket comes close to the Moon, its velocity may change
strongly because of the Moon’s attraction, and a smaller time step will then be
necessary to keep the representation accurate.
Very many numerical methods are based on discretisation. If a function is repres-
ented on a discrete grid, it is possible to reconstruct the function by interpolation.
Interpolation often consists of constructing a polynomial that assumes the same
value as the discretised function on the grid points. The larger the number of points
taken into account, the higher the order of the interpolation polynomial. A higher
order implies a more accurate interpolation, but too high an order often results in
strongly oscillatory behaviour of the polynomial between the grid points, so that it
deviates strongly from the original function there. Interpolations are often used to
derive numerical methods with a high order of accuracy. Examples can be found
in the next two sections. When discretising a function, it should always be kept in
mind that the interval must be chosen such that the main features of the function
are preserved in the discretised representation.
A6 Numerical quadratures
Numerical integration (orquadrature) of a continuous and bounded function on the
interval[a,b]can be done straightforwardly. One defines an equidistant grid on the
interval[a,b]: the grid pointsxnare given by
xn=a+nh (A.25)
withh=(b−a)/Nand the indexnrunning from 0 toN. It is clear that a (crude)
approximation to the integral is given by the sum of the function values on the grid
points:
∫b
a
f(x)dx≈h
N∑− 1
n= 0
f(xn). (A.26)