CS 205 – class 1
Types of Errors
Covered in class: 4, 6, 7
1.
When doing integer calculations one can many times proceed exactly, except of course in certain situations,
e.g. division 5/2=2.5. However, when doing floating point calculations rounding errors are the norm, e.g.
1./3.=.3333333… cannot be expressed on the computer. Thus the computer commits rounding errors to
express numbers with machine precision, e.g. 1./3.=.3333333. Machine precision is
7
10

for single precision
and
16
10

for double precision. Rounding errors are only one source of approximation error when considering
floating point calculations. Some others are listed below.
2.
Approximation errors come in many forms:
a.
empirical constants
– Some numbers are unknown and measured in a laboratory only to limited
precision. Others may be known more accurately but limited precision hinders the ability to express
these numbers on a finite precision computer. Examples include Avogadro’s number, the speed of
light in a vacuum, the charge on an electron, Planck’s constant, Boltzmann’s constant, pi, etc. Note
that the speed of light is 299792458 m/s exactly, so we are ok for double precision but not single
precision.
b.
modeling errors
– Parts of the problem under consideration may simply be ignored. For example,
when simulating solids or fluids, sometimes frictional or viscous effects respectively are not included.
c.
truncation errors
– These are also sometimes called discretization errors and occur in the
mathematical approximation of an equation as opposed to the mathematical approximation of the
physics (i.e. as in modeling errors). We will see later that one cannot take a derivative or integral
exactly on the computer so we approximate these with some formula (recall Simpson’s rule from your
Calculus class).
d.
inaccurate inputs
– Many times we are only concerned with part of a calculation and we receive a set
of input numbers and produce a set of output numbers. It is important to realize that the inputs may
have been previously subjected to any of the errors listed above and thus may already have limited
accuracy. This can have implications for algorithms as well, e.g. if the inputs are only accurate to 4
decimal places, it makes little sense to carry out the algorithm to an accuracy of 8 decimal places. This
issue commonly resurfaces in scientific visualization or physical simulation where experimental
engineers can be unhappy with visualization algorithms that are “lossy”, meanwhile forgetting that the
part that is lost may contain no useful, or accurate information whatsoever.
3.
More about errors
a.
In dealing with errors we will refer to both the absolute error and the relative error.
i.
Absolute error
= approximate value – true value
ii.
Relative error
= absolute error / true value
b.
One needs to be careful with big and small numbers, especially when dividing by the latter. Many
times calculations are
nondimensionalized
or
normalized
in order to operate in a reasonable range of
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
values. For example, consider the matrix equation
3 6
2 10
5 10
1
4
0
6
e
e
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '07
 Determinant, Numerical Analysis, Matrices, Triangular matrix

Click to edit the document details