AMTH142 Lecture 6
Numerical Approximations
Reference: For the remainder of the unit the
best reference is -- Michael Heath, Scientific Computing:
An Introductory Survey, 2nd edition, McGraw Hill, 2002,
IBSN: 0-07-112229-X. The books's home page:
http://www.cse.uiuc.edu/heath/scicomp/index.html
includes lecture notes based on the book.
Reading: Heath §1.1 and §1.2
Finding a computational solution to a problem usually involves a number
of steps:
- Formulation of a mathematical model of the problem.
- Development of a numerical method to solve the mathematical
problem.
- Implementation of the numerical method, for example in Scilab.
- Running the numerical method to obtain the result.
- Analysis and interpretation of the result, repeating previous
steps if necessary.
The first source of error occurs before the computation begins.
These are the errors that arise from the mathematical model
iself by simplifying or omitting features of the problem.
These may be referred to as modelling errors.
The next source of error are data errors:
- Empirical Measurements. Many computations have
as input experimental data which, by their nature, have limited
accuracy.
- Previous Computations. Often the input data to
to a computation are produced by previous computations
whose results were only approximate.
The third sort of error is computational error:
- Truncation Error. In order to turn a mathematical
problem into a computational problem it is usually
necessary to make a number of mathematical approximations,
for example using a finite number of terms to approximate
an infinite series.
- Rounding Error. Numerical calculations are
limited in accuracy by the finite precision of computer
arithmetic.
Computing the area of the surface of the earth by the
formula
involves the following approximations:
- The earth is modelled by a sphere which is an approximation
to its true shape.
- The value for the radius of the earth (
km)
is based on empirical measurements.
- The value used for
has to be an approximation to its
true value.
- The actual calculation will involve rounding error.
These are defined by:
Absolute error |
Approximate value True value |
(1) |
Relative error |
 |
(2) |
Often the relative error is represented as a percentage.
A useful way to think of relative error is via the expression
Approximate value True value Relative error |
(3) |
Consider the problem of computing the value of some function
at a
point
.
Suppose we have to work with an approximation
to the data
and with an approximation
to the
function
. Then
Total error |
 |
|
|
 |
 |
 |
|
 |
Computational error |
Propagated data error |
|
The first term on the left is the difference between the exact
and approximate function values for the same input and can
therefore be considered as computational error in evaluating
the function
.
The second term is the difference in the values of the exact
function
due to errors in
and can therefore be considered
as propagated data error.
Note that the propagated data error does not depend on the
how we choose to approximate the function
, in other
words the propagated data error does not depend on
method used to solve the problem.
Consider the following very crude approximation:
We have used two approximations here:
Using the notation above, we have:
The correct value is
and the total error is
The propogated data error is
and the computational error is
with the sum of these
equal to the total error.
Taylor series are a very common and important type of
approximation. Taylor's theorem states:
Notes:
- Taylor's theorem is only true, in general, for ``small''
values of
. The infinite series may diverge for large
.
- There are some technical conditions on the function
in order for Taylor's theorem to hold, e.g. the function
must be infinitely differentiable.
These are usually satisfied in practice.
- The main use of Taylor's theorem is to approximate a
function by the first few terms of its Taylor series, i.e.
- For fixed number of terms in a truncated Taylor series,
the accuracy of the approximation decreases as
increases.
The accuracy generally increases as the number of terms is
increased.
Here are a few examples of Taylor series:
-
at
:
We need to evaluate the derivatives of
at
:
to give the approximation
-
at
:
A similar calculation gives
-
at
:
All the derivatives of
at
are equal to 1, so
The most direct application is to approximate
functions by their truncated Taylor series. The following
example examines the approximations to
by its
Taylor series given above:
We will use Scilab to compare the approximation of
by truncated Taylor series containing terms up to
,
and
respectively over the interval
:
-->h = linspace(-%pi, %pi, 1000);
-->y = sin(h);
-->y3 = h - h.^3/6;
-->y5 = h - h.^3/6 + h.^5/120;
-->y7 = h - h.^3/6 + h.^5/120 - h.^7/5040;
Note the use of the .^ operator. (Make sure you understand
what it does and why it is needed here, see §2.4 of Practical 2.)
We can compare the approximations graphically (do not clear the
graphics window between successive plots):
-->plot2d(h, y3)
-->plot2d(h, y5)
-->plot2d(h, y7)
-->plot2d(h, y)
We can also examine the error in the best approximation:
-->plot2d(h,y-y7)
Taylor series approximations are also useful as a
theoretical tool. The simple approximation
is particularly common.
This amounts to approximating
by the tangent to
at
.
Earlier in this lecture we came across the propagated data
error
Propagated data error
where
is an approximation to
.
Let
, then
This gives a useful estimate for the propagated data error for
small
.
Returning to an earlier example, we calculated the propagated
data error in
due to the approximation
as
.
Here we have
,
and
.
Using our approximation for the propagated data error
gives:
Error in the 7th order Taylor series approximation.
This document was generated using the
LaTeX2HTML translator Version 2K.1beta (1.61)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -split +0 lecture.tex
The translation was initiated by Applied Mathematics 142 on 2002-08-13
Applied Mathematics 142
2002-08-13